org.springframework.integration.message
Class AsyncMessage<T>
java.lang.Object
org.springframework.integration.message.AsyncMessage<T>
- All Implemented Interfaces:
- java.util.concurrent.Future<Message<T>>, Message<T>
public class AsyncMessage<T>
- extends java.lang.Object
- implements java.util.concurrent.Future<Message<T>>, Message<T>
A Message wrapper for asynchronous operations. Implements both
Message and Future so that simple blocking invocations on the
Message (e.g. getPayload()
) are still allowed, while
timeout-aware methods such as get(long, TimeUnit)
are also supported.
- Author:
- Mark Fisher
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
future
private final java.util.concurrent.Future<Message<T>> future
AsyncMessage
public AsyncMessage(java.util.concurrent.Future<Message<T>> future)
cancel
public boolean cancel(boolean mayInterruptIfRunning)
- Specified by:
cancel
in interface java.util.concurrent.Future<Message<T>>
get
public Message<T> get()
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException
- Specified by:
get
in interface java.util.concurrent.Future<Message<T>>
- Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
get
public Message<T> get(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException,
java.util.concurrent.TimeoutException
- Specified by:
get
in interface java.util.concurrent.Future<Message<T>>
- Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
isCancelled
public boolean isCancelled()
- Specified by:
isCancelled
in interface java.util.concurrent.Future<Message<T>>
isDone
public boolean isDone()
- Specified by:
isDone
in interface java.util.concurrent.Future<Message<T>>
getPayload
public T getPayload()
- Specified by:
getPayload
in interface Message<T>
getHeaders
public MessageHeaders getHeaders()
- Specified by:
getHeaders
in interface Message<T>