Rice Pastry API

rice.p2p.splitstream
Class SplitStreamImpl

java.lang.Object
  extended byrice.p2p.splitstream.SplitStreamImpl
All Implemented Interfaces:
Destructable, SplitStream

public class SplitStreamImpl
extends java.lang.Object
implements SplitStream

This is the implementing class of the ISplitStream interface. It provides the functionality of creating and attaching to channels. This class is responsible for handling all channels that a local node is part of. @(#) SplitStreamImpl.java

Version:
$Id: SplitStreamImpl.java 3274 2006-05-15 16:17:47Z jeffh $
Author:
Ansley Post, Alan Mislove

Field Summary
protected  java.util.Hashtable channels
          Hashtable of all the channels currently created on this node implicitly or explicitly.
protected  int defaultMaxChildren
          DESCRIBE THE FIELD
protected  java.lang.String instance
          DESCRIBE THE FIELD
protected  int maxFailedSubscriptions
          DESCRIBE THE FIELD
protected  Node node
          The node that this application is running on
protected  Scribe scribe
          The scribe instance for this SplitStream Object
protected  int stripeBaseBitLength
          DESCRIBE THE FIELD
 
Constructor Summary
SplitStreamImpl(Node node, java.lang.String instance)
          Convienience constructor which uses the default SplitStreamScribePolicy.
SplitStreamImpl(Node node, java.lang.String instance, SplitStreamScribePolicyFactory factory)
          The constructor for building the splitStream object which internally creates it's own Scribe.
 
Method Summary
 Channel attachChannel(ChannelId id)
          This method is used by peers who wish to listen to content distributed by some other peer using SplitStream.
 Channel createChannel(ChannelId id)
          This method is used by a peer who wishes to distribute the content using SplitStream.
 void destroy()
          DESCRIBE THE METHOD
 Channel[] getChannels()
          Returns all of the channels on this local splitstream
 Environment getEnvironment()
          Gets the Environment attribute of the SplitStreamImpl object
 SplitStreamScribePolicy getPolicy()
          Returns the policy used to control Scribe
 int getStripeBaseBitLength()
          Gets the StripeBaseBitLength attribute of the SplitStreamImpl object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scribe

protected Scribe scribe
The scribe instance for this SplitStream Object


node

protected Node node
The node that this application is running on


channels

protected java.util.Hashtable channels
Hashtable of all the channels currently created on this node implicitly or explicitly.


stripeBaseBitLength

protected final int stripeBaseBitLength
DESCRIBE THE FIELD


maxFailedSubscriptions

protected final int maxFailedSubscriptions
DESCRIBE THE FIELD


defaultMaxChildren

protected final int defaultMaxChildren
DESCRIBE THE FIELD


instance

protected java.lang.String instance
DESCRIBE THE FIELD

Constructor Detail

SplitStreamImpl

public SplitStreamImpl(Node node,
                       java.lang.String instance)
Convienience constructor which uses the default SplitStreamScribePolicy.

Parameters:
node -
instance -

SplitStreamImpl

public SplitStreamImpl(Node node,
                       java.lang.String instance,
                       SplitStreamScribePolicyFactory factory)
The constructor for building the splitStream object which internally creates it's own Scribe.

Parameters:
node - the pastry node that we will use
instance - The instance name for this splitstream
factory - DESCRIBE THE PARAMETER
Method Detail

getChannels

public Channel[] getChannels()
Returns all of the channels on this local splitstream

Specified by:
getChannels in interface SplitStream
Returns:
All of the channels currently being received by this splitstream

getPolicy

public SplitStreamScribePolicy getPolicy()
Returns the policy used to control Scribe

Returns:
The Scribe policy

getStripeBaseBitLength

public int getStripeBaseBitLength()
Gets the StripeBaseBitLength attribute of the SplitStreamImpl object

Specified by:
getStripeBaseBitLength in interface SplitStream
Returns:
The StripeBaseBitLength value

getEnvironment

public Environment getEnvironment()
Gets the Environment attribute of the SplitStreamImpl object

Specified by:
getEnvironment in interface SplitStream
Returns:
The Environment value

createChannel

public Channel createChannel(ChannelId id)
This method is used by a peer who wishes to distribute the content using SplitStream. It creates a Channel Object consisting of numStripes number of Stripes, one for each stripe's content. A Channel object is responsible for implementing SplitStream functionality, like maintaining multiple multicast trees, bandwidth management and discovering parents having spare capacity. One Channel object should be created for each content distribution which wishes to use SplitStream.

Specified by:
createChannel in interface SplitStream
Parameters:
id - The id of the channel to create
Returns:
an instance of a Channel class.

attachChannel

public Channel attachChannel(ChannelId id)
This method is used by peers who wish to listen to content distributed by some other peer using SplitStream. It attaches the local node to the Channel which is being used by the source peer to distribute the content. Essentially, this method finds out the different parameters of Channel object which is created by the source, (the peer distributing the content) , and then creates a local Channel object with these parameters and returns it. This is a non-blocking call so the returned Channel object may not be initialized with all the parameters, so applications should wait for channelIsReady() notification made by channels when they are ready.

Specified by:
attachChannel in interface SplitStream
Parameters:
id - The id of the channel to create
Returns:
An instance of Channel object.

destroy

public void destroy()
DESCRIBE THE METHOD

Specified by:
destroy in interface SplitStream

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection