Rice Pastry API

rice.p2p.splitstream
Class SplitStreamImpl

java.lang.Object
  extended by rice.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.

Version:
$Id: SplitStreamImpl.java 3524 2007-01-09 14:09:27Z 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
           
protected  java.lang.String instance
           
protected  int maxFailedSubscriptions
           
protected  Node node
          The node that this application is running on
protected  Scribe scribe
          The scribe instance for this SplitStream Object
protected  int stripeBaseBitLength
           
 
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()
           
 Channel[] getChannels()
          Returns all of the channels on this local splitstream
 Environment getEnvironment()
           
 SplitStreamScribePolicy getPolicy()
          Returns the policy used to control Scribe
 int getStripeBaseBitLength()
           
 
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

maxFailedSubscriptions

protected final int maxFailedSubscriptions

defaultMaxChildren

protected final int defaultMaxChildren

instance

protected java.lang.String instance
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
Method Detail

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.

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()
Specified by:
getStripeBaseBitLength in interface SplitStream

getEnvironment

public Environment getEnvironment()
Specified by:
getEnvironment in interface SplitStream

destroy

public void destroy()
Specified by:
destroy in interface Destructable
Specified by:
destroy in interface SplitStream

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection