implicit final class ClusterEvents extends AnyVal
Cluster Events
- Alphabetic
- By Inheritance
- ClusterEvents
- AnyVal
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- Any
- final def ##(): Int
- Definition Classes
- Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def getClass(): Class[_ <: AnyVal]
- Definition Classes
- AnyVal → Any
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def onDisconnect(callback: (Worker) => Any): Cluster
Emitted after the worker IPC channel has disconnected.
Emitted after the worker IPC channel has disconnected. This can occur when a worker exits gracefully, is killed, or is disconnected manually (such as with worker.disconnect()).
There may be a delay between the 'disconnect' and 'exit' events. These events can be used to detect if the process is stuck in a cleanup or if there are long-living connections.
- callback
the event handler
- Annotations
- @inline()
- def onExit(callback: (Worker, Int, String) => Any): Cluster
Similar to the cluster.on('exit') event, but specific to this worker.
Similar to the cluster.on('exit') event, but specific to this worker.
- callback
the event handler <il>worker <Worker> the worker
- code <Number> the exit code, if it exited normally.
- signal <String> the name of the signal (eg. 'SIGHUP') that caused the process to be killed.
- Annotations
- @inline()
- def onFork(callback: (Worker) => Any): Cluster
When a new worker is forked the cluster module will emit a 'fork' event.
When a new worker is forked the cluster module will emit a 'fork' event. This can be used to log worker activity, and create your own timeout.
- callback
the event handler
- Annotations
- @inline()
- def onListening(callback: (Worker, Address) => Any): Cluster
After calling listen() from a worker, when the 'listening' event is emitted on the server, a 'listening' event will also be emitted on cluster in the master.
After calling listen() from a worker, when the 'listening' event is emitted on the server, a 'listening' event will also be emitted on cluster in the master.
The event handler is executed with two arguments, the worker contains the worker object and the address object contains the following connection properties: address, port and addressType. This is very useful if the worker is listening on more than one address.
- callback
the event handler
- Annotations
- @inline()
- def onMessage(callback: (Worker, Message, Any) => Any): Cluster
Emitted when any worker receives a message.
Emitted when any worker receives a message. See child_process event: 'message'.
Before Node.js v6.0, this event emitted only the message and the handle, but not the worker object, contrary to what the documentation stated.
- callback
the event handler
- Annotations
- @inline()
- def onOnline(callback: (Worker) => Any): Cluster
After forking a new worker, the worker should respond with an online message.
After forking a new worker, the worker should respond with an online message. When the master receives an online message it will emit this event. The difference between 'fork' and 'online' is that fork is emitted when the master forks a worker, and 'online' is emitted when the worker is running.
- callback
the event handler
- Annotations
- @inline()
- def onSetup(callback: (ClusterSettings) => Any): Cluster
Emitted every time .setupMaster() is called.
Emitted every time .setupMaster() is called. The settings object is the cluster.settings object at the time .setupMaster() was called and is advisory only, since multiple calls to .setupMaster() can be made in a single tick.
If accuracy is important, use cluster.settings.
- callback
the event handler
- Annotations
- @inline()
- def toString(): String
- Definition Classes
- Any