JXTA

net.jxta.impl.content.defprovider
Class ActiveTransferTracker

java.lang.Object
  extended by net.jxta.impl.content.defprovider.ActiveTransferTracker

public class ActiveTransferTracker
extends Object

This class provides a somewhat efficient mechanism for tracking active transfers and providing a cache for information related to those transfers. As an example, Contents currently only have streamed data accessors. Requests for data will typically come in a linear fashion, so it makes good sense from a performance perspective to leave the stream open for a period of time. Additionally, this tracker class puts some absolute limits in place as to how many concurrent clients will be served, giving preference to transfers already in progress.


Constructor Summary
ActiveTransferTracker(PeerGroup peerGroup, ScheduledExecutorService executor)
          Constructor.
 
Method Summary
 void addActiveTransferListener(ActiveTransferTrackerListener listener)
          Adds an tracker listener to notify of interesting events.
 ActiveTransfer getSession(DefaultContentShare share, PipeAdvertisement destination)
          Creates and/or retrieves the active transfer session for the provided combination of share and destination.
 void removeActiveTransferListener(ActiveTransferTrackerListener listener)
          Removes a transfer listener, preventin further event notifications.
 void start()
          Start tracking and serving.
 void stop()
          Stop tracking and serving, freeing any resources held.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActiveTransferTracker

public ActiveTransferTracker(PeerGroup peerGroup,
                             ScheduledExecutorService executor)
Constructor.

Parameters:
peerGroup - PeerGroup to use to resolve pipes
executor - executor to submit garbage collection tasks to
Method Detail

addActiveTransferListener

public void addActiveTransferListener(ActiveTransferTrackerListener listener)
Adds an tracker listener to notify of interesting events.

Parameters:
listener - listener to add

removeActiveTransferListener

public void removeActiveTransferListener(ActiveTransferTrackerListener listener)
Removes a transfer listener, preventin further event notifications.

Parameters:
listener - listener to add

getSession

public ActiveTransfer getSession(DefaultContentShare share,
                                 PipeAdvertisement destination)
                          throws TooManyClientsException,
                                 IOException
Creates and/or retrieves the active transfer session for the provided combination of share and destination.

Parameters:
share - content share to serve to the destination
destination - pipe to send data to
Returns:
trnsfer session object
Throws:
TooManyClientsException
IOException

start

public void start()
Start tracking and serving.


stop

public void stop()
Stop tracking and serving, freeing any resources held.


JXSE