예제 #1
0
 @Override
 public void unregister(Session session) {
   for (ResourceHolder resource : resources.values()) {
     SessionHolder sessionHolder = resource.sessions.get(session.id());
     if (sessionHolder != null) {
       resource.stateMachine.unregister(sessionHolder.session);
     }
   }
 }
예제 #2
0
 @Override
 public void close(Session session) {
   for (ResourceHolder resource : resources.values()) {
     SessionHolder sessionHolder = resource.sessions.remove(session.id());
     if (sessionHolder != null) {
       resource.stateMachine.close(sessionHolder.session);
       sessionHolder.commit.close();
     }
   }
 }
예제 #3
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);
 }
예제 #4
0
 @Override
 public Session publish(String event, Object message) {
   return parent.publish(event, new InstanceEvent<>(resource, message));
 }
예제 #5
0
 @Override
 public Session publish(String event) {
   return parent.publish(event, new InstanceEvent<>(resource, null));
 }
예제 #6
0
 @Override
 public Listener<State> onStateChange(Consumer<State> callback) {
   return parent.onStateChange(callback);
 }
예제 #7
0
 @Override
 public State state() {
   return parent.state();
 }