|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
lime.LimeTSMgr
The LimeTSMgr manages a LimeTupleSpace. It keeps track of whether the tuple space is locked in a transaction.
Field Summary | |
static java.lang.String |
AGENT
|
static short |
AGENT_BYE
|
static java.lang.String |
AGENT_GONE
|
static short |
AGENT_HELLO
|
static int |
AGENT_ID_TAG
|
static short |
AGENT_LOCALHOST
|
static short |
AGENT_NOTINSYS
|
static short |
AGENT_REMOTE
|
static short |
AGENT_UNSPECIFIED
|
static short |
DATA
|
static short |
DECLARE_LEADER
|
static short |
DISENGAGE_AGENT
|
static short |
DISENGAGE_HOST
|
static short |
ENGAGE_AGENT
|
static short |
ENGAGE_HOST
|
static short |
GO
|
static java.lang.String |
HOST
|
static int |
HOST_ADDR_TAG
|
static short |
HOST_BYE
|
static java.lang.String |
HOST_GONE
|
static short |
HOST_HELLO
|
static short |
HOST_LOCALHOST
|
static short |
HOST_NOTINSYS
|
static short |
HOST_REMOTE
|
static int |
HOST_TUPLE_HOST_TAG
|
static short |
HOST_UNSPECIFIED
|
(package private) Queue |
incomingEvents
|
(package private) Queue |
incomingOps
|
(package private) Queue |
incomingTransactionStarts
|
(package private) QueueWaiter |
incomingWaiter
|
static int |
INCOMMING_EVENTS_QUEUE
|
static int |
INCOMMING_OPS_QUEUE
|
static int |
INCOMMING_TRANSACTION_STARTS_QUEUE
|
static short |
ING
|
static short |
INITIATOR_REQ
|
static short |
INST_REACTS_TO
|
static short |
INST_REM_UPON_LISTENER
|
static short |
INST_UPON_LISTENER
|
(package private) boolean |
inTransaction
Indicates whether the tuple space is participating in a transaction. |
static short |
LOCAL_SYS_TAKE
|
static int |
MAX_ROUNDS
|
(package private) java.lang.String |
name
The name of the tuple space. |
(package private) static java.util.Hashtable |
namedTS
Holds tuple spaces keyed by their names. |
static short |
OUTG
|
(package private) java.util.Hashtable |
pendingWrite
Maps the sequence number to the TupleOpDescriptor. |
private long |
pendingWriteSeqNum
|
static short |
RDG
|
(package private) Reactor |
reactor
The local reactor. |
static short |
REACTS_TO
|
static short |
READ
|
static short |
READY
|
static short |
READY_SPECIAL
|
static short |
REM_ING
|
static short |
REM_OUTG
|
static short |
REM_OUTG_ACK
|
static short |
REM_RDG
|
static short |
REM_SYS_READ
|
static short |
REM_SYS_TAKE
|
static short |
REMOVE_REACTS_TO
|
static short |
REMOVE_REM_UPON_LISTENER
|
static short |
REMOVE_UPON
|
(package private) java.util.Hashtable |
replyTuples
Used for upon and reactions. |
static short |
REQUEST_TRANSACTION
|
(package private) java.util.Hashtable |
savedReactions
Used to reinstall the reaction of an upon of a waiting operation |
static short |
SET_HOST
|
static short |
SET_SHARED
|
static short |
SETUP
|
static short |
SETUP_SPECIAL
|
static short |
START
|
static short |
SYS_READ
|
static short |
SYS_REPLY
|
static short |
SYS_TAKE
|
(package private) static LimeSystemTSMgr |
sysMgr
The LimeSystemTupleSpace manager. |
static short |
TAKE
|
static short |
TRANSACTION_GRANTED
|
private Lock |
transactionLock
|
(package private) TransactionMgr |
transactionMgr
The transaction manager. |
static java.lang.String |
TS
|
static java.lang.String |
TS_GONE
|
static int |
TS_ID_TAG
|
(package private) lights.interfaces.ITupleSpace |
tupleSpace
A named tuple space. |
static int |
TYPE_TAG
|
static short |
UPON
|
static short |
UPON_EVENT
|
(package private) UponMgr |
upons
both pending and uninstalled upons... |
static java.lang.String |
VERSION
|
static short |
WAIT_TO_READ
|
static short |
WAIT_TO_TAKE
|
static short |
WRITE
|
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
(package private) |
LimeTSMgr(java.lang.String name,
boolean inTransaction)
|
Method Summary | |
private void |
doInstReactsTo(ReactionsOpDescriptor opDesc)
|
private void |
doInstRemUponListener(RemoteUponOpDescriptor opDesc)
|
private void |
doInstUponListener(ReactionsOpDescriptor opDesc)
When a set of upon reactions are to be installed, each individual reaction can be remote, local, or broadcast. |
(package private) void |
doRemOutg(RemoteTupleOpDescriptor opDesc,
boolean sendAck)
Put the tuple that comes from remotely into the tuple space. |
private void |
doRemOutgAck(RemoteTupleOpDescriptor opDesc)
|
private void |
doRemoveReactsTo(ReactionsOpDescriptor opDesc)
|
private void |
doRemoveRemUponListener(RemoteUponOpDescriptor opDesc)
|
private void |
doRemoveUpon(ReactionsOpDescriptor opDesc)
Uninstalling an array of upons has the same problem atomicity problmes as installing an array of reactions or upons. |
private void |
doRemSys(RemoteTupleOpDescriptor opDesc)
A read or take operation from a remote host is serviced and the result put into the outgoing queue to be returned to the agent that requested the operation in a SYS_REPLY (because by this point, whether the operation was a TAKE or READ doesn't matter. |
private void |
doSys(TupleOpDescriptor opDesc)
Perform a probing read or take. |
(package private) void |
doSysReply(RemoteTupleOpDescriptor opDesc)
A SysReply message is the actual tuple being returned from the remote system. |
private void |
doUponEvent(RemoteUponOpDescriptor opDesc)
An UponEvent is a messages that arrives from a remote system when an upon fires. |
(package private) void |
doWait(TupleOpDescriptor opDesc)
Waiting operations can either be for a specific host or for any host. |
private void |
doWrite(TupleOpDescriptor opDesc)
'doWrite' perform the local write operation or put the tuple in the outgoing queue |
private void |
generateRemoteSysReq(TupleOpDescriptor opDesc,
lights.interfaces.ITuple opTemplate,
LimeServerID opDestination)
Make the reaction to go into the pendingUpon structure, and put the remote system take or read opeartion into the outgoing queue. |
(package private) static java.lang.String |
getOpType(short type)
Used for debugging purposes. |
(package private) RegisteredReaction[] |
getRemRegReactByAgent(AgentID subscriber)
|
(package private) Lock |
getTransactionLock()
|
(package private) void |
mergeMisplaced(java.util.Vector tuples,
java.util.Vector upons)
|
(package private) lights.interfaces.ITuple[] |
mergePrivateWithPublic(LimeTupleSpace lts)
Called from the Transaction manager to merge the upons/reactions of a private tuple space into the public space, and to return the tuples which are to be handed to the reactor when the transaction is complete |
private long |
newSeqNum()
Returns a new sequence number. |
(package private) void |
performOp(OpDescriptor opDesc)
|
(package private) void |
postOp(LocalOpDescriptor opDesc)
Places operations into the INCOMMING_OPS_QUEUE queue. |
(package private) void |
printMisplacedTuples(java.util.Vector t)
Used for debugging purposes. |
(package private) lights.interfaces.ITuple |
readOrTakeTuple(short type,
lights.interfaces.ITuple template)
read or take a tuple (based on the type passed) from the tuple space of this manager |
private OpDescriptor |
removeFirstElement(java.util.Vector v)
|
void |
run()
|
(package private) static lights.interfaces.ITuple[] |
takeTupleSpaceProjection(lights.interfaces.ITupleSpace ts,
AgentID[] agents,
int index)
Returns the set of tuples that represent a given projection of the tuple space. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, 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 |
public static final int INCOMMING_EVENTS_QUEUE
public static final int INCOMMING_OPS_QUEUE
public static final int INCOMMING_TRANSACTION_STARTS_QUEUE
static java.util.Hashtable namedTS
Queue incomingOps
Queue incomingEvents
Queue incomingTransactionStarts
QueueWaiter incomingWaiter
boolean inTransaction
private Lock transactionLock
TransactionMgr transactionMgr
static LimeSystemTSMgr sysMgr
lights.interfaces.ITupleSpace tupleSpace
Reactor reactor
java.util.Hashtable savedReactions
java.util.Hashtable replyTuples
java.util.Hashtable pendingWrite
java.lang.String name
UponMgr upons
private long pendingWriteSeqNum
public static final java.lang.String VERSION
public static final short WRITE
public static final short OUTG
public static final short REM_OUTG_ACK
public static final short TAKE
public static final short WAIT_TO_TAKE
public static final short ING
public static final short READ
public static final short WAIT_TO_READ
public static final short RDG
public static final short REACTS_TO
public static final short UPON
public static final short REMOVE_REACTS_TO
public static final short REMOVE_UPON
public static final short INST_REACTS_TO
public static final short INST_UPON_LISTENER
public static final short INST_REM_UPON_LISTENER
public static final short REMOVE_REM_UPON_LISTENER
public static final short REM_SYS_TAKE
public static final short REM_SYS_READ
public static final short REM_ING
public static final short REM_RDG
public static final short SYS_TAKE
public static final short SYS_READ
public static final short REM_OUTG
public static final short UPON_EVENT
public static final short SYS_REPLY
public static final short LOCAL_SYS_TAKE
public static final short SET_SHARED
public static final short SET_HOST
public static final short DECLARE_LEADER
public static final short ENGAGE_AGENT
public static final short ENGAGE_HOST
public static final short DISENGAGE_AGENT
public static final short DISENGAGE_HOST
public static final short GO
public static final short INITIATOR_REQ
public static final short SETUP
public static final short READY
public static final short START
public static final short DATA
public static final short SETUP_SPECIAL
public static final short READY_SPECIAL
public static final short REQUEST_TRANSACTION
public static final short TRANSACTION_GRANTED
public static final short HOST_BYE
public static final short HOST_HELLO
public static final short AGENT_BYE
public static final short AGENT_HELLO
public static final short HOST_LOCALHOST
public static final short HOST_REMOTE
public static final short HOST_NOTINSYS
public static final short HOST_UNSPECIFIED
public static final short AGENT_LOCALHOST
public static final short AGENT_REMOTE
public static final short AGENT_NOTINSYS
public static final short AGENT_UNSPECIFIED
public static final int TYPE_TAG
public static final int HOST_TUPLE_HOST_TAG
public static final int HOST_ADDR_TAG
public static final int AGENT_ID_TAG
public static final int TS_ID_TAG
public static final java.lang.String HOST
public static final java.lang.String AGENT
public static final java.lang.String TS
public static final java.lang.String HOST_GONE
public static final java.lang.String AGENT_GONE
public static final java.lang.String TS_GONE
public static final int MAX_ROUNDS
Constructor Detail |
LimeTSMgr(java.lang.String name, boolean inTransaction)
Method Detail |
private long newSeqNum()
public void run()
run
in interface java.lang.Runnable
void postOp(LocalOpDescriptor opDesc)
void performOp(OpDescriptor opDesc) throws lights.interfaces.TupleSpaceException, java.io.IOException
lights.interfaces.TupleSpaceException
java.io.IOException
private void doWrite(TupleOpDescriptor opDesc) throws lights.interfaces.TupleSpaceException
opDesc
- the operation containing the tuple to be written, no result
is given because an agent does not block on a write operation
lights.interfaces.TupleSpaceException
private void doSys(TupleOpDescriptor opDesc) throws lights.interfaces.TupleSpaceException
opDesc
- the SYS_TAKE or SYS_READ operation (or group) descriptor
lights.interfaces.TupleSpaceException
void doWait(TupleOpDescriptor opDesc) throws lights.interfaces.TupleSpaceException, java.io.IOException
opDesc
- the waiting operation to be performed
lights.interfaces.TupleSpaceException
java.io.IOException
private void doInstReactsTo(ReactionsOpDescriptor opDesc)
private void doInstUponListener(ReactionsOpDescriptor opDesc) throws lights.interfaces.TupleSpaceException
opDesc
- the description of the upons to be installed
lights.interfaces.TupleSpaceException
- if an error occursprivate void doRemoveReactsTo(ReactionsOpDescriptor opDesc)
private void doRemoveUpon(ReactionsOpDescriptor opDesc)
The open question is whether or not a partial uninstall of upons is acceptable. Since right now we are only uninstalling one at a time, this isn't an issue, but we will have to address this eventually.
opDesc
- a value of type 'ReactionsOpDescriptor'private void doUponEvent(RemoteUponOpDescriptor opDesc) throws lights.interfaces.TupleSpaceException
if the upon is no longer registered, then the upon has been deregistered. What happened is the following: The remote system generated this uponEvent before the deregistration arrived. In this case, just drop the event.
opDesc
- the description of the UponEvent
lights.interfaces.TupleSpaceException
- if an error occursvoid doSysReply(RemoteTupleOpDescriptor opDesc)
opDesc
- the returned remote opearation descriptor, containing the
tuple copy and sequence numberprivate void doRemSys(RemoteTupleOpDescriptor opDesc) throws lights.interfaces.TupleSpaceException
opDesc
- the remote opearation request
lights.interfaces.TupleSpaceException
- if an error occursvoid doRemOutg(RemoteTupleOpDescriptor opDesc, boolean sendAck) throws lights.interfaces.TupleSpaceException
opDesc
- the opearation containing the tuple to be writtensendAck
- if this method is called from a transaction, the ack should not be sent, otherwise the ack should be sent.
lights.interfaces.TupleSpaceException
- if an error occursprivate void doRemOutgAck(RemoteTupleOpDescriptor opDesc)
private void doInstRemUponListener(RemoteUponOpDescriptor opDesc) throws lights.interfaces.TupleSpaceException
lights.interfaces.TupleSpaceException
private void doRemoveRemUponListener(RemoteUponOpDescriptor opDesc)
private void generateRemoteSysReq(TupleOpDescriptor opDesc, lights.interfaces.ITuple opTemplate, LimeServerID opDestination) throws lights.interfaces.TupleSpaceException
opDesc
- a value of type 'TupleOpDescriptor'opTemplate
- the template of the tuple to be read or taken. Coule
be taken from the opDesc, but since we most likely have alread made the
method calls to extract this infromation by the time generateRemoteSysReq
is made, why not pass it as a parameter?opDestination
- the ip address where the operation is to be sent
lights.interfaces.TupleSpaceException
- if an error occurslights.interfaces.ITuple readOrTakeTuple(short type, lights.interfaces.ITuple template)
type
- WAIT_TO_READ, SYS_READ, REM_SYS_READ, or the corresponding
TAKE operationstemplate
- the template to mbe matched
static lights.interfaces.ITuple[] takeTupleSpaceProjection(lights.interfaces.ITupleSpace ts, AgentID[] agents, int index) throws TupleSpaceEngineException, lights.interfaces.TupleSpaceException
ts
- the tuple space to be searched for.agents
- the array of agents to look for.index
- the field index that must be matched.
TupleSpaceEngineException(tse)
TupleSpaceEngineException
lights.interfaces.TupleSpaceException
private OpDescriptor removeFirstElement(java.util.Vector v)
Lock getTransactionLock()
lights.interfaces.ITuple[] mergePrivateWithPublic(LimeTupleSpace lts) throws TupleSpaceEngineException
lts
- the previously public tuple space to be made public
TupleSpaceEngineException
void mergeMisplaced(java.util.Vector tuples, java.util.Vector upons) throws TupleSpaceEngineException
TupleSpaceEngineException
RegisteredReaction[] getRemRegReactByAgent(AgentID subscriber)
void printMisplacedTuples(java.util.Vector t)
static java.lang.String getOpType(short type)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |