com.aelitis.azureus.plugins.startstoprules.defaultplugin
Class StartStopRulesDefaultPlugin

java.lang.Object
  extended by com.aelitis.azureus.plugins.startstoprules.defaultplugin.StartStopRulesDefaultPlugin
All Implemented Interfaces:
COConfigurationListener, AEDiagnosticsEvidenceGenerator, Plugin

public class StartStopRulesDefaultPlugin
extends Object
implements Plugin, COConfigurationListener, AEDiagnosticsEvidenceGenerator

Handles Starting and Stopping of torrents. TODO: RANK_TIMED is quite a hack and is spread all over. It needs to be redone, probably with a timer on each seeding torrent which triggers when time is up and it needs to stop. BUG: When "AutoStart 0 Peers" is on, and minSpeedForActivelySeeding is enabled, the 0 peer torrents will continuously switch from seeding to queued, probably due to the connection attempt registering speed. This might be fixed by the "wait XX ms before switching active state" code. Other Notes: "CD" is often used to refer to "Seed" or "Seeding", because "C" sounds like "See"


Nested Class Summary
static interface StartStopRulesDefaultPlugin.UIAdapter
           
 
Field Summary
protected  boolean bDebugLog
          Whether Debug Info is written to the log and tooltip
protected  LoggerChannel log
           
static boolean pauseChangeFlagChecker
           
protected  PluginConfig plugin_config
           
static int RANK_NONE
          Do not rank completed torrents
static int RANK_PEERCOUNT
          Rank completed torrents using the peers count, weighted by the seeds to peers ratio
static int RANK_SEEDCOUNT
          Rank completed torrents using Seed Count method
static int RANK_SPRATIO
          Rank completed torrents using Seeds:Peer Ratio
static int RANK_TIMED
          Rank completed torrents using a timed rotation of minTimeAlive
 
Constructor Summary
StartStopRulesDefaultPlugin()
           
 
Method Summary
 void addListener(StartStopRulesFPListener listener)
           
 int calcPeersNoUs(Download download, DownloadScrapeResult sr)
          Get # of peers not including us
 int calcSeedsNoUs(Download download, DownloadScrapeResult sr)
          Get # of seeds, not including us, AND including fake full copies
 int calcSeedsNoUs(Download download, DownloadScrapeResult sr, int numPeers)
          Get # of seeds, not including us, AND including fake full copies
 void configurationSaved()
           
 void generate(IndentWriter writer)
           
 List getFPListeners()
           
protected  int getMaxActive()
           
static DefaultRankCalculator getRankCalculator(Download dl)
           
 void initialize(PluginInterface _plugin_interface)
          This method is called when the Plugin is loaded by Azureus
static void load(PluginInterface plugin_interface)
           
protected  void process()
           
 void removeListener(StartStopRulesFPListener listener)
           
 void requestProcessCycle(DefaultRankCalculator rankToRecalc)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RANK_NONE

public static final int RANK_NONE
Do not rank completed torrents

See Also:
Constant Field Values

RANK_SPRATIO

public static final int RANK_SPRATIO
Rank completed torrents using Seeds:Peer Ratio

See Also:
Constant Field Values

RANK_SEEDCOUNT

public static final int RANK_SEEDCOUNT
Rank completed torrents using Seed Count method

See Also:
Constant Field Values

RANK_TIMED

public static final int RANK_TIMED
Rank completed torrents using a timed rotation of minTimeAlive

See Also:
Constant Field Values

RANK_PEERCOUNT

public static final int RANK_PEERCOUNT
Rank completed torrents using the peers count, weighted by the seeds to peers ratio

See Also:
Constant Field Values

plugin_config

protected PluginConfig plugin_config

log

protected LoggerChannel log

bDebugLog

protected boolean bDebugLog
Whether Debug Info is written to the log and tooltip


pauseChangeFlagChecker

public static boolean pauseChangeFlagChecker
Constructor Detail

StartStopRulesDefaultPlugin

public StartStopRulesDefaultPlugin()
Method Detail

load

public static void load(PluginInterface plugin_interface)

initialize

public void initialize(PluginInterface _plugin_interface)
Description copied from interface: Plugin
This method is called when the Plugin is loaded by Azureus

Specified by:
initialize in interface Plugin
Parameters:
_plugin_interface - the interface that the plugin must use to communicate with Azureus

getRankCalculator

public static DefaultRankCalculator getRankCalculator(Download dl)

configurationSaved

public void configurationSaved()
Specified by:
configurationSaved in interface COConfigurationListener

getMaxActive

protected int getMaxActive()

process

protected void process()

calcPeersNoUs

public int calcPeersNoUs(Download download,
                         DownloadScrapeResult sr)
Get # of peers not including us


calcSeedsNoUs

public int calcSeedsNoUs(Download download,
                         DownloadScrapeResult sr)
Get # of seeds, not including us, AND including fake full copies

Parameters:
download - Download to get # of seeds for
Returns:
seed count

calcSeedsNoUs

public int calcSeedsNoUs(Download download,
                         DownloadScrapeResult sr,
                         int numPeers)
Get # of seeds, not including us, AND including fake full copies

Parameters:
download - Download to get # of seeds for
numPeers - # peers we know of, required to calculate Fake Full Copies
Returns:
seed count

requestProcessCycle

public void requestProcessCycle(DefaultRankCalculator rankToRecalc)

generate

public void generate(IndentWriter writer)
Specified by:
generate in interface AEDiagnosticsEvidenceGenerator

addListener

public void addListener(StartStopRulesFPListener listener)

removeListener

public void removeListener(StartStopRulesFPListener listener)

getFPListeners

public List getFPListeners()