|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.vattp.data.VatTPMgr
Untamed: Manage the connections between this vat and other vats.
The VatTPMgr acts as the focal point for managing the TCP connections from a particular vat. It uses the public/private key pair for the vat, which defines the vat's identity.
The important method(s) are getConnection(...) which returns a VatTPConnection to a remote vat, and addNewConnectionReactor which lets the higher layers connect themselves to connections which have completed the startup protocol.
Field Summary | |
(package private) static int |
LIVES_CONTINUE
|
(package private) static int |
LIVES_DUP
|
(package private) static int |
LIVES_NOTIFY
|
private Hashtable |
myDieingConnections
Connections which have been told to shut down (until they have gone). |
private Hashtable |
myIdentifiedConnections
The connections which haven't completed the start up protocol. |
private KeyPair |
myIdentityKeys
|
private ListenThread[] |
myListenThreads
The threads which are listening for incoming connections |
private String |
myLocalVatID
The vatID of the local vat. |
private NetConfig |
myNetConfig
|
private NewConnectionReactor |
myReactor
The object to notify about newly available connections |
private Hashtable |
myRunningDataConnections
The running DataConnections. |
private Hashtable |
mySuspendedConnections
The connections which are suspended. |
private Hashtable |
mySuspendingConnections
The connections in the process of suspending. |
private Hashtable |
myUnidentifiedConnections
The unidentified connections which haven't completed the start up protocol. |
private Vat |
myVat
Connection to the E run queue |
private VatLocationLookup |
myVLS
VLS registrations that we maintain |
Constructor Summary | |
|
VatTPMgr(KeyPair identityKeys,
NetConfig netConfig)
Enabled: Make a VatTPMgr listening on the specified ports. |
private |
VatTPMgr(KeyPair identityKeys,
NetConfig netConfig,
Vat vat)
Make a VatTPMgr. |
Method Summary | |
void |
addNewConnectionReactor(NewConnectionReactor reactor)
Enabled: Register an object to notice a new connection which has successfully completed the startup protocol. |
(package private) void |
connectionSuspended(VatTPConnection conn,
String vatID)
Register that this connection is suspended |
(package private) void |
connectionSuspending(VatTPConnection conn,
String vatID)
Register that this connection is suspending |
(package private) void |
connectToSelf(DataPath path)
Notify the connectToVatAt caller that he has tried to connect to self. |
Ref |
connectToVatAt(String ipPort)
Enabled: Make an authenticated connection to a vat given an IP:port address. |
void |
connectToVatAt(String ipPort,
Resolver res)
Enabled: Make an authenticated connection to a vat given an IP:port address. |
(package private) void |
deathNotification(VatTPConnection conn)
Mark the death of a connection. |
(package private) void |
enterHospice(VatTPConnection conn,
String vatID)
Register that this connection is dying |
private static ConstList |
expandPath(NetAddr netAddr)
Return the subset of a searchPath for directly connecting to netAddr. |
private VatTPConnection |
findDataConnection(String vatID)
Find an existing VatTPConnection object that can or will be able to be used for data transfer. |
VatTPConnection |
getConnection(String vatID,
ConstList searchList)
Enabled: Return a VatTPConnection to the remote vat given its vatID and search path. |
NetConfig |
getNetConfig()
Enabled: Returns the VatTP configuration parameters as they exist after allocating a listen port. |
private void |
listState(Enumeration enum,
StringBuffer buf)
List the current DataPaths/DataConnections in a enumeration. |
private int |
moveIdentifiedPath(DataPath path,
String remoteVatID,
boolean isIncoming)
Move a path from the unidentified list to the identified but not connected path list. |
(package private) int |
newConnectionIdentified(DataPath path,
String remoteVatID,
String localVatID,
boolean isIncoming)
Register a DataPath for an connection where the remote vat has been identified |
(package private) void |
newInboundSocket(Socket socket)
Receive a new inbound socket from the ListenThread. |
(package private) void |
noticeProblem(Throwable error)
Learn of a problem with the ListenThread. |
VatTPConnection |
optConnection(String vatID)
Enabled: Like getConnection((vatID, searchList), but if there isn't a working live one, will return null rather than creating one. |
private VatTPConnection |
removeDataConnection(String vatID)
Remove an existing VatTPConnection object that can or will be able to be used for data transfer (That is, one that is not dying or dead) from the hash table which holds it and return it. |
private String |
removeDieing(VatTPConnection dc)
Remove an entry from myDieingConnections |
private VatTPConnection |
removeIdentified(String regID)
Remove an entry from myIdentifiedConnections |
private VatTPConnection |
removeSuspended(String regID)
Remove an entry from mySuspendedConnections |
private VatTPConnection |
removeSuspending(String regID)
Remove an entry from mySuspendingConnections |
private Object |
removeUnidentified(DataPath path)
Remove an entry from myUnidentifiedConnections |
ConstList |
searchPath()
Enabled: Return the search path to our own vat. |
void |
setVatLocationLookup(VatLocationLookup vls)
Enabled: Set the object which will respond to vat location queries on our listen port. |
(package private) void |
startupSuccessful(VatTPConnection connection,
String remoteVatID,
boolean isResuming)
Inform the world that a new conection is ready to pass data. |
String |
toString()
Suppressed: Convert the state of the world to a string and print it. |
(package private) void |
unidentifiedConnectionDied(DataPath path,
String msg,
Throwable problem)
Note that a DataPath for an connection has died before the vat at the other end was identified. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private final KeyPair myIdentityKeys
private final String myLocalVatID
private final NetConfig myNetConfig
private VatLocationLookup myVLS
private final Vat myVat
private final ListenThread[] myListenThreads
private NewConnectionReactor myReactor
private Hashtable myUnidentifiedConnections
private Hashtable myIdentifiedConnections
private final Hashtable myRunningDataConnections
private Hashtable mySuspendingConnections
private Hashtable mySuspendedConnections
private Hashtable myDieingConnections
static final int LIVES_CONTINUE
static final int LIVES_DUP
static final int LIVES_NOTIFY
Constructor Detail |
public VatTPMgr(KeyPair identityKeys, NetConfig netConfig) throws UnknownHostException, IOException
Each VatTPMgr made will have a different ID. The VatTPMgr is associated with one vat.
This constructor gets the Vat for that vat via the static method
Vat.getCurrentVat()
. The rest of the VatTP system gets
access to that Vat by having the reference explicitly passed
during construction. Therefore, if it is necessary to have a
VatTP system work with a different Vat, the constructor
which accepts the Vat as a specific parameter should be used.
identityKeys
- is the KeyPair which defines the identity of this
vat.netConfig
- holds the configuration parameters for configuring
how we interact with the network.private VatTPMgr(KeyPair identityKeys, NetConfig netConfig, Vat vat) throws UnknownHostException, IOException
Each VatTPMgr made will have a different ID. The VatTPMgr is associated with one vat.
identityKeys
- is the KeyPair which defines the identity of this
vat.netConfig
- holds the configuration parameters for configuring
how we interact with the network.vat
- is the Vat to use to synchronize the connections.Method Detail |
private static ConstList expandPath(NetAddr netAddr) throws UnknownHostException
This does various kinds of DNS lookup to convert netAddr to an externally addressable form
UnknownHostException
void connectionSuspended(VatTPConnection conn, String vatID)
conn
- The data connection which is suspended.vatID
- The vatID of the remote end.void connectionSuspending(VatTPConnection conn, String vatID)
conn
- The data connection which is suspending.vatID
- The vatID of the remote end.void connectToSelf(DataPath path)
path
- is the DataPath object trying the connection.public Ref connectToVatAt(String ipPort)
ipPort
- is the IP address and port to connect to separated by a
colon. For example "groucho.communities.com:1670".
public void connectToVatAt(String ipPort, Resolver res)
ipPort
- The IP address and port to connect to, separated by a
colon. For example "groucho.communities.com:1670".res
- The object that will be notified when the connection is
completed or if the attempt to connect fails.void deathNotification(VatTPConnection conn)
conn
- The data connection which has shut down.void enterHospice(VatTPConnection conn, String vatID)
conn
- The data connection which is shutting down.vatID
- The vatID of the remote end.private VatTPConnection findDataConnection(String vatID)
vatID
- is the vatID of the remote vat.
public VatTPConnection getConnection(String vatID, ConstList searchList)
vatID
- is the vatID for the remote vat wanted. The
process of setting up the physical connection will verify that the
vatID is indeed the hash of the public key of the remote vat,
and that the other end of the connection holds the associated private
key.searchList
- is a list of Strings each of which is the IP
address and port number of a place to look for the remote vat.
The IP address can be a DNS name or a dot repsentation of the
32 bit IP number. Most commonly, the Strings will be the
location of the Vat Location Servers (VLSs) with which the
remote vat is believed to register. It may be useful under
special circumstances to include the actual address where the
remote vat may be listening in the list.
public VatTPConnection optConnection(String vatID)
private void listState(Enumeration enum, StringBuffer buf)
enum
- is the Enumeration to list. The elements produced should
be either DataConnections or DataPaths.buf
- is a StringBuffer to fill with the list.private int moveIdentifiedPath(DataPath path, String remoteVatID, boolean isIncoming) throws IOException
path
- is the DataPath object which has been identified.remoteVatID
- is the identified remote vat's vatID.isIncoming
- says whether this is an incoming connection (true)
or an outgoing connection (false).
IOException
int newConnectionIdentified(DataPath path, String remoteVatID, String localVatID, boolean isIncoming) throws IOException
path
- the new DataPathremoteVatID
- is the vat ID of the remote vat.localVatID
- is the vat ID of this vat.isIncoming
- is true if this is an inbound connection, false if
it is an outbound connection.
IOException
void newInboundSocket(Socket socket)
socket
- is the new inbound socket object, just as received by
the listen operation.void noticeProblem(Throwable error)
error
- the Throwable which represents the error.public void addNewConnectionReactor(NewConnectionReactor reactor) throws IOException
This notification is for all DataConnections, whether the connection was initiated from this end or from the other end.
reactor
- is an object which implements
NewConnectionReactor.
IOException
- is thrown if there is already a reactor
registered.private VatTPConnection removeDataConnection(String vatID)
vatID
- is the vatID of the remote vat.
private String removeDieing(VatTPConnection dc)
private VatTPConnection removeIdentified(String regID)
regID
- is the VatID to remove.private VatTPConnection removeSuspended(String regID)
regID
- is the VatID to remove.private VatTPConnection removeSuspending(String regID)
regID
- is the VatID to remove.private Object removeUnidentified(DataPath path)
public NetConfig getNetConfig()
public ConstList searchPath()
public void setVatLocationLookup(VatLocationLookup vls)
vls
- The VLS objectvoid startupSuccessful(VatTPConnection connection, String remoteVatID, boolean isResuming)
connection
- The VatTPConnection which is now in RUNNING state.remoteVatID
- is the vatID of the remote vat.isResuming
- is true if this connection is resuming, false if
it is starting.public String toString()
toString
in class Object
void unidentifiedConnectionDied(DataPath path, String msg, Throwable problem)
path
- is the DataPath object whose connection has died.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |