public class InMemoryTransportFactory extends java.lang.Object implements TransportFactory
TransportFactory
.
Publishers and subscribers must be in the same JVM. Therefore this factory usage should be limited to tests.
Modifier | Constructor and Description |
---|---|
protected |
InMemoryTransportFactory()
Prevent direct instantiation from outside of the inheritance tree.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
Publisher |
createPublisher(io.spine.server.transport.ChannelId id)
Creates a
Publisher channel with the given ID. |
Subscriber |
createSubscriber(io.spine.server.transport.ChannelId id)
Creates a
Subscriber channel with the given ID. |
boolean |
isOpen()
Tells if the object is still open.
|
static InMemoryTransportFactory |
newInstance()
Creates a new instance of
InMemoryTransportFactory . |
protected Subscriber |
newSubscriber(io.spine.server.transport.ChannelId id)
Creates a new instance of subscriber.
|
protected InMemoryTransportFactory()
public static InMemoryTransportFactory newInstance()
InMemoryTransportFactory
.public final Publisher createPublisher(io.spine.server.transport.ChannelId id)
TransportFactory
Publisher
channel with the given ID.createPublisher
in interface TransportFactory
id
- the identifier of the resulting channelPublisher
instancepublic final Subscriber createSubscriber(io.spine.server.transport.ChannelId id)
TransportFactory
Subscriber
channel with the given ID.createSubscriber
in interface TransportFactory
id
- the identifier of the resulting channelSubscriber
instanceprotected Subscriber newSubscriber(io.spine.server.transport.ChannelId id)
The descendants may override this method to customize the implementation of subscribers
to use within this TransportFactory
instance.
id
- the identifier of the resulting subscriberpublic boolean isOpen()
Closeable
Implementations must return false
after AutoCloseable.close()
is invoked.
public void close()
close
in interface java.lang.AutoCloseable