|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ostore.dispatch.Signal
Contains a few static methods to mimic UNIX signals.
This class provides a unified interface for OceanStore- and
SandStorm-specific signals. It sits atop both the
Classifier
and SignalMgr
.
TODO: Coallesce all signals into single class with a "type" field.
Intercept SandStorm signals and replace with local equivalent.
Nested Class Summary | |
---|---|
static class |
Signal.AlarmSignal
The OceanStore equivalent of SIGALRM |
static class |
Signal.RebuildSignal
This signal tells the receivers to resynchronize/optimize their internal data structures. |
Field Summary | |
---|---|
static int |
ALRM
The code for Signal.AlarmSignal .
|
static int |
INIT
The code for StagesInitializedSignal .
|
static int |
RBLD
The code for Signal.RebuildSignal .
|
Constructor Summary | |
---|---|
Signal(NodeId node_id)
|
Method Summary | |
---|---|
Object |
alarm(String target,
long millis)
Dispatch an AlarmSignal at a specified time
This method has similar functionality to the alarm
function in C. |
void |
cancel(Object token)
Cancel an AlarmSignal scheduled by alarm .
|
static Signal |
getSignal(NodeId node_id)
Returns the Signal instance corresponding to a
NodeId . |
boolean |
register(int type,
String target,
SinkIF sink)
Subscribes the specified sink to signals of the specified type which have the specified target. |
static void |
removeSignal(NodeId node_id)
Deletes the Signal instance corresponding to a
NodeId . |
void |
signal_lossy(int type,
String target)
Dispatches a signal of the specified type with the specified target. |
void |
signal(int type,
String target)
Dispatches a signal of the specified type with the specified target. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int INIT
StagesInitializedSignal
.
Dispatched when the init
method of each stage has
completed.
public static final int RBLD
Signal.RebuildSignal
.
This signal tells the receivers to resynchronize/optimize their
internal data structures. Useful for starting time-consuming
optimizations when machine load is low.
public static final int ALRM
Signal.AlarmSignal
.
Dispatched by alarm
.
Constructor Detail |
public Signal(NodeId node_id)
Method Detail |
public static Signal getSignal(NodeId node_id)
Signal
instance corresponding to a
NodeId
.
node_id
- The NodeId
which parameterizes a
virtual SandStorm instance.
Signal
instance
corresponding to node_id
.public static void removeSignal(NodeId node_id)
Signal
instance corresponding to a
NodeId
. Should be called only when a node is going down
and going to come up again with a new node id. Use very carefully!
node_id
- The NodeId
which parameterizes a
virtual SandStorm instance.public boolean register(int type, String target, SinkIF sink)
target
is
null
, all signals of the specified type will be
enqueued on the sink. For some signals (such as INIT
),
the target
parameter is ignored.
type
- currently one of INIT
or ALRM
.target
- the name of the StageIF
to which the
signals are directed, or null
.sink
- the SinkIF
to receive the
SignalIF
s.
public void signal(int type, String target) throws SinkFullException
target
parameter is ignored.
For others, it is required to be non-null
.
type
- currently must be RBLD
or ALRM
.target
- the name of the StageIF
to which the
signals are directed, or null
.
SinkFullException
- if the signal could not be
dispatched.Classifier.dispatch(seda.sandStorm.api.QueueElementIF)
public void signal_lossy(int type, String target)
SinkFullException
s are quietly dropped.
type
- currently must be RBLD
or ALRM
.target
- the name of the StageIF
to which the
signals are directed, or null
.signal(int, java.lang.String)
public Object alarm(String target, long millis)
AlarmSignal
at a specified time
This method has similar functionality to the alarm
function in C.
target
- The name of the target StageIF
.
May not be null
.millis
- The number of milliseconds from now to dispatch the
event.
cancel
in order to cancel
the alarm before it is dispatched.cancel(java.lang.Object)
public void cancel(Object token)
AlarmSignal
scheduled by alarm
.
If the alarm has already been signaled, this method has no effect.
token
- The Object
returned by alarm
.
IllegalArgumentException
- if token
is not a
token returned by the internal timer.alarm(java.lang.String, long)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |