Exemplo n.º 1
0
 @Override
 @SuppressWarnings("unchecked")
 public synchronized Listener onEvent(String event, Consumer listener) {
   Listeners listeners = eventListeners.get(event);
   if (listeners == null) {
     listeners = new Listeners();
     eventListeners.put(event, listeners);
     parent.onEvent(event, message -> handleEvent(event, (InstanceEvent) message));
   }
   return listeners.add(listener);
 }
Exemplo n.º 2
0
 @Override
 public Listener<Session> onClose(Consumer<Session> listener) {
   return closeListeners.add(Assert.notNull(listener, "listener"));
 }
Exemplo n.º 3
0
 @Override
 public Listener<Session> onOpen(Consumer<Session> listener) {
   return openListeners.add(Assert.notNull(listener, "listener"));
 }