public class DefaultFuture extends Object implements ResponseFuture
| Modifier and Type | Field and Description |
|---|---|
static Timer |
TIME_OUT_TIMER |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel() |
static void |
closeChannel(Channel channel)
close a channel when a channel is inactive
directly return the unfinished requests.
|
Object |
get()
get result.
|
Object |
get(int timeout)
get result with the specified timeout.
|
static DefaultFuture |
getFuture(long id) |
Request |
getRequest() |
static boolean |
hasFuture(Channel channel) |
boolean |
isDone()
check is done.
|
static DefaultFuture |
newFuture(Channel channel,
Request request,
int timeout)
init a DefaultFuture
1.init a DefaultFuture
2.timeout check
|
static void |
received(Channel channel,
Response response) |
static void |
sent(Channel channel,
Request request) |
void |
setCallback(ResponseCallback callback)
set callback.
|
public static final Timer TIME_OUT_TIMER
public static DefaultFuture newFuture(Channel channel, Request request, int timeout)
channel - channelrequest - the requesttimeout - timeoutpublic static DefaultFuture getFuture(long id)
public static boolean hasFuture(Channel channel)
public static void closeChannel(Channel channel)
channel - channel to closepublic Object get() throws RemotingException
ResponseFutureget in interface ResponseFutureRemotingExceptionpublic Object get(int timeout) throws RemotingException
ResponseFutureget in interface ResponseFuturetimeout - timeout.RemotingExceptionpublic void cancel()
public boolean isDone()
ResponseFutureisDone in interface ResponseFuturepublic void setCallback(ResponseCallback callback)
ResponseFuturesetCallback in interface ResponseFuturepublic Request getRequest()
Copyright © 2011–2019 The Apache Software Foundation. All rights reserved.