public interface TimerService
NonBlockingClient.create(com.ibm.mqlight.api.endpoint.EndpointService, com.ibm.mqlight.api.callback.CallbackService, com.ibm.mqlight.api.network.NetworkService, TimerService, com.google.gson.GsonBuilder, com.ibm.mqlight.api.ClientOptions, com.ibm.mqlight.api.NonBlockingClientListener, Object)
method.void schedule(long delay, Promise<Void> promise)
Promise.setSuccess(Object)
method. Timers are "single shot"
as the promise can only be completed once.
The implementation cannot block the calling thread - and so must employ some scheme that uses another thread to complete the promise.
delay
- a delay in millisecondspromise
- a promise object to be completed after the delay periodvoid cancel(Promise<Void> promise)
schedule(long, Promise)
method. If the cancel operation is
successful then the promise's Promise.setFailure(Exception)
method will be
invoked.
Once a promise has been scheduled, using the schedule(long, Promise)
it will always be completed - even if it is cancelled as a result of this method
being invoked.
If this method is invoked on a promise which has already completed, it should have no effect.
promise
- the promise to cancelCopyright © 2015 International Business Machines Corporation. All rights reserved.