org.apache.ignite.internal.worker

## Class WorkersRegistry

- java.lang.Object
- - org.apache.ignite.internal.worker.WorkersRegistry

All Implemented Interfaces:
  EventListener, GridWorkerListener

    public class WorkersRegistry
    extends Object
    implements GridWorkerListener

Workers registry. Maintains a set of workers currently running. Can perform periodic liveness checks for these workers on behalf of any of them.

### Constructor Summary

Constructors
Constructor and Description
`WorkersRegistry(IgniteBiInClosure<GridWorker,FailureType> workerFailedHnd, long sysWorkerBlockedTimeout, IgniteLogger log)`

### Method Summary

All Methods Instance Methods Concrete Methods
`long` `getSystemWorkerBlockedTimeout()` Returns maximum inactivity period for system worker.
`boolean` `livenessCheckEnabled()`
`void` `livenessCheckEnabled(boolean val)`
`Collection<String>` `names()` Returns names of all registered workers.
`void` `onIdle(GridWorker w)`
`void` `onStarted(GridWorker w)`
`void` `onStopped(GridWorker w)`
`void` `register(GridWorker w)` Adds worker to the registry.
`void` `setSystemWorkerBlockedTimeout(long val)` Sets maximum inactivity period for system worker.
`void` `unregister(String name)` Removes worker from the registry.
`GridWorker` `worker(String name)` Returns worker with given name.

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

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

### Constructor Detail

#### WorkersRegistry

    public WorkersRegistry(@NotNull
                           IgniteBiInClosure<GridWorker,FailureType> workerFailedHnd,
                           long sysWorkerBlockedTimeout,
                           IgniteLogger log)

Parameters:
  `workerFailedHnd` - Closure to invoke on worker failure.
  `sysWorkerBlockedTimeout` - Maximum allowed worker heartbeat interval in milliseconds, non-positive value denotes infinite interval.

### Method Detail

#### register

    public void register(GridWorker w)

Adds worker to the registry.

Parameters:
  `w` - Worker.

#### unregister

    public void unregister(String name)

Removes worker from the registry.

Parameters:
  `name` - Worker name.

#### names

    public Collection<String> names()

Returns names of all registered workers.

Returns:
  Registered worker names.

#### worker

    public GridWorker worker(String name)

Returns worker with given name.

Parameters:
  `name` - Name.
Returns:
  Registered `GridWorker` with name `name` or `null` if not found.

#### livenessCheckEnabled

    public boolean livenessCheckEnabled()

#### livenessCheckEnabled

    public void livenessCheckEnabled(boolean val)

#### getSystemWorkerBlockedTimeout

    public long getSystemWorkerBlockedTimeout()

Returns maximum inactivity period for system worker. When exceeded, worker is considered as blocked.

Returns:
  Maximum inactivity period for system worker in milliseconds.

#### setSystemWorkerBlockedTimeout

    public void setSystemWorkerBlockedTimeout(long val)

Sets maximum inactivity period for system worker. When exceeded, worker is considered as blocked.

Parameters:
  `val` - Maximum inactivity period for system worker in milliseconds.

#### onStarted

    public void onStarted(GridWorker w)

Specified by:
  `onStarted` in interface `GridWorkerListener`
Parameters:
  `w` - Started worker.

#### onStopped

    public void onStopped(GridWorker w)

Specified by:
  `onStopped` in interface `GridWorkerListener`
Parameters:
  `w` - Stopped worker.

#### onIdle

    public void onIdle(GridWorker w)

Specified by:
  `onIdle` in interface `GridWorkerListener`
Parameters:
  `w` - Idle worker.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.7.6
Release Date | : September 11 2019