/** * Returns whether or not this repository contains a protocol with the given name. Given the concurrent nature of * things, one should not invoke this method followed by {@link #getProtocol(String)} and expect the return value to * be non-null. Instead just get the protocol and compare it to null. * * @param name The name to check for. * @return True if the named protocol is registered. */ public boolean hasProtocol(String name) { return protocols.containsKey(name); }
Constructor<?> cstr = constructorCache.get(key); if (cstr == null) { if (!constructorCache.containsKey(key)) { try { cstr = valClass.getConstructor(key.getSecond());
/** * <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; }