Refine search
public ConsumerFilterData get(final String topic, final String consumerGroup) { if (!this.filterDataByTopic.containsKey(topic)) { return null; } if (this.filterDataByTopic.get(topic).getGroupFilterData().isEmpty()) { return null; } return this.filterDataByTopic.get(topic).getGroupFilterData().get(consumerGroup); }
@SuppressWarnings("unchecked") public <E extends T> boolean processEvent(E event) { boolean consumed = false; if(onEventConsumer != null){ onEventConsumer.consumeEvent(event); consumed = true; } if(!eventConsumers.isEmpty()){ EventConsumer<T> eventConsumer = (EventConsumer<T>) eventConsumers.get(event.getClass()); if(eventConsumer != null){ eventConsumer.consumeEvent(event); consumed = true; } } return consumed; }
public synchronized void removeContext(final String path, final String jvmRoute, final Context context) { if (path == null || path.isEmpty()) { throw UndertowMessages.MESSAGES.pathMustBeSpecified(); } final String normalizedPath = URLUtils.normalizeSlashes(path); if (STRING_PATH_SEPARATOR.equals(normalizedPath)) { defaultHandler.contexts.remove(jvmRoute, context); } final HostEntry hostEntry = contexts.get(normalizedPath); if (hostEntry != null) { if (hostEntry.contexts.remove(jvmRoute, context)) { if (hostEntry.contexts.isEmpty()) { contexts.remove(normalizedPath); buildLengths(); } } } }
public synchronized void removeHandler(T handler, ContextInternal context) { EventLoop worker = context.nettyEventLoop(); Handlers<T> handlers = handlerMap.get(worker); if (!handlers.removeHandler(new HandlerHolder<>(context, handler))) { throw new IllegalStateException("Can't find handler"); } if (handlers.isEmpty()) { handlerMap.remove(worker); } if (handlerMap.isEmpty()) { hasHandlers = false; } //Available workers does it's own reference counting -since workers can be shared across different Handlers availableWorkers.removeWorker(worker); }
if (localeToCharsetMap.isEmpty()) { return defaultEncoding; } else { String charset = (String) localeToCharsetMap.get(locale.toString()); if (charset == null) { if (locale.getVariant().length() > 0) { Locale l = new Locale(locale.getLanguage(), locale.getCountry()); charset = (String) localeToCharsetMap.get(l.toString()); if (charset != null) { localeToCharsetMap.put(locale.toString(), charset); charset = (String) localeToCharsetMap.get(locale.getLanguage()); if (charset != null) { localeToCharsetMap.put(locale.toString(), charset);
public void destroy(Subscriber subscriber) { final String groupAndSubject = subscriber.name(); if (!subscribers.containsKey(groupAndSubject)) { return; } final ConcurrentMap<String, Subscriber> m = subscribers.get(groupAndSubject); if (m == null) { return; } m.remove(subscriber.getConsumerId()); if (m.isEmpty()) { handleGroupOffline(subscriber); } }
protected void removeFromAddressMappings(Address client_addr) { if(client_addr == null) return; Set<Tuple<String,Address>> suspects=null; // group/address pairs for(Map.Entry<String,ConcurrentMap<Address,Entry>> entry: address_mappings.entrySet()) { ConcurrentMap<Address,Entry> map=entry.getValue(); for(Map.Entry<Address,Entry> entry2: map.entrySet()) { Entry e=entry2.getValue(); if(client_addr.equals(e.client_addr)) { map.remove(entry2.getKey()); log.debug("connection to %s closed", client_addr); if(map.isEmpty()) address_mappings.remove(entry.getKey()); if(suspects == null) suspects=new HashSet<>(); suspects.add(new Tuple<>(entry.getKey(), entry2.getKey())); break; } } } if(emit_suspect_events && suspects != null && !suspects.isEmpty()) { for(Tuple<String,Address> suspect: suspects) { String group=suspect.getVal1(); Address addr=suspect.getVal2(); ConcurrentMap<Address,Entry> map=address_mappings.get(group); if(map == null) continue; GossipData data=new GossipData(GossipType.SUSPECT, group, addr); sendToAllMembersInGroup(map.entrySet(), data); } } }
RpcContext>>> applicationIdMap = RM_CHANNELS.get(resourceId); if (targetApplicationId == null || applicationIdMap.isEmpty()) { if (LOGGER.isInfoEnabled()) { LOGGER.info("No channel is available for resource[" + resourceId + "]"); ConcurrentMap<String, ConcurrentMap<Integer, RpcContext>> ipMap = applicationIdMap.get(targetApplicationId); if (null != ipMap && !ipMap.isEmpty()) { ConcurrentMap<Integer, RpcContext> portMapOnTargetIP = ipMap.get(targetIP); if (portMapOnTargetIP != null && !portMapOnTargetIP.isEmpty()) { RpcContext exactRpcContext = portMapOnTargetIP.get(targetPort); if (portMapOnOtherIP == null || portMapOnOtherIP.isEmpty()) { continue;
int pathLength = lengths[i]; if (pathLength == length) { HostEntry next = contexts.get(path); if (next != null) { return new PathMatcher.PathMatch<>(path, "", next); if (c == '/') { String part = path.substring(0, pathLength); HostEntry next = contexts.get(part); if (next != null) { return new PathMatcher.PathMatch<>(part, path.substring(pathLength), next); if(defaultHandler.contexts.isEmpty()) { return new PathMatcher.PathMatch<>("", path, null);
if (!this.brokerAddrTable.isEmpty()) { long times = this.sendHeartbeatTimesTotal.getAndIncrement(); Iterator<Entry<String, HashMap<Long, String>>> it = this.brokerAddrTable.entrySet().iterator(); this.brokerVersionTable.put(brokerName, new HashMap<String, Integer>(4)); this.brokerVersionTable.get(brokerName).put(addr, version); if (times % 20 == 0) { log.info("send heart beat to broker[{} {} {}] success", brokerName, id, addr);
public void unregisterConsumer(final String group, final ClientChannelInfo clientChannelInfo, boolean isNotifyConsumerIdsChangedEnable) { ConsumerGroupInfo consumerGroupInfo = this.consumerTable.get(group); if (null != consumerGroupInfo) { consumerGroupInfo.unregisterChannel(clientChannelInfo); if (consumerGroupInfo.getChannelInfoTable().isEmpty()) { ConsumerGroupInfo remove = this.consumerTable.remove(group); if (remove != null) { log.info("unregister consumer ok, no any connection, and remove consumer group, {}", group); this.consumerIdsChangeListener.handle(ConsumerGroupEvent.UNREGISTER, group); } } if (isNotifyConsumerIdsChangedEnable) { this.consumerIdsChangeListener.handle(ConsumerGroupEvent.CHANGE, group, consumerGroupInfo.getAllChannel()); } } }
String module = keys[2]; key = application + "|" + module; AccessStatisticResult appResult = totalResults.get(key); if (appResult == null) { totalResults.putIfAbsent(key, new AccessStatisticResult()); appResult = totalResults.get(key); if (!totalResults.isEmpty()) { for (Map.Entry<String, AccessStatisticResult> entry : totalResults.entrySet()) { String application = entry.getKey().split(SEPARATE)[0];
/** * @param threadId Thread ID. * @param ignore Transaction to ignore. * @return Not null topology version if current thread holds lock preventing topology change. */ @Nullable public AffinityTopologyVersion lockedTopologyVersion(long threadId, IgniteInternalTx ignore) { IgniteInternalTx tx = threadMap.get(threadId); if (tx != null) { AffinityTopologyVersion topVer = tx.topologyVersionSnapshot(); if (topVer != null) return topVer; } if (!sysThreadMap.isEmpty()) { for (GridCacheContext cacheCtx : cctx.cache().context().cacheContexts()) { if (!cacheCtx.systemTx()) continue; tx = sysThreadMap.get(new TxThreadKey(threadId, cacheCtx.cacheId())); if (tx != null && tx != ignore) { AffinityTopologyVersion topVer = tx.topologyVersionSnapshot(); if (topVer != null) return topVer; } } } return txTop.get(); }
assertSame(two, map.get(one)); map.putAll(ImmutableMap.of(two, three)); assertSame(three, map.get(two)); assertSame(two, map.putIfAbsent(one, three)); assertSame(two, map.get(one)); assertNull(map.putIfAbsent(three, one)); assertSame(one, map.get(three)); assertTrue(map.isEmpty()); assertEquals(0, map.size());
BinaryMetadataHolder holder = metaLocCache.get(typeId); holder = metaLocCache.get(typeId); lsnr.binaryMetadataUpdated(holder.metadata()); GridFutureAdapter<MetadataUpdateResult> fut = syncMap.get(new SyncKey(typeId, newAcceptedVer)); holder = metaLocCache.get(typeId); log.debug("Completing future " + fut + " for " + holder); if (!schemaWaitFuts.isEmpty()) { Iterator<Map.Entry<SyncKey, GridFutureAdapter<?>>> iter = schemaWaitFuts.entrySet().iterator();