Rice Pastry API

rice.tutorial.splitstream
Class MySplitStreamClient

java.lang.Object
  extended by rice.tutorial.splitstream.MySplitStreamClient
All Implemented Interfaces:
Application, SplitStreamClient

public class MySplitStreamClient
extends java.lang.Object
implements Application, SplitStreamClient

We implement the Application interface to receive regular timed messages (see lesson5). We implement the ScribeClient interface to receive scribe messages (called ScribeContent).

Version:
$Id: pretty.settings 2305 2005-03-11 20:22:33Z jeffh $
Author:
Jeff Hoye

Field Summary
static int DATA_LENGTH
          The lenght of a message in bytes.
protected  Endpoint endpoint
          The Endpoint represents the underlieing node.
static int NUM_PUBLISHES
          The number of messages to publish.
protected  RandomSource random
          Data source...
 
Constructor Summary
MySplitStreamClient(Node node)
          The constructor for this scribe client.
 
Method Summary
 void deliver(Id id, Message message)
          Part of the Application interface.
 void deliver(Stripe s, byte[] data)
          Called whenever we receive a published message.
 boolean forward(RouteMessage message)
          DESCRIBE THE METHOD
 void joinFailed(Stripe s)
          DESCRIBE THE METHOD
 void publish()
          Multicasts data.
 void startPublishTask()
          Starts the publish task.
 void subscribe()
          Subscribes to all stripes in myChannelId.
 void update(NodeHandle handle, boolean joined)
          DESCRIBE THE METHOD
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

random

protected RandomSource random
Data source...


endpoint

protected Endpoint endpoint
The Endpoint represents the underlieing node. By making calls on the Endpoint, it assures that the message will be delivered to a MyApp on whichever node the message is intended for.


DATA_LENGTH

public static final int DATA_LENGTH
The lenght of a message in bytes.

See Also:
Constant Field Values

NUM_PUBLISHES

public static final int NUM_PUBLISHES
The number of messages to publish.

See Also:
Constant Field Values
Constructor Detail

MySplitStreamClient

public MySplitStreamClient(Node node)
The constructor for this scribe client. It will construct the ScribeApplication.

Parameters:
node - the PastryNode
Method Detail

subscribe

public void subscribe()
Subscribes to all stripes in myChannelId.


startPublishTask

public void startPublishTask()
Starts the publish task.


deliver

public void deliver(Id id,
                    Message message)
Part of the Application interface. Will receive PublishContent every so often.

Specified by:
deliver in interface Application
Parameters:
id - DESCRIBE THE PARAMETER
message - DESCRIBE THE PARAMETER

publish

public void publish()
Multicasts data.


deliver

public void deliver(Stripe s,
                    byte[] data)
Called whenever we receive a published message.

Specified by:
deliver in interface SplitStreamClient
Parameters:
s - DESCRIBE THE PARAMETER
data - DESCRIBE THE PARAMETER

joinFailed

public void joinFailed(Stripe s)
DESCRIBE THE METHOD

Specified by:
joinFailed in interface SplitStreamClient
Parameters:
s - DESCRIBE THE PARAMETER

forward

public boolean forward(RouteMessage message)
DESCRIBE THE METHOD

Specified by:
forward in interface Application
Parameters:
message - DESCRIBE THE PARAMETER
Returns:
DESCRIBE THE RETURN VALUE

update

public void update(NodeHandle handle,
                   boolean joined)
DESCRIBE THE METHOD

Specified by:
update in interface Application
Parameters:
handle - DESCRIBE THE PARAMETER
joined - DESCRIBE THE PARAMETER

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.