org.jetlang.remote.acceptor

## Class FiberForAllSessions

- java.lang.Object
- - org.jetlang.remote.acceptor.FiberForAllSessions

All Implemented Interfaces:
  ClientPublisher, NewSessionHandler

    public class FiberForAllSessions
    extends Object
    implements NewSessionHandler, ClientPublisher

Maintains all subscription state on a single fiber. Should be used if ordering of messages is critical. To guarantee message delivery ordering, the same fiber should be used for all session callbacks and for sending to sessions.

### Constructor Summary

Constructors
Constructor and Description
`FiberForAllSessions(NewFiberSessionHandler fact, org.jetlang.fibers.Fiber fiber, BufferedSerializer serializer)`

### Method Summary

All Methods Instance Methods Concrete Methods
`Collection<JetlangFiberSession>` `getAllSessions()`
`void` `onNewSession(ClientPublisher unused, JetlangSession jetlangSession)`
`void` `publishToAllSubscribedClients(String topic, Object msg)` Should be invoked from the single fiber that maintains the sessions.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### FiberForAllSessions

    public FiberForAllSessions(NewFiberSessionHandler fact,
                               org.jetlang.fibers.Fiber fiber,
                               BufferedSerializer serializer)

### Method Detail

#### onNewSession

    public void onNewSession(ClientPublisher unused,
                             JetlangSession jetlangSession)

Specified by:
  `onNewSession` in interface `NewSessionHandler`

#### getAllSessions

    public Collection<JetlangFiberSession> getAllSessions()

#### publishToAllSubscribedClients

    public void publishToAllSubscribedClients(String topic,
                                              Object msg)

Should be invoked from the single fiber that maintains the sessions. This method is only safe if invoked from that single fiber. The message is serialized at most once.

Specified by:
  `publishToAllSubscribedClients` in interface `ClientPublisher`