public synchronized void unregister(AsciiString uri, ChannelHandler handler) { Optional .ofNullable(_handlerMap.get(uri)) .flatMap(l -> Optional.ofNullable( l.stream().filter(p -> p.second == handler) .filter(l::remove).findAny().isPresent() ? l : null)) .filter(List::isEmpty) .ifPresent(l -> _handlerMap.remove(uri, l));}
No comments:
Post a Comment