Class Call
- java.lang.Object
-
- org.ovirt.vdsm.jsonrpc.client.internal.Call
-
- All Implemented Interfaces:
java.util.concurrent.Future<JsonRpcResponse>
,JsonRpcCall
public class Call extends java.lang.Object implements java.util.concurrent.Future<JsonRpcResponse>, JsonRpcCall
Call
holds single response and usesBatchCall
as internal implementation to promote code reuse.
-
-
Constructor Summary
Constructors Constructor Description Call(JsonRpcRequest req)
Call(JsonRpcRequest req, BrokerCommandCallback callback)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addResponse(JsonRpcResponse response)
boolean
cancel(boolean mayInterruptIfRunning)
JsonRpcResponse
get()
JsonRpcResponse
get(long timeout, java.util.concurrent.TimeUnit unit)
BrokerCommandCallback
getCallback()
The callback to notify after the specific command was invoked.com.fasterxml.jackson.databind.JsonNode
getId()
boolean
isCancelled()
boolean
isDone()
-
-
-
Constructor Detail
-
Call
public Call(JsonRpcRequest req)
-
Call
public Call(JsonRpcRequest req, BrokerCommandCallback callback)
-
-
Method Detail
-
cancel
public boolean cancel(boolean mayInterruptIfRunning)
- Specified by:
cancel
in interfacejava.util.concurrent.Future<JsonRpcResponse>
-
addResponse
public void addResponse(JsonRpcResponse response)
- Specified by:
addResponse
in interfaceJsonRpcCall
- Parameters:
response
- Added to current call object.
-
getId
public com.fasterxml.jackson.databind.JsonNode getId()
-
get
public JsonRpcResponse get() throws java.lang.InterruptedException
- Specified by:
get
in interfacejava.util.concurrent.Future<JsonRpcResponse>
- Throws:
java.lang.InterruptedException
-
get
public JsonRpcResponse get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.TimeoutException
- Specified by:
get
in interfacejava.util.concurrent.Future<JsonRpcResponse>
- Throws:
java.lang.InterruptedException
java.util.concurrent.TimeoutException
-
isCancelled
public boolean isCancelled()
- Specified by:
isCancelled
in interfacejava.util.concurrent.Future<JsonRpcResponse>
-
isDone
public boolean isDone()
- Specified by:
isDone
in interfacejava.util.concurrent.Future<JsonRpcResponse>
-
getCallback
public BrokerCommandCallback getCallback()
Description copied from interface:JsonRpcCall
The callback to notify after the specific command was invoked.- Specified by:
getCallback
in interfaceJsonRpcCall
- Returns:
- The callback that receives the notification.
-
-