Пример #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();
 }