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
Callholds single response
-
-
Field Summary
Fields Modifier and Type Field Description private BrokerCommandCallbackcallbackprivate com.fasterxml.jackson.databind.JsonNodeidprivate java.util.concurrent.CountDownLatchlatchprivate JsonRpcResponseresponse
-
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 voidaddResponse(JsonRpcResponse response)booleancancel(boolean mayInterruptIfRunning)JsonRpcResponseget()JsonRpcResponseget(long timeout, java.util.concurrent.TimeUnit unit)BrokerCommandCallbackgetCallback()The callback to notify after the specific command was invoked.com.fasterxml.jackson.databind.JsonNodegetId()booleanisCancelled()booleanisDone()
-
-
-
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:
cancelin interfacejava.util.concurrent.Future<JsonRpcResponse>
-
addResponse
public void addResponse(JsonRpcResponse response)
- Specified by:
addResponsein 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:
getin 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:
getin interfacejava.util.concurrent.Future<JsonRpcResponse>- Throws:
java.lang.InterruptedExceptionjava.util.concurrent.TimeoutException
-
isCancelled
public boolean isCancelled()
- Specified by:
isCancelledin interfacejava.util.concurrent.Future<JsonRpcResponse>
-
isDone
public boolean isDone()
- Specified by:
isDonein interfacejava.util.concurrent.Future<JsonRpcResponse>
-
getCallback
public BrokerCommandCallback getCallback()
Description copied from interface:JsonRpcCallThe callback to notify after the specific command was invoked.- Specified by:
getCallbackin interfaceJsonRpcCall- Returns:
- The callback that receives the notification.
-
-