Package org.apache.ignite.internal
Class AsyncSupportAdapter<T extends IgniteAsyncSupport>
- java.lang.Object
-
- org.apache.ignite.internal.AsyncSupportAdapter<T>
-
- All Implemented Interfaces:
IgniteAsyncSupport
- Direct Known Subclasses:
GatewayProtectedCacheProxy,IgniteCacheProxyImpl,IgniteClusterAsyncImpl,IgniteComputeImpl,IgniteEventsImpl,IgniteMessagingImpl,IgniteServicesImpl
public class AsyncSupportAdapter<T extends IgniteAsyncSupport> extends Object implements IgniteAsyncSupport
Adapter forIgniteAsyncSupport.
-
-
Field Summary
Fields Modifier and Type Field Description protected ThreadLocal<IgniteFuture<?>>curFutFuture for previous asynchronous operation.
-
Constructor Summary
Constructors Constructor Description AsyncSupportAdapter()Default constructor.AsyncSupportAdapter(boolean async)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TcreateAsyncInstance()Creates component with asynchronous mode enabled.protected <R> IgniteFuture<R>createFuture(IgniteInternalFuture<R> fut)<R> IgniteFuture<R>future()Gets and resets future for previous asynchronous operation.<R> IgniteFuture<R>future(boolean reset)Gets and optionally resets future for previous asynchronous operation.booleanisAsync()<R> RsaveOrGet(IgniteInternalFuture<R> fut)TwithAsync()Gets instance of this component with asynchronous mode enabled.
-
-
-
Field Detail
-
curFut
protected ThreadLocal<IgniteFuture<?>> curFut
Future for previous asynchronous operation.
-
-
Method Detail
-
withAsync
public T withAsync()
Gets instance of this component with asynchronous mode enabled.- Specified by:
withAsyncin interfaceIgniteAsyncSupport- Returns:
- Instance of this component with asynchronous mode enabled.
-
createAsyncInstance
protected T createAsyncInstance()
Creates component with asynchronous mode enabled.- Returns:
- Component with asynchronous mode enabled.
-
isAsync
public boolean isAsync()
- Specified by:
isAsyncin interfaceIgniteAsyncSupport- Returns:
Trueif asynchronous mode is enabled.
-
future
public <R> IgniteFuture<R> future()
Gets and resets future for previous asynchronous operation.- Specified by:
futurein interfaceIgniteAsyncSupport- Type Parameters:
R- Type of the future result.- Returns:
- Future for previous asynchronous operation.
-
future
public <R> IgniteFuture<R> future(boolean reset)
Gets and optionally resets future for previous asynchronous operation.- Parameters:
reset- Specifies whether to reset future.- Returns:
- Future for previous asynchronous operation.
-
saveOrGet
public <R> R saveOrGet(IgniteInternalFuture<R> fut) throws IgniteCheckedException
- Parameters:
fut- Future.- Returns:
- If async mode is enabled saves future and returns
null, otherwise waits for future and returns result. - Throws:
IgniteCheckedException- If asynchronous mode is disabled and future failed.
-
createFuture
protected <R> IgniteFuture<R> createFuture(IgniteInternalFuture<R> fut)
- Parameters:
fut- Internal future.- Returns:
- Public API future.
-
-