/** * Returns the protocol whose name matches the given argument. This method will return null if no such protocol has * been registered. * * @param name The name of the protocol to return. * @return The protocol registered, or null. */ public Protocol getProtocol(String name) { return protocols.get(name); }
public String get(Integer index) { return targets.get(index); } public void put(Integer index, String target) {
private static URI resolveUri(String path) { URI uri = uriCache.get(path); if (uri == null) { uri = URI.create("mbus://remotehost" + path); uriCache.put(path, uri); } return uri; } }
public final Method get(Object object) { Method m = cache.get(object.getClass().getName()); if (m == null) { m = lookupMethod(object); if (m != null) { cache.put(object.getClass().getName(), m); } } return m; } private Method lookupMethod(Object object) {
/** * Returns the routable factory for a given version and routable type. * * @param version The version that the factory must support. * @param type The routable type that the factory must support. * @return The routable factory matching the criteria, or null. */ RoutableFactory getFactory(Version version, int type) { CacheKey cacheKey = new CacheKey(version, type); RoutableFactory factory = cache.get(cacheKey); if (factory != null) { return factory; } VersionMap versionMap = factoryTypes.get(type); if (versionMap == null) { return null; } factory = versionMap.getFactory(version); if (factory == null) { return null; } cache.put(cacheKey, factory); return factory; }
public RouteMetricSet getRouteMetrics(Route r) { String route = r.toString(); RouteMetricSet metric = routeMetrics.get(route); if (metric == null) { synchronized (routeMetrics) { metric = routeMetrics.get(route); if (metric == null) { metric = new RouteMetricSet(route); addMetric(metric); routeMetrics.put(route, metric); } } } return metric; }
RoutingPolicy ret = routingPolicyCache.get(cacheKey); if (ret != null) { return ret;
if (valClass != null) { Pair<Class<?>, Class<?>> key = new Pair<>(valClass, arg.getClass()); Constructor<?> cstr = constructorCache.get(key); if (cstr == null) { if (!constructorCache.containsKey(key)) {
@Override public void deliverMessage(Message msg, String session) { MessageHandler msgHandler = sessions.get(session); if (msgHandler == null) { deliverError(msg, ErrorCode.UNKNOWN_SESSION, "Session '" + session + "' does not exist."); } else if (!checkPending(msg)) { deliverError(msg, ErrorCode.SESSION_BUSY, "Session '" + net.getConnectionSpec() + "/" + session + "' is busy, try again later."); } else { msn.deliverMessage(msg, msgHandler); } }
/** * Registers a routable factory for a given version and routable type. * * @param version The version specification that the given factory supports. * @param type The routable type that the given factory supports. * @param factory The routable factory to register. */ void putFactory(VersionSpecification version, int type, RoutableFactory factory) { VersionMap versionMap = factoryTypes.get(type); if (versionMap == null) { versionMap = new VersionMap(); factoryTypes.put(type, versionMap); } if (versionMap.putFactory(version, factory)) { cache.clear(); } }
private void writeOpenFieldElement(XMLWriter writer, String relevancyFieldName) { Utf8String utf8 = fieldNameMap.get(relevancyFieldName); if (utf8 == null) { utf8 = new Utf8String(relevancyFieldName); fieldNameMap.put(relevancyFieldName, utf8); } writer.openTag(FIELD).attribute(NAME, utf8); writer.closeStartTag(); }
private void writeOpenFieldElement(XMLWriter writer, String relevancyFieldName) { Utf8String utf8 = fieldNameMap.get(relevancyFieldName); if (utf8 == null) { utf8 = new Utf8String(relevancyFieldName); fieldNameMap.put(relevancyFieldName, utf8); } writer.openTag(FIELD).attribute(NAME, utf8); writer.closeStartTag(); }
private Object getProperty(Query query, CompoundKey key) { CompoundName name = map.get(key); if (name == null) { name = new CompoundName(key.toString()); map.put(key, name); } return query.properties().get(name); }