Package dev.getelements.elements.rt
Class SimpleHandlerContext
java.lang.Object
dev.getelements.elements.rt.SimpleHandlerContext
- All Implemented Interfaces:
HandlerContext
-
Field Summary
Fields inherited from interface dev.getelements.elements.rt.HandlerContext
HANDLER_TIMEOUT_MSEC -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongvoidinvokeRetainedHandlerAsync(Consumer<Object> success, Consumer<Throwable> failure, Attributes attributes, String module, String method, Object... args) voidinvokeSingleUseHandlerAsync(Consumer<Object> success, Consumer<Throwable> failure, Attributes attributes, String module, String method, Object... args) voidsetResourceService(ResourceService resourceService) voidsetRetainedHandlerService(RetainedHandlerService retainedHandlerService) voidsetScheduler(Scheduler scheduler) voidsetSingleUseHandlerService(SingleUseHandlerService singleUseHandlerService) voidsetTimeout(long timeout) voidstart()Starts thisHandlerContext.voidstop()Stops thisHandlerContext.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.getelements.elements.rt.HandlerContext
invokeRetainedHandler, invokeSingleUseHandler
-
Constructor Details
-
SimpleHandlerContext
public SimpleHandlerContext()
-
-
Method Details
-
start
public void start()Description copied from interface:HandlerContextStarts thisHandlerContext.- Specified by:
startin interfaceHandlerContext
-
stop
public void stop()Description copied from interface:HandlerContextStops thisHandlerContext.- Specified by:
stopin interfaceHandlerContext
-
invokeSingleUseHandlerAsync
public void invokeSingleUseHandlerAsync(Consumer<Object> success, Consumer<Throwable> failure, Attributes attributes, String module, String method, Object... args) Description copied from interface:HandlerContextCreates aResource, invokes a method on thatResource, and returns the result as either a success or a failure. TheHandlerContextwill assign a temporaryPath, andResourceIdwhich will not be exposed to the client code. Further, this will guaranteed the destruction of the createdResourceeven if the client abandons the call this method. The underlyingHandlerContextmay time out theResource. In which case the caller will receive an instance foHandlerTimeoutExceptionthrough the returnedFutureor in theConsumer<Throwable>handed to the method.- Specified by:
invokeSingleUseHandlerAsyncin interfaceHandlerContext- Parameters:
success- invoked when the invocation successfully returnsfailure- invoked whent he invocation encounters an errorattributes- theAttributessupplied to the underlyingResourcemodule- the module name used to instantiate the resourcemethod- the method to invokeargs- the arguments passed to the method
-
invokeRetainedHandlerAsync
public void invokeRetainedHandlerAsync(Consumer<Object> success, Consumer<Throwable> failure, Attributes attributes, String module, String method, Object... args) Description copied from interface:HandlerContextCreates aResource, invokes a method on thatResource, and returns the result as either a success or a failure. TheHandlerContextwill assign a temporaryPath, andResourceIdwhich will not be exposed to the client code. UnlikeHandlerContext.invokeSingleUseHandlerAsync(Consumer, Consumer, Attributes, String, String, Object...)this will just unlink theResourceafter it invokes the specified method. It will be responsiblity of the invoked method to provide further retentions should it be desired. The underlyingHandlerContextmay time out theResource. In which case the caller will receive an instance foHandlerTimeoutExceptionthrough the returnedFutureor in theConsumer<Throwable>handed to the method.- Specified by:
invokeRetainedHandlerAsyncin interfaceHandlerContext- Parameters:
success- invoked when the invocation successfully returnsfailure- invoked whent he invocation encounters an errorattributes- theAttributessupplied to the underlyingResourcemodule- the module name used to instantiate the resourcemethod- the method to invokeargs- the arguments passed to the method
-
getScheduler
-
setScheduler
-
getResourceService
-
setResourceService
-
getRetainedHandlerService
-
setRetainedHandlerService
-
getSingleUseHandlerService
-
setSingleUseHandlerService
-
getTimeout
public long getTimeout() -
setTimeout
@Inject public void setTimeout(@Named("dev.getelements.elements.rt.handler.timeout.msec") long timeout)
-