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 TypeMethodDescriptionlong
void
invokeRetainedHandlerAsync
(Consumer<Object> success, Consumer<Throwable> failure, Attributes attributes, String module, String method, Object... args) void
invokeSingleUseHandlerAsync
(Consumer<Object> success, Consumer<Throwable> failure, Attributes attributes, String module, String method, Object... args) void
setResourceService
(ResourceService resourceService) void
setRetainedHandlerService
(RetainedHandlerService retainedHandlerService) void
setScheduler
(Scheduler scheduler) void
setSingleUseHandlerService
(SingleUseHandlerService singleUseHandlerService) void
setTimeout
(long timeout) void
start()
Starts thisHandlerContext
.void
stop()
Stops thisHandlerContext
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:HandlerContext
Starts thisHandlerContext
.- Specified by:
start
in interfaceHandlerContext
-
stop
public void stop()Description copied from interface:HandlerContext
Stops thisHandlerContext
.- Specified by:
stop
in interfaceHandlerContext
-
invokeSingleUseHandlerAsync
public void invokeSingleUseHandlerAsync(Consumer<Object> success, Consumer<Throwable> failure, Attributes attributes, String module, String method, Object... args) Description copied from interface:HandlerContext
Creates aResource
, invokes a method on thatResource
, and returns the result as either a success or a failure. TheHandlerContext
will assign a temporaryPath
, andResourceId
which will not be exposed to the client code. Further, this will guaranteed the destruction of the createdResource
even if the client abandons the call this method. The underlyingHandlerContext
may time out theResource
. In which case the caller will receive an instance foHandlerTimeoutException
through the returnedFuture
or in theConsumer<Throwable>
handed to the method.- Specified by:
invokeSingleUseHandlerAsync
in interfaceHandlerContext
- Parameters:
success
- invoked when the invocation successfully returnsfailure
- invoked whent he invocation encounters an errorattributes
- theAttributes
supplied to the underlyingResource
module
- 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:HandlerContext
Creates aResource
, invokes a method on thatResource
, and returns the result as either a success or a failure. TheHandlerContext
will assign a temporaryPath
, andResourceId
which will not be exposed to the client code. UnlikeHandlerContext.invokeSingleUseHandlerAsync(Consumer, Consumer, Attributes, String, String, Object...)
this will just unlink theResource
after it invokes the specified method. It will be responsiblity of the invoked method to provide further retentions should it be desired. The underlyingHandlerContext
may time out theResource
. In which case the caller will receive an instance foHandlerTimeoutException
through the returnedFuture
or in theConsumer<Throwable>
handed to the method.- Specified by:
invokeRetainedHandlerAsync
in interfaceHandlerContext
- Parameters:
success
- invoked when the invocation successfully returnsfailure
- invoked whent he invocation encounters an errorattributes
- theAttributes
supplied to the underlyingResource
module
- 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)
-