public class Signal extends 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 String |
description |
private String |
id |
private String |
name |
static Signal |
SHUTDOWN
The SHUTDOWN signal, that requests that the receiver should
clean up and die.
|
private static Map<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(String id,
String name,
String description) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other)
Two signals are equal if they have the same ID.
|
String |
getDescription()
Get the description of the what the signal means and how
receivers should behave when the signal is sent to them
|
String |
getId()
Get the signal ID.
|
String |
getName()
Get the short name of the signal.
|
static Signal |
getSignal(String id)
Get the signal with a given ID.
|
static 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(String id,
String name,
String description)
Register a signal.
|
String |
toString() |
public static final Signal ABORT
SHUTDOWN
signal.public static final Signal SHUTDOWN
ABORT
.public static final Signal STATUS
private final String id
private final String name
private final String description
public static Signal registerSignal(String id, String name, 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(String id)
id
- The signal ID.getSignals()
public static Collection<Signal> getSignals()
getSignal(String)
public String toString()
public boolean equals(Object other)
public int hashCode()
public String getId()
public String getName()
public String getDescription()