public class Client extends Object implements AutoCloseable
Client that is used to invoke Operations, those
of which will be handled by a Server.
Note: Only a single-thread should access individual Client instances
at any point in time. Should multiple-threaded access be required,
additional Client instances should be created, one per thread.
Server,
Operation,
OperationHandler| Constructor and Description |
|---|
Client(InetAddress address,
int port)
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the
Client connection. |
<T> T |
invoke(Operation<T> operation)
|
public Client(InetAddress address, int port) throws IOException
address - the InetAddress on which the Server
is accepting requestsport - the port on which the Server is
is accepting requestsIOException - when the Client can't connect to the
Serverpublic <T> T invoke(Operation<T> operation)
public void close()
Client connection. If not connected or already closed,
nothing will happen.close in interface AutoCloseableCopyright © 2019. All rights reserved.