Git Product home page Git Product logo

protocolservicekit's Introduction

👋 Welcome to DragonLi's github.

- 💪 多年移动端工作经验
- 📝 Swift/Objective-C/Shell/Ruby/Python/java
- 📮[email protected]
- 岗位:长方形混泥土资深移动小师傅
DragonLi's github stats
Repo Languages

DevDragonLi Language

protocolservicekit's People

Contributors

devdragonli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

protocolservicekit's Issues

内部通过异步并行队列执行注册操作,多次注册同一个协议实现类时存在隐患。

通过如下代码多次注册协议实现类时存在隐患,可能产生脏数据:
`
for (int idx = 0; idx < 5; idx++) {

    NSArray *clzNameArr = @[@"LFLImp1", @"LFLImp2", @"LFLImp3", @"LFLImp4", @"LFLImp5"];
    
    for (NSString *clzName in clzNameArr) {
        [[ProService sharedManger] configProtocolServiceMapsWithDic:@{
            @"LFLUnRuleProtocol" : clzName
        }];
    }
        
    Class clz = ServiceWithProtocol(LFLUnRuleProtocol);
    NSLog(@"第%d次注册, 注册类名: %@", idx + 1, NSStringFromClass(clz));
}

`

输出:

2020-11-23 16:23:05.907336+0800 ProtocolServiceManger_Example[63550:522486] 第1次注册, 注册类名: LFLImp2 2020-11-23 16:23:05.907472+0800 ProtocolServiceManger_Example[63550:522486] 第2次注册, 注册类名: LFLImp1 2020-11-23 16:23:05.907584+0800 ProtocolServiceManger_Example[63550:522486] 第3次注册, 注册类名: LFLImp1 2020-11-23 16:23:05.907703+0800 ProtocolServiceManger_Example[63550:522486] 第4次注册, 注册类名: LFLImp3 2020-11-23 16:23:05.907840+0800 ProtocolServiceManger_Example[63550:522486] 第5次注册, 注册类名: LFLImp1 2020-11-23 16:23:05.909481+0800 ProtocolServiceManger_Example[63550:522486] 协议为:LFLUnRuleProtocol,实际实现类为LFLImp4

推荐做线程安全处理。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.