Rice Pastry API

rice.p2p.scribe.maintenance
Class ScribeMaintenancePolicy.DefaultScribeMaintenancePolicy

java.lang.Object
  extended by rice.p2p.scribe.maintenance.ScribeMaintenancePolicy.DefaultScribeMaintenancePolicy
All Implemented Interfaces:
ScribeMaintenancePolicy
Enclosing interface:
ScribeMaintenancePolicy

public static class ScribeMaintenancePolicy.DefaultScribeMaintenancePolicy
extends java.lang.Object
implements ScribeMaintenancePolicy


Nested Class Summary
 
Nested classes/interfaces inherited from interface rice.p2p.scribe.maintenance.ScribeMaintenancePolicy
ScribeMaintenancePolicy.DefaultScribeMaintenancePolicy
 
Constructor Summary
ScribeMaintenancePolicy.DefaultScribeMaintenancePolicy(Environment environment)
           
 
Method Summary
 void doMaintenance(MaintainableScribe scribe)
          Called periodically.
 RawScribeContent implicitSubscribe(java.util.List<Topic> topics)
          Called when subscribing for maintenance or tree rearrangement (such as parent death).
 void nodeFaulty(MaintainableScribe scribe, NodeHandle handle, java.util.List<Topic> nodeWasParent, java.util.List<Topic> nodeWasChild)
          When anyone in any Topic (child or parent) is detected faulty.
 void noLongerRoot(MaintainableScribe scribe, java.util.List<Topic> topics)
          Called when membership changes "near" the local node, in overlay space.
 void subscribeFailed(MaintainableScribe scribe, java.util.List<Topic> failedTopics)
          The subscription failed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScribeMaintenancePolicy.DefaultScribeMaintenancePolicy

public ScribeMaintenancePolicy.DefaultScribeMaintenancePolicy(Environment environment)
Method Detail

doMaintenance

public void doMaintenance(MaintainableScribe scribe)
Description copied from interface: ScribeMaintenancePolicy
Called periodically. Can be specified in millis by by the parameter: p2p_scribe_maintenance_interval (default 180000) // 3 minutes

Specified by:
doMaintenance in interface ScribeMaintenancePolicy

noLongerRoot

public void noLongerRoot(MaintainableScribe scribe,
                         java.util.List<Topic> topics)
Description copied from interface: ScribeMaintenancePolicy
Called when membership changes "near" the local node, in overlay space. The typical use of this function would be to detect if the root has changed and subscribe to the new root, like this:
 for (Topic topic : topics) {
   scribe.subscribe(topic);
 }
 
Note however that this approach can cause a long tail at the head of the tree.

Specified by:
noLongerRoot in interface ScribeMaintenancePolicy

nodeFaulty

public void nodeFaulty(MaintainableScribe scribe,
                       NodeHandle handle,
                       java.util.List<Topic> nodeWasParent,
                       java.util.List<Topic> nodeWasChild)
Description copied from interface: ScribeMaintenancePolicy
When anyone in any Topic (child or parent) is detected faulty.
 for (Topic topic : nodeWasParent) {
   if (!isRoot(topic)) {
     scribe.subscribe(topic);
   }
 }
 

Specified by:
nodeFaulty in interface ScribeMaintenancePolicy

subscribeFailed

public void subscribeFailed(MaintainableScribe scribe,
                            java.util.List<Topic> failedTopics)
Description copied from interface: ScribeMaintenancePolicy
The subscription failed. This is called if no particular client requested the Subscription. TODO: Does this belong in the normal policy instead?

Specified by:
subscribeFailed in interface ScribeMaintenancePolicy

implicitSubscribe

public RawScribeContent implicitSubscribe(java.util.List<Topic> topics)
Called when subscribing for maintenance or tree rearrangement (such as parent death). This gives the MaintenancePolicy a chance to set the ScribeContent in these messages.

Specified by:
implicitSubscribe in interface ScribeMaintenancePolicy
Parameters:
topics - the topics we are implicitly subscribing to
Returns:
the ScribeContent to put into the SubscribeMessage (null is ok)

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection