hu.akarnokd.rxjava2.schedulers

## Class SharedScheduler

- java.lang.Object
- - io.reactivex.Scheduler
  - - hu.akarnokd.rxjava2.schedulers.SharedScheduler

    public final class SharedScheduler
    extends io.reactivex.Scheduler

A Scheduler implementation that uses one of the Workers from another Scheduler and shares the access to it through its own Workers.

Disposing a worker doesn't dispose the underlying shared worker so other workers of this class can continue their work; use `shutdown()` to release the underlying shared worker.

This scheduler doesn't support `Scheduler.start()` (it's a no-op) and once `shutdown()` it can't be revived.

Since:
  0.6.2

### Nested Class Summary

### Nested classes/interfaces inherited from class io.reactivex.Scheduler

`io.reactivex.Scheduler.Worker`

### Constructor Summary

Constructors
Constructor and Description
`SharedScheduler(io.reactivex.Scheduler.Worker worker)` Constructs a SharedScheduler and uses the Worker instance provided.
`SharedScheduler(io.reactivex.Scheduler other)` Constructs a SharedScheduler and asks for a Worker from the provided other Scheduler.

### Method Summary

All Methods Instance Methods Concrete Methods
`io.reactivex.Scheduler.Worker` `createWorker()`
`long` `now(java.util.concurrent.TimeUnit unit)`
`io.reactivex.disposables.Disposable` `scheduleDirect(java.lang.Runnable run)`
`io.reactivex.disposables.Disposable` `scheduleDirect(java.lang.Runnable run, long delay, java.util.concurrent.TimeUnit unit)`
`io.reactivex.disposables.Disposable` `schedulePeriodicallyDirect(java.lang.Runnable run, long initialDelay, long period, java.util.concurrent.TimeUnit unit)`
`void` `shutdown()`

### Methods inherited from class io.reactivex.Scheduler

`clockDriftTolerance, start, when`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### SharedScheduler

    public SharedScheduler(io.reactivex.Scheduler other)

Constructs a SharedScheduler and asks for a Worker from the provided other Scheduler.

Parameters:
  `other` - the other Scheduler instance, not null

#### SharedScheduler

    public SharedScheduler(io.reactivex.Scheduler.Worker worker)

Constructs a SharedScheduler and uses the Worker instance provided.

Parameters:
  `worker` - the worker to use, not null

### Method Detail

#### shutdown

    public void shutdown()

Overrides:
  `shutdown` in class `io.reactivex.Scheduler`

#### scheduleDirect

    public io.reactivex.disposables.Disposable scheduleDirect(java.lang.Runnable run)

Overrides:
  `scheduleDirect` in class `io.reactivex.Scheduler`

#### scheduleDirect

    public io.reactivex.disposables.Disposable scheduleDirect(java.lang.Runnable run,
                                                              long delay,
                                                              java.util.concurrent.TimeUnit unit)

Overrides:
  `scheduleDirect` in class `io.reactivex.Scheduler`

#### schedulePeriodicallyDirect

    public io.reactivex.disposables.Disposable schedulePeriodicallyDirect(java.lang.Runnable run,
                                                                          long initialDelay,
                                                                          long period,
                                                                          java.util.concurrent.TimeUnit unit)

Overrides:
  `schedulePeriodicallyDirect` in class `io.reactivex.Scheduler`

#### now

    public long now(java.util.concurrent.TimeUnit unit)

Overrides:
  `now` in class `io.reactivex.Scheduler`

#### createWorker

    public io.reactivex.Scheduler.Worker createWorker()

Specified by:
  `createWorker` in class `io.reactivex.Scheduler`