public final class NetAltingConnectionClient extends AltingConnectionClient implements NetConnectionClient
Modifier and Type | Field and Description |
---|---|
private ConnectionData |
data |
private AltingChannelInput |
in |
private NetworkMessageFilter.FilterRx |
inputFilter |
private boolean |
isLocal |
private Link |
linkConnectedTo |
private ConnectionData |
localConnection |
private NetConnectionLocation |
localLocation |
private NetworkMessageFilter.FilterTx |
outputFilter |
private NetConnectionLocation |
serverLocation |
private ChannelOutput |
toLinkTX |
Modifier | Constructor and Description |
---|---|
private |
NetAltingConnectionClient(AltingChannelInput input,
ChannelOutput toLink,
Link link,
ConnectionData connData,
NetConnectionLocation loc,
NetworkMessageFilter.FilterTx filterTX,
NetworkMessageFilter.FilterRx filterRX) |
Modifier and Type | Method and Description |
---|---|
(package private) static NetAltingConnectionClient |
create(NetConnectionLocation loc,
NetworkMessageFilter.FilterTx filterTX,
NetworkMessageFilter.FilterRx filterRX) |
void |
destroy()
Destroys the Networked construct
|
(package private) ConnectionData |
getConnectionData() |
(package private) NetConnectionLocation |
getLocalLocation() |
NetLocation |
getLocation()
Gets the networked location of the Networked construct
|
boolean |
isOpen()
Returns whether the server has kept its end of the Connection open.
|
java.lang.Object |
reply()
Receives some data back from the server after
request(Object) has been called. |
void |
request(java.lang.Object obj)
This method is used to send data to a
ConnectionServer in
a client/server conversation. |
getAltingChannel, pending, setAltingChannel
private final AltingChannelInput in
private final ChannelOutput toLinkTX
private final Link linkConnectedTo
private final NetConnectionLocation serverLocation
private final NetConnectionLocation localLocation
private final ConnectionData localConnection
private final boolean isLocal
private final NetworkMessageFilter.FilterTx outputFilter
private final NetworkMessageFilter.FilterRx inputFilter
private final ConnectionData data
private NetAltingConnectionClient(AltingChannelInput input, ChannelOutput toLink, Link link, ConnectionData connData, NetConnectionLocation loc, NetworkMessageFilter.FilterTx filterTX, NetworkMessageFilter.FilterRx filterRX)
static NetAltingConnectionClient create(NetConnectionLocation loc, NetworkMessageFilter.FilterTx filterTX, NetworkMessageFilter.FilterRx filterRX) throws JCSPNetworkException
JCSPNetworkException
public boolean isOpen() throws java.lang.IllegalStateException, JCSPNetworkException
ConnectionClient
Returns whether the server has kept its end of the Connection open.
This should only be called after a call to reply()
and
before any other Connection method is called.
isOpen
in interface ConnectionClient
true
iff the server has kept the connection
open.java.lang.IllegalStateException
JCSPNetworkException
public java.lang.Object reply() throws java.lang.IllegalStateException, JCSPNetworkException
ConnectionClient
Receives some data back from the server after
request(Object)
has been called.
After calling this method, isOpen()
may be called
to establish whether the server dropped the connection after replying.
Implementations may make this operation ALTable.
reply
in interface ConnectionClient
Object
sent from the server.java.lang.IllegalStateException
- if the method is called when it is
not meant to be.JCSPNetworkException
public void request(java.lang.Object obj) throws java.lang.IllegalStateException, JCSPNetworkException
ConnectionClient
This method is used to send data to a ConnectionServer
in
a client/server conversation. If a connection has not yet been established,
then this method will open the connection as necessary.
Once this method has returned, the client may do some computation but
must then guarantee to call reply()
. This will obtain a
server's response to the request. In between calling this method and
reply()
, doing pure computation is safe. Performing
synchronization with other process is potentially hazardous.
Once a server replies, if the connection has been kept open, then this method should be called again to make a further request.
Programs using Connection
s need to adopt a protocol so that the server
knows when a conversation with a client has finished and will then drop
the connection.
request
in interface ConnectionClient
obj
- the Object
to send to the server.java.lang.IllegalStateException
- if the method is called when it is
not meant to be.JCSPNetworkException
public void destroy()
Networked
public NetLocation getLocation()
Networked
getLocation
in interface Networked
NetConnectionLocation getLocalLocation()
final ConnectionData getConnectionData()