public class RemoteOperationExecutor extends Object implements OperationExecutor
OperationServer
to execute Operation
s remotely.Constructor and Description |
---|
RemoteOperationExecutor(String host,
int port)
Create a new client that will connect to the server
running at the specified host and port.
|
Modifier and Type | Method and Description |
---|---|
<T> T |
execute(Operation<T> operation)
Execute an operation remotely.
|
<T> BackgroundOperation<T> |
executeBackground(Operation<T> operation)
Execute an operation remotely.
|
String |
getHost()
Returns the host name.
|
int |
getPort()
Returns the host port.
|
int |
getWeight()
Returns the relative weight of this executor.
|
public RemoteOperationExecutor(String host, int port)
host
- Hostname of the remote server.port
- Port of the remote server.public <T> T execute(Operation<T> operation)
execute
in interface OperationExecutor
T
- Return value type of the operation.operation
- The operation to execute remotely.RuntimeException
- In case of network error or if the return value class is unknown.public <T> BackgroundOperation<T> executeBackground(Operation<T> operation)
executeBackground
in interface OperationExecutor
T
- Return value type of the operation.operation
- The operation to execute remotely.BackgroundOperation
for retrieving the result of the operation later.public int getWeight()
OperationExecutor
getWeight
in interface OperationExecutor
public String getHost()
public int getPort()
Copyright © 2017. All rights reserved.