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
-
-
Field Summary
Fields Modifier and Type Field Description private BrokerCommandCallback
callback
private com.fasterxml.jackson.databind.JsonNode
id
private java.util.concurrent.CountDownLatch
latch
private JsonRpcResponse
response
-
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()
-
-
-
Field Detail
-
latch
private final java.util.concurrent.CountDownLatch latch
-
id
private final com.fasterxml.jackson.databind.JsonNode id
-
response
private JsonRpcResponse response
-
callback
private BrokerCommandCallback callback
-
-
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.
-
-