|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ostore.util.StandardStage | +--demo.howto.DDHowto
A simple example of how to write your own DD client and message
types. The example is as follows. We bring up two machines, a sender
and a receiver. The sender sends a DDHowto.Ping
message to the receiver,
which the receiver acknowledges with a DDHowto.Pong
. This happens a number
of times, and then the test exits. It's simple, but it covers most of the
things you need to know to do more complicated things. Please just read the
source, it's well commented.
First off, this class is going to be a
SEDA/Sandstorm
stage, so it has to inherit from
SingleThreadedEventHandlerIF
.
Nested Class Summary | |
---|---|
static class |
DDHowto.Ping
One of two DD messages used in this test. |
static class |
DDHowto.Pong
This class is identical in all by type from the DDHowto.Ping class, so I'm not going to comment
it further. |
Field Summary |
---|
Fields inherited from class ostore.util.StandardStage |
---|
classifier, DEBUG, event_types, inb_msg_types, logger, my_node_id, my_sink, outb_msg_types, resender, resender_tokens, serializable_types, sim_running, tag |
Constructor Summary | |
---|---|
DDHowto()
Constructor: Creates a new DDHowto stage. |
Method Summary | |
---|---|
void |
handleEvent(QueueElementIF item)
This is the function that will be called when a stage dispatches a message that we've subscribed to. |
void |
init(ConfigDataIF config)
Specified by seda.sandStorm.api.EventHandlerIF Initializes the stage once Sandstorm
is up and running or more likely DustDevil
(a.k.a. a Little SandStorm [lss])
You'll notice that most stages won't have constructors. |
Methods inherited from class ostore.util.StandardStage |
---|
BUG, BUG, BUG, destroy, dispatch, enqueue, handleEvents, now_ms, now_us |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DDHowto() throws Exception
DDHowto
stage.
Method Detail |
public void init(ConfigDataIF config) throws Exception
Sandstorm
is up and running or more likely DustDevil
(a.k.a. a Little SandStorm [lss])
You'll notice that most stages won't have constructors. The reason is that all initialization can take place here, where you have the information from your stage's config file to help you. I'll detail the important things you want to do in this function below.
init
in interface EventHandlerIF
init
in class StandardStage
Exception
public void handleEvent(QueueElementIF item) throws EventHandlerException
handleEvent
in interface EventHandlerIF
EventHandlerException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |