ostore.tapestry.impl
Class DynamicTClient

java.lang.Object
  |
  +--ostore.util.StandardStage
        |
        +--ostore.util.AckStage
              |
              +--ostore.tapestry.impl.DynamicTClient
All Implemented Interfaces:
EventHandlerIF, ProfilableIF, SingleThreadedEventHandlerIF

public class DynamicTClient
extends AckStage
implements SingleThreadedEventHandlerIF, EventHandlerIF, ProfilableIF

The stage that handles all dynamic behavior of a Tapestry node. Pretty much everything done in Tapestry is here, with the exception of core routing of messages. This handles node insertion, deletion, requests for diagnostic or debugging info, introduction service, self-repair, and failover to backup routes.

Version:
$Id: DynamicTClient.java,v 1.154 2003/06/06 00:08:58 strib Exp $
Author:
Ben Y. Zhao

Inner classes inherited from class ostore.util.AckStage
AckStage.GenericNonceMsg, AckStage.NonceNotFoundException
 
Field Summary
static int ATTACHED
           
static int DETACH_FINALACK
           
static int DETACH_ROUTINGOBJ
           
static int INSERT_MCAST_MODE
           
static int INSERT_NEARESTN_MODE
           
static int NOT_ATTACHED
           
 
Fields inherited from class ostore.util.AckStage
my_stage_id, next_nonce, resender, waiting_acks, waiting_msgs
 
Fields inherited from class ostore.util.StandardStage
classifier, DEBUG, event_types, inb_msg_types, my_node_id, my_sink, outb_msg_types, tag
 
Constructor Summary
DynamicTClient()
           
 
Method Summary
 double getPingTime(NodeId remoteHost)
          Get the ping time to a node.
 void handle_debugmsg(DebugMsg msg)
          handle a message asking you for your routing info
 void handle_event(QueueElementIF item)
          Send an incoming event to the correct handler
protected  void handle_node_guid(NodeGuid local_node_guid)
          Someone else (probably the router) told us our NodeGuid.
protected  void handle_stages_init_signal()
          Got a StagesInitSignal Do nothing for now, wait for NodeGuid
 void init(ConfigDataIF config)
          Initialization
 boolean moveObj(int[] olddigits, int[] newdigits, SecureHash objGuid)
          Should this object be moved to the new node?
 String print_id(int[] id)
          Print an id in hex format
 int profileSize()
           
 void requestRepublish()
          Method called to look through the _objlevels mapping, and take all objects which route through this node, and send requests for republish to their originating nodes.
protected  void timeoutCallback(NonceMsg nm, Object userData)
          Application level timeout.
 
Methods inherited from class ostore.util.AckStage
destroy, findAssociatedNonce, forceRegisterNonce, forceSendAck, handleAlarmSignal, handleEvent, handleEvents, postprocessAcks, preprocessAcks, receivedAck, sendNonceAckMsg, sendNonceMsg
 
Methods inherited from class ostore.util.StandardStage
BUG, dispatch, now_ms
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface seda.sandStorm.api.EventHandlerIF
destroy, handleEvent, handleEvents
 

Field Detail

NOT_ATTACHED

public static final int NOT_ATTACHED

INSERT_MCAST_MODE

public static final int INSERT_MCAST_MODE

INSERT_NEARESTN_MODE

public static final int INSERT_NEARESTN_MODE

ATTACHED

public static final int ATTACHED

DETACH_ROUTINGOBJ

public static final int DETACH_ROUTINGOBJ

DETACH_FINALACK

public static final int DETACH_FINALACK
Constructor Detail

DynamicTClient

public DynamicTClient()
               throws Exception
Method Detail

profileSize

public int profileSize()
Specified by:
profileSize in interface ProfilableIF

init

public void init(ConfigDataIF config)
          throws Exception
Initialization
Specified by:
init in interface EventHandlerIF
Overrides:
init in class AckStage

handle_stages_init_signal

protected void handle_stages_init_signal()
Got a StagesInitSignal Do nothing for now, wait for NodeGuid

handle_node_guid

protected void handle_node_guid(NodeGuid local_node_guid)
Someone else (probably the router) told us our NodeGuid. Now we can do some real initialization and start integration, if we are dynamic.

requestRepublish

public void requestRepublish()
Method called to look through the _objlevels mapping, and take all objects which route through this node, and send requests for republish to their originating nodes. This function is called by the handler of NodeDetach, after the BeginDelete message has been sent to the backpointed nodes.

handle_debugmsg

public void handle_debugmsg(DebugMsg msg)
handle a message asking you for your routing info

handle_event

public void handle_event(QueueElementIF item)
                  throws EventHandlerException
Send an incoming event to the correct handler
Overrides:
handle_event in class AckStage

timeoutCallback

protected void timeoutCallback(NonceMsg nm,
                               Object userData)
Description copied from class: AckStage
Application level timeout. Must be overloaded by the child class.
Overrides:
timeoutCallback in class AckStage
Following copied from class: ostore.util.AckStage
Parameters:
msg - the msg that was never acked
userData - the data passed into AckStage.sendNonceMsg(ostore.util.NonceMsg, long, java.lang.Object)

getPingTime

public double getPingTime(NodeId remoteHost)
Get the ping time to a node. TODO: make asynchronous somehow

print_id

public String print_id(int[] id)
Print an id in hex format

moveObj

public boolean moveObj(int[] olddigits,
                       int[] newdigits,
                       SecureHash objGuid)
Should this object be moved to the new node?