public final class Signal extends AsyncEvent implements ActiveEvent<Signal,SignalDispatcher>
ActiveEvent
subclass for defining a POSIX signal.Modifier and Type | Field and Description |
---|---|
static int |
MAX_NUM_SIGNALS
Obtains the number of signals that can be processed.
|
Modifier and Type | Method and Description |
---|---|
void |
addHandler(AsyncBaseEventHandler handler)
Add a handler to the set of handlers associated with
this event.
|
void |
disable()
Change the state of the event so that the associated handlers
are skipped on fire.
|
void |
enable()
Change the state of the event so that associated handlers
are released on fire.
|
static Signal |
get(int id)
Gets a supported signal by its ID.
|
static Signal |
get(String name)
Gets a supported signal by its name.
|
SignalDispatcher |
getDispatcher()
Obtains the dispatcher for
this . |
int |
getId()
Gets the number of this signal.
|
static int |
getId(String name)
Gets the ID of a supported signal by its name.
|
String |
getName()
Gets the name of this signal.
|
static long |
getProcessId()
Obtains the OS Id of the JVM process.
|
boolean |
isActive()
Determines the activation state of this signal,
i.e., whether or not it has been started.
|
static boolean |
isPOSIXSignal(String name)
Determines if a signal with a given name is registered.
|
boolean |
isRunning()
Determines the firing state, releasing or skipping, of this signal,
i.e., whether or not it is active and enabled.
|
void |
removeHandler(AsyncBaseEventHandler handler)
Remove a handler from the set associated with this event.
|
void |
send(long pid)
Sends this signal to another process or process group.
|
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 . |
addHandler, bindTo, createReleaseParameters, fire, handledBy, removeHandler, setHandler, unbindTo
handledBy, hasHandlers
public static final int MAX_NUM_SIGNALS
public static boolean isPOSIXSignal(String name)
UnsupportedOperationException
- everytime, since this is not implemented yet.name
- The string passed as the name of the signal.true
when a signal with the given name is registered.public static int getId(String name)
UnsupportedOperationException
- everytime, since this is not implemented yet.name
- The name
of the signal for which to search.name
.public static Signal get(String name)
UnsupportedOperationException
- everytime, since this is not implemented yet.name
- The name
identifying the signal to get.name
or null
.public static Signal get(int id)
UnsupportedOperationException
- everytime, since this is not implemented yet.id
- The identifier of a registered signal.ID
or null
.public static long getProcessId()
send(long)
.UnsupportedOperationException
- everytime, since this is not implemented yet.ID
.public int getId()
UnsupportedOperationException
- everytime, since this is not implemented yet.public String getName()
UnsupportedOperationException
- everytime, since this is not implemented yet.public SignalDispatcher getDispatcher()
this
.getDispatcher
in interface Releasable<Signal,SignalDispatcher>
UnsupportedOperationException
- everytime, since this is not implemented yet.public boolean isActive()
isActive
in interface ActiveEvent<Signal,SignalDispatcher>
UnsupportedOperationException
- everytime, since this is not implemented yet.true
when active; false
otherwise.public boolean isRunning()
isRunning
in interface ActiveEvent<Signal,SignalDispatcher>
isRunning
in class AsyncBaseEvent
UnsupportedOperationException
- everytime, since this is not implemented yet.true
when releasing, false
when skipping.public 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.UnsupportedOperationException
- everytime, since this is not implemented yet.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>
StaticIllegalStateException
- when this
Signal
has already been started.UnsupportedOperationException
- everytime, since this is not implemented yet.disabled
- true
for starting in a disabled state.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>
StaticIllegalStateException
- when this
Signal
is not running.UnsupportedOperationException
- everytime, since this is not implemented yet.true
when this
was enabled and
false
otherwise.public void send(long pid) throws POSIXInvalidSignalException, 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.
POSIXInvalidSignalException
- when the signal number is not valid.POSIXSignalPermissionException
- when the process does not have permission to send the target.POSIXInvalidTargetException
- when the target does not exist.UnsupportedOperationException
- everytime, since this is not implemented yet.pid
- ID of the process to which to send the signal.public void addHandler(AsyncBaseEventHandler handler)
addHandler
in class AsyncBaseEvent
UnsupportedOperationException
- everytime, since this is not implemented yet.handler
- 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)
setHandler
in class AsyncBaseEvent
UnsupportedOperationException
- everytime, since this is not implemented yet.handler
- 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)
removeHandler
in class AsyncBaseEvent
UnsupportedOperationException
- everytime, since this is not implemented yet.handler
- The handler to be disassociated from this. When
null nothing happens. When the handler is not
already associated with this then nothing happenspublic void enable()
enable
in interface ActiveEvent<Signal,SignalDispatcher>
enable
in class AsyncBaseEvent
UnsupportedOperationException
- everytime, since this is not implemented yet.public void disable()
disable
in interface ActiveEvent<Signal,SignalDispatcher>
disable
in class AsyncBaseEvent
UnsupportedOperationException
- everytime, since this is not implemented yet.aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2022 aicas GmbH. All Rights Reserved.