Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

alice.tuplemedium.runtime
Class Inspector  view Inspector download Inspector.java

java.lang.Object
  extended byjava.lang.Thread
      extended byalice.tuplemedium.runtime.Inspector
All Implemented Interfaces:
java.lang.Runnable

public class Inspector
extends java.lang.Thread

this is the basic class for developing tuple media TCP/IP inspector.

as users, inspectors are active agents built with acceptor/connector pattern this class represents the proxy or connector

however, different from user, an inspector proxy is connected to only one specific tuple centre

inspector can observe a set of events and information described in Inspector Protocol


Nested Class Summary
 
Nested classes inherited from class java.lang.Thread
java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private  int daemonPort
           
protected  alice.tuplemedium.AgentId id
          inspector id
private  InspectorConnectionInfo info
          info about connection with remote acceptor
(package private) static int MAX_TENTATIVES
           
private  InspectorProtocol protocol
          current observation protocol
(package private) static int SLEEP_TIME
           
protected  alice.tuplemedium.TupleCentreId tid
          id of the tuple centre to be observed
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected Inspector(alice.tuplemedium.AgentId id_)
           
  Inspector(alice.tuplemedium.AgentId id_, alice.tuplemedium.TupleCentreId tid_)
           
 
Method Summary
 void getSnapshot()
          get a snapshot of tuple set
private  InspectorConnectionInfo getTupleCentreInfo(alice.tuplemedium.TupleCentreId tid)
          if request to a new tuple centre -> create new connection to target daemon providing the tuple centre otherwise return the already established connection
 void nextStep()
          when doing trace -> ask for a new virtual machine step
 void onVMEvent(InspectorMsg msg)
          method to be override in order to specify what actions to do when a new tuple centre event has been observed
 void reset()
          reset the tuple centre
protected  void resolveTupleCentreInfo(alice.tuplemedium.TupleCentreId tid)
          resolve information about a tuple centre
 void run()
          behaviour: wait a new observable event and take some actions, according to specific instance of inspector
 void setDaemonPort(int port)
           
 void setProtocol(InspectorProtocol p)
          setting a new observation protocol
 void setTupleSet(java.util.ArrayList tset)
          set a new tuple set
 void shutdown()
          shutdown inspector
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

daemonPort

private int daemonPort

MAX_TENTATIVES

static final int MAX_TENTATIVES
See Also:
Constant Field Values

SLEEP_TIME

static final int SLEEP_TIME
See Also:
Constant Field Values

id

protected alice.tuplemedium.AgentId id
inspector id


tid

protected alice.tuplemedium.TupleCentreId tid
id of the tuple centre to be observed


protocol

private InspectorProtocol protocol
current observation protocol


info

private InspectorConnectionInfo info
info about connection with remote acceptor

Constructor Detail

Inspector

public Inspector(alice.tuplemedium.AgentId id_,
                 alice.tuplemedium.TupleCentreId tid_)
          throws java.lang.Exception

Inspector

protected Inspector(alice.tuplemedium.AgentId id_)
Method Detail

setDaemonPort

public void setDaemonPort(int port)

run

public void run()
behaviour: wait a new observable event and take some actions, according to specific instance of inspector


onVMEvent

public void onVMEvent(InspectorMsg msg)
method to be override in order to specify what actions to do when a new tuple centre event has been observed


setProtocol

public void setProtocol(InspectorProtocol p)
                 throws java.lang.Exception
setting a new observation protocol


getSnapshot

public void getSnapshot()
                 throws java.lang.Exception
get a snapshot of tuple set


reset

public void reset()
           throws java.lang.Exception
reset the tuple centre


nextStep

public void nextStep()
              throws java.lang.Exception
when doing trace -> ask for a new virtual machine step


setTupleSet

public void setTupleSet(java.util.ArrayList tset)
                 throws java.lang.Exception
set a new tuple set


shutdown

public void shutdown()
              throws java.lang.Exception
shutdown inspector


resolveTupleCentreInfo

protected void resolveTupleCentreInfo(alice.tuplemedium.TupleCentreId tid)
                               throws NoDaemonException,
                                      java.io.IOException
resolve information about a tuple centre


getTupleCentreInfo

private InspectorConnectionInfo getTupleCentreInfo(alice.tuplemedium.TupleCentreId tid)
                                            throws NoDaemonException,
                                                   java.io.IOException
if request to a new tuple centre -> create new connection to target daemon providing the tuple centre otherwise return the already established connection