public final class Signal extends AsyncEvent implements ActiveEvent<Signal,SignalDispatcher>
ActiveEvent subclass for defining a POSIX signal.| Modifier and Type | Method and Description |
|---|---|
void |
addHandler(AsyncBaseEventHandler handler)
Add a handler to the set of handlers associated with
this event.
|
static Signal |
get(int id)
Gets a supported signal by its ID.
|
static Signal |
get(java.lang.String name)
Gets a supported signal by its name.
|
SignalDispatcher |
getDispatcher()
Obtain the current dispatcher for this event.
|
int |
getId()
Gets the number of this signal.
|
static int |
getId(java.lang.String name)
Gets the ID of a supported signal by its name.
|
java.lang.String |
getName()
Gets the name of this signal.
|
static long |
getProcessId()
Obtains the OS Id of the JVM process.
|
int |
hashCode() |
boolean |
isActive()
Determines the activation state of this signal,
i.e., whether or not it has been started.
|
boolean |
isRunning()
Determines the firing state, releasing or skipping, of this signal,
i.e., whether or not it is active and enabled.
|
static boolean |
isSignal(int id)
Determines if the given name represents a POSIX signal.
|
static boolean |
isSignal(java.lang.String name)
Determines if a signal with a given name is registered.
|
void |
removeHandler(AsyncBaseEventHandler handler)
Remove a handler from the set associated with this event.
|
void |
send(long pid)
Sends this signal to another process.
|
SignalDispatcher |
setDispatcher(SignalDispatcher value)
Change the current dispatcher for this event.
|
void |
setHandler(AsyncBaseEventHandler handler)
Associate a new handler with this event and remove all
existing handlers.
|
void |
start()
Starts this
Signal, i.e., changes to a running state. |
void |
start(boolean disabled)
Starts this
Signal, i.e., changes to a running state. |
boolean |
stop()
Stops this
Signal. |
java.lang.String |
toString() |
void |
trigger() |
addHandler, bindTo, createReleaseParameters, fire, handledBy, removeHandler, setHandler, unbindTodisable, enable, finalize, handledBy, hasHandlersclone, equals, getClass, notify, notifyAll, wait, wait, waitdisable, enablepublic static boolean isSignal(java.lang.String name)
name - The string passed as the name of the signal.true when a signal with the given name is registered.public static boolean isSignal(int id)
id - The int passed as the numerical identifier of the signal.true when a signal with the given id is defined, but
in all other cases false.public static int getId(java.lang.String name)
name - The name of the signal for which to search.name.POSIXInvalidSignalException - when no signal with the given
name exists or name is null.public static Signal get(java.lang.String name)
name - The name identifying the signal to get.name or null.POSIXInvalidSignalException - when no signal with the given
name exists or name is null.public static Signal get(int id)
id - The identifier of a registered signal.ID or null.POSIXInvalidSignalException - when no signal with the given
identifier id exists.public static long getProcessId()
send(long).ID.public void trigger()
public int getId()
public int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String getName()
public SignalDispatcher getDispatcher()
getDispatcher in interface ActiveEvent<Signal,SignalDispatcher>getDispatcher in interface Releasable<Signal,SignalDispatcher>public SignalDispatcher setDispatcher(SignalDispatcher value)
dispatcher is null, the default dispatcher is restored.setDispatcher in interface ActiveEvent<Signal,SignalDispatcher>public boolean isActive()
isActive in interface ActiveEvent<Signal,SignalDispatcher>true when active; false otherwise.public boolean isRunning()
isRunning in interface ActiveEvent<Signal,SignalDispatcher>isRunning in class AsyncBaseEventtrue when releasing, false when skipping.public java.lang.String toString()
toString in class java.lang.Objectpublic void start()
throws StaticIllegalStateException
Signal, i.e., changes to a running state.
A running signal is a source of activation when in a scoped memory
and is a member of the root set when in the heap. A running
signal can be triggered.start in interface ActiveEvent<Signal,SignalDispatcher>StaticIllegalStateException - when this
Signal has already been started.stop()public void start(boolean disabled)
throws StaticIllegalStateException
Signal, i.e., changes to a running state.
A running signal is a source of activation when in a scoped memory
and is a member of the root set when in the heap. A running
signal can be triggered.start in interface ActiveEvent<Signal,SignalDispatcher>disabled - true for starting in a disabled state.StaticIllegalStateException - when this
Signal has already been started.stop()public boolean stop()
throws StaticIllegalStateException
Signal. A stopped signal
ceases to be a source of activation and no longer causes any AE attached
to it to be a source of activation.stop in interface ActiveEvent<Signal,SignalDispatcher>true when this was enabled and
false otherwise.StaticIllegalStateException - when this
Signal is not running.public void addHandler(AsyncBaseEventHandler handler)
AsyncBaseEventaddHandler in class AsyncBaseEventhandler - The new handler to add to the list of
handlers already associated with this.
When handler is already associated with
the event, the call has no effectpublic void setHandler(AsyncBaseEventHandler handler)
AsyncBaseEventsetHandler in class AsyncBaseEventhandler - The instance of AsyncBaseEventHandler to
be associated with this. When handler is
null then no handler will be associated
with this, i.e., behave effectively as if
setHandler(null) invokes
removeHandler(AsyncBaseEventHandler) for
each associated handler.public void removeHandler(AsyncBaseEventHandler handler)
AsyncBaseEventremoveHandler in class AsyncBaseEventhandler - The handler to be disassociated from this. When
null nothing happens. When the handler is not
already associated with this then nothing happenspublic void send(long pid)
throws POSIXSignalPermissionException,
POSIXInvalidTargetException
On POSIX systems running in user space, the following holds:
POSIX.1-2001 requires the underlying mechanism of signal.send(-1)
to send signal to all processes for which the current process may
signal, except possibly for some OS-defined system processes.
For an RTVM running in kernel space, the meaning of the pid
is implementation dependent, though it should be as closed to the standard
definition as possible.
pid - The identifier of the process to which to send the signal.POSIXSignalPermissionException - when the process does not
have permission to send the target.POSIXInvalidTargetException - when the target does not exist.aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2024 aicas GmbH. All Rights Reserved.