public class AltingConnectionClientImpl<T> extends AltingConnectionClient<T>
Modifier and Type | Field and Description |
---|---|
private ChannelOutput |
backToClient |
private static int |
CLIENT_STATE_CLOSED |
private static int |
CLIENT_STATE_MADE_REQ |
private static int |
CLIENT_STATE_OPEN |
private int |
currentClientState |
private AltingChannelInput<ConnectionMessage<T>> |
fromServer |
private ConnectionClientMessage |
msg |
private ConnectionClientOpenMessage |
msgOpen |
private ChannelOutput |
openToServer |
private ChannelOutput |
reqToServer |
Modifier | Constructor and Description |
---|---|
protected |
AltingConnectionClientImpl(AltingChannelInput fromServer,
ChannelOutput openToServer,
ChannelOutput reqToServer,
ChannelOutput backToClient)
Constructs a new instance.
|
Modifier and Type | Method and Description |
---|---|
protected void |
claim()
This claims a lock on the client.
|
boolean |
isOpen()
Returns whether the server has kept its end of the Connection open.
|
protected void |
release()
This releases a lock on the client.
|
T |
reply()
Receives some data back from the server after
request(Object) has been called. |
void |
request(T data)
Sends some data over the connection to server once the
connection has been opened.
|
disable, enable, getAltingChannel, pending, setAltingChannel
private int currentClientState
private static final int CLIENT_STATE_CLOSED
private static final int CLIENT_STATE_MADE_REQ
private static final int CLIENT_STATE_OPEN
private AltingChannelInput<ConnectionMessage<T>> fromServer
private ChannelOutput openToServer
private ChannelOutput reqToServer
private ChannelOutput backToClient
private ConnectionClientMessage msg
private ConnectionClientOpenMessage msgOpen
protected AltingConnectionClientImpl(AltingChannelInput fromServer, ChannelOutput openToServer, ChannelOutput reqToServer, ChannelOutput backToClient)
public void request(T data) throws java.lang.IllegalStateException
data
- the Object
to send to the server.java.lang.IllegalStateException
- if the method is called when it is
not meant to be.public T reply() throws java.lang.IllegalStateException
request(Object)
has been called.Object
sent from the server.java.lang.IllegalStateException
- if the method is called when it is
not meant to be.public boolean isOpen() throws java.lang.IllegalStateException
reply()
and
before any other Connection method is called.true
iff the server has kept the connection
open.java.lang.IllegalStateException
protected void claim()
protected void release()