public class Signal
extends java.lang.Object
SignalTarget
interface. Signals must be registered before they
can be used. Use getSignals()
to get a list of signals
that have been registered. A signal can only be registered once.Modifier and Type | Field and Description |
---|---|
static Signal |
ABORT
The ABORT signal, that requests that the receiver should
clean up and die.
|
private java.lang.String |
description |
private java.lang.String |
id |
private java.lang.String |
name |
static Signal |
PAUSE
The PAUSE signal, that requests that the receiver should
update the pause whatever it is doing and return control to
the system.
|
static Signal |
SHUTDOWN
The SHUTDOWN signal, that requests that the receiver should
clean up and die.
|
private static java.util.Map<java.lang.String,Signal> |
signals
Holds all registered signals.
|
static Signal |
STATUS
The STATUS signal, that requests that the receiver should
update the status on the system.
|
Modifier | Constructor and Description |
---|---|
private |
Signal(java.lang.String id,
java.lang.String name,
java.lang.String description) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object other)
Two signals are equal if they have the same ID.
|
java.lang.String |
getDescription()
Get the description of the what the signal means and how
receivers should behave when the signal is sent to them
|
java.lang.String |
getId()
Get the signal ID.
|
java.lang.String |
getName()
Get the short name of the signal.
|
static Signal |
getSignal(java.lang.String id)
Get the signal with a given ID.
|
static java.util.Collection<Signal> |
getSignals()
Get all registered signals.
|
int |
hashCode()
The hashcode for a signal is the same as the hashcode for
the ID.
|
static Signal |
registerSignal(java.lang.String id,
java.lang.String name,
java.lang.String description)
Register a signal.
|
java.lang.String |
toString() |
public static final Signal ABORT
SHUTDOWN
signal.public static final Signal SHUTDOWN
ABORT
.public static final Signal STATUS
public static final Signal PAUSE
private static java.util.Map<java.lang.String,Signal> signals
private final java.lang.String id
private final java.lang.String name
private final java.lang.String description
private Signal(java.lang.String id, java.lang.String name, java.lang.String description)
public static Signal registerSignal(java.lang.String id, java.lang.String name, java.lang.String description)
id
- The ID of the signal. This must be unique. If another signal
with the same ID already exists, this method does nothing.name
- The short name of the signaldescription
- A description of the what the signal means and how
receivers should behave when the signal is sent to thempublic static Signal getSignal(java.lang.String id)
id
- The signal ID.getSignals()
public static java.util.Collection<Signal> getSignals()
getSignal(String)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String getId()
public java.lang.String getName()
public java.lang.String getDescription()