public class SharedConnectionServerImpl extends java.lang.Object implements SharedConnectionServer
FACTORY
Modifier | Constructor and Description |
---|---|
protected |
SharedConnectionServerImpl(AltingChannelInput openIn,
AltingChannelInput requestIn,
ChannelInput synchIn,
SharedChannelOutput synchOut,
org.jcsp.lang.ConnectionWithSharedAltingServer parent) |
Modifier and Type | Method and Description |
---|---|
SharedConnectionServer |
duplicate()
Creates a duplicate copy of the connection end.
|
void |
reply(java.lang.Object data)
Sends some data back to the client after a request
has been received but keeps the connection open.
|
void |
reply(java.lang.Object data,
boolean close)
Sends some data back to the client after a request
has been received.
|
void |
replyAndClose(java.lang.Object data)
Sends some data back to the client and closes the connection.
|
java.lang.Object |
request()
Receives a request from a client.
|
protected SharedConnectionServerImpl(AltingChannelInput openIn, AltingChannelInput requestIn, ChannelInput synchIn, SharedChannelOutput synchOut, org.jcsp.lang.ConnectionWithSharedAltingServer parent)
public java.lang.Object request()
ConnectionServer
Receives a request from a client. This will block until the client
calls its request(Object)
method. Implementations may
make this ALTable.
After this method has returned, the server should call one of the reply methods. Performing any external process synchronization between these method calls could be potentially hazardous and could lead to deadlock.
request
in interface ConnectionServer
Object
sent by the client.public void reply(java.lang.Object data)
ConnectionServer
Sends some data back to the client after a request
has been received but keeps the connection open. After calling
this method, the server should call recieve()
to receive a further request.
A call to this method is equivalent to a call to
reply(Object, boolean)
with the boolean set to
false
.
reply
in interface ConnectionServer
data
- the data to send to the client.public void reply(java.lang.Object data, boolean close)
ConnectionServer
Sends some data back to the client after a request
has been received. The boolean
close parameter
indicates whether the connection should be closed after this
reply has been sent.
This method should not block.
reply
in interface ConnectionServer
data
- the data to send back to client.close
- boolean
that should be true
iff the connection should be dropped after the reply
has been sent.public void replyAndClose(java.lang.Object data)
ConnectionServer
Sends some data back to the client and closes the connection.
A call to this method is equivalent to a call to
reply(Object, boolean)
with the boolean set to
true
.
replyAndClose
in interface ConnectionServer
data
- the data to send back to client.public SharedConnectionServer duplicate()
SharedConnectionServer
Creates a duplicate copy of the connection end.
duplicate
in interface SharedConnectionServer
SharedConnectionServer
object.Copyright © 1996–2018. All rights reserved.