public void put(Integer index, String target) { targets.put(index, 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) {
/** * Registers a protocol with this repository. This will overwrite any protocol that was registered earlier that has * the same name. If this method detects a protocol replacement, it will clear its internal routing policy cache. * * @param protocol The protocol to register. */ public void putProtocol(Protocol protocol) { if (protocols.put(protocol.getName(), protocol) != null) { routingPolicyCache.clear(); } }
return null; routingPolicyCache.put(cacheKey, ret);
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(); }
/** * 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 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); }
/** * <p>Creates an intermediate session on top of this message bus using the * given handlers and parameter object.</p> * * @param params The parameters to control the session. * @return The created session. */ public synchronized IntermediateSession createIntermediateSession(IntermediateSessionParams params) { if (destroyed.get()) { throw new IllegalStateException("Object is destroyed."); } if (sessions.containsKey(params.getName())) { throw new IllegalArgumentException("Name '" + params.getName() + "' is not unique."); } IntermediateSession session = new IntermediateSession(this, params); sessions.put(params.getName(), session); if (params.getBroadcastName()) { net.registerSession(params.getName()); } return session; }
/** * <p>Creates a destination session on top of this message bus using the * given handlers and parameter object.</p> * * @param params The parameters to control the session. * @return The created session. */ public synchronized DestinationSession createDestinationSession(DestinationSessionParams params) { if (destroyed.get()) { throw new IllegalStateException("Object is destroyed."); } if (sessions.containsKey(params.getName())) { throw new IllegalArgumentException("Name '" + params.getName() + "' is not unique."); } DestinationSession session = new DestinationSession(this, params); sessions.put(params.getName(), session); if (params.getBroadcastName()) { net.registerSession(params.getName()); } return session; }
/** * 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; }