public final class ScheduledFutureProxy<V> extends Object implements IScheduledFuture<V>, HazelcastInstanceAware
Modifier and Type | Method and Description |
---|---|
boolean |
cancel(boolean mayInterruptIfRunning)
Attempts to cancel further scheduling of this task.
|
int |
compareTo(Delayed o) |
void |
dispose()
Used to destroy the instance of the
IScheduledFuture in the scheduled executor. |
V |
get() |
V |
get(long timeout,
TimeUnit unit) |
long |
getDelay(TimeUnit unit) |
ScheduledTaskHandler |
getHandler()
Returns the scheduled future resource handler.
|
ScheduledTaskStatistics |
getStats()
Returns the statistics and time measurement info of the execution of this scheduled future in the
IScheduledExecutorService it was scheduled. |
boolean |
isCancelled() |
boolean |
isDone() |
void |
setHazelcastInstance(HazelcastInstance hazelcastInstance)
Gets the HazelcastInstance reference when submitting a Runnable/Callable using Hazelcast ExecutorService.
|
public void setHazelcastInstance(HazelcastInstance hazelcastInstance)
HazelcastInstanceAware
setHazelcastInstance
in interface HazelcastInstanceAware
hazelcastInstance
- the HazelcastInstance referencepublic ScheduledTaskHandler getHandler()
IScheduledFuture
IScheduledFuture
using the
IScheduledExecutorService.getScheduledFuture(ScheduledTaskHandler)
getHandler
in interface IScheduledFuture<V>
ScheduledTaskHandler
, a resource handler for this scheduled future.public ScheduledTaskStatistics getStats()
IScheduledFuture
IScheduledExecutorService
it was scheduled.getStats
in interface IScheduledFuture<V>
ScheduledTaskStatistics
, holding all stas and measurementspublic int compareTo(Delayed o)
compareTo
in interface Comparable<Delayed>
public boolean cancel(boolean mayInterruptIfRunning)
IScheduledFuture
cancel
is called, this task should never run.
Warning: This cancel will not attempt to interrupt the running thread if the task is already in progress, will just cancel further scheduling.
After this method returns, subsequent calls to Future.isDone()
will always return true
. Subsequent calls to
Future.isCancelled()
will always return true
if this method returned true
.
cancel
in interface IScheduledFuture<V>
cancel
in interface Future<V>
mayInterruptIfRunning
- is throwing UnsupportedOperationException
false
if the task could not be cancelled, typically because it has already completed normally; {@code truepublic boolean isCancelled()
isCancelled
in interface Future<V>
public V get() throws InterruptedException, ExecutionException
get
in interface Future<V>
InterruptedException
ExecutionException
public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get
in interface Future<V>
InterruptedException
ExecutionException
TimeoutException
public void dispose()
IScheduledFuture
IScheduledFuture
in the scheduled executor. Once the instance is destroyed, any
subsequent action on the IScheduledFuture
will fail with an IllegalStateException
Attempting to re-create
the IScheduledFuture
from the IScheduledExecutorService.getScheduledFuture(ScheduledTaskHandler)
using the
IScheduledFuture.getHandler()
will succeed, but any subsequent access on that new future, will also fail with StaleTaskException
dispose
in interface IScheduledFuture<V>
Copyright © 2020 Hazelcast, Inc.. All Rights Reserved.