public class Client extends Object implements AutoCloseable
Client
that is used to invoke Operation
s, 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)
|
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
Server
public <T> T invoke(Operation<T> operation)
public void close()
Client
connection. If not connected or already closed,
nothing will happen.close
in interface AutoCloseable
Copyright © 2014. All Rights Reserved.