public class NewThreadWorker extends Scheduler.Worker implements Subscription
| Modifier and Type | Field and Description |
|---|---|
static int |
PURGE_FREQUENCY
The purge frequency in milliseconds.
|
| Constructor and Description |
|---|
NewThreadWorker(ThreadFactory
|
| Modifier and Type | Method and Description |
|---|---|
static void |
deregisterExecutor(ScheduledExecutorService
Deregisters the executor service.
|
boolean |
isUnsubscribed()
Indicates whether this
Subscription is currently unsubscribed.
|
static void |
registerExecutor(ScheduledThreadPoolExecutor
Registers the given executor service and starts the purge thread if not already started.
|
Subscription |
schedule(Action0
Schedules an Action for execution.
|
Subscription |
schedule(Action0
Schedules an Action for execution at some point in the future.
|
ScheduledAction |
scheduleActual(Action0
|
ScheduledAction |
scheduleActual(Action0
|
ScheduledAction |
scheduleActual(Action0
|
static boolean |
tryEnableCancelPolicy(ScheduledExecutorService
Tries to enable the Java 7+ setRemoveOnCancelPolicy.
|
void |
unsubscribe()
Stops the receipt of notifications on the
Subscriber that was registered when this Subscription was received.
|
now, schedulePeriodicallypublic static final int PURGE_FREQUENCY
public NewThreadWorker(ThreadFactorythreadFactory)
public static void registerExecutor(ScheduledThreadPoolExecutorservice)
public visibility reason: called from other package(s) within RxJava
service - a scheduled thread pool executor instance
public static void deregisterExecutor(ScheduledExecutorServiceservice)
public visibility reason: called from other package(s) within RxJava
service - a scheduled thread pool executor instance
public static boolean tryEnableCancelPolicy(ScheduledExecutorServiceexecutor)
public visibility reason: called from other package(s) within RxJava. If the method returns false, the registerExecutor(ScheduledThreadPoolExecutor) may be called to enable the backup option of purging the executors.
executor - the executor to call setRemoveOnCaneclPolicy if available.
public Subscriptionschedule(Action0 action)
Scheduler.Worker
schedule in class
Scheduler.Worker
action - Action to schedule
public Subscriptionschedule(Action0 action, long delayTime, TimeUnit unit)
Scheduler.Worker
Note to implementors: non-positive delayTime should be regarded as undelayed schedule, i.e., as if the Scheduler was called.
schedule in class
Scheduler.Worker
action - the Action to schedule
delayTime - time to wait before executing the action; non-positive values indicate an undelayed schedule
unit - the time unit of
delayTime
public ScheduledActionscheduleActual(Action0 action, long delayTime, TimeUnit unit)
action -
delayTime -
unit -
public ScheduledActionscheduleActual(Action0 action, long delayTime, TimeUnit unit, CompositeSubscription parent)
public ScheduledActionscheduleActual(Action0 action, long delayTime, TimeUnit unit, SubscriptionList parent)
public void unsubscribe()
Subscription
Subscriber that was registered when this Subscription was received.
This allows unregistering an Subscriber before it has finished receiving all events (i.e. before onCompleted is called).
public boolean isUnsubscribed()
Subscription
Subscription is currently unsubscribed.
isUnsubscribed in interface
Subscription
true if this
Subscription is currently unsubscribed,
false otherwise