|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
edu.jas.util.TaggedSocketChannel
public class TaggedSocketChannel
TaggedSocketChannel provides a communication channel with message tags for Java objects using TCP/IP sockets.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
protected java.util.Map<java.lang.Integer,java.util.concurrent.BlockingQueue> |
queues
Queues for each message tag. |
protected SocketChannel |
sc
Underlying socket channel. |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
TaggedSocketChannel(SocketChannel s)
Constructs a tagged socket channel on the given socket channel s. |
Method Summary | |
---|---|
void |
close()
Closes the channel. |
SocketChannel |
getSocket()
Get the SocketChannel |
void |
init()
thread initialization and start. |
int |
messages()
Number of messages. |
java.lang.Object |
receive(java.lang.Integer tag)
Receive an object. |
void |
run()
Run receive() in an infinite loop. |
void |
send(java.lang.Integer tag,
java.lang.Object v)
Sends an object. |
int |
tagSize()
Number of tags. |
void |
terminate()
Terminate the TaggedSocketChannel. |
java.lang.String |
toString()
To string. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final SocketChannel sc
protected final java.util.Map<java.lang.Integer,java.util.concurrent.BlockingQueue> queues
Constructor Detail |
---|
public TaggedSocketChannel(SocketChannel s)
s
- A socket channel object.Method Detail |
---|
public void init()
public SocketChannel getSocket()
public void send(java.lang.Integer tag, java.lang.Object v) throws java.io.IOException
tag
- message tagv
- object to send
java.io.IOException
public java.lang.Object receive(java.lang.Integer tag) throws java.lang.InterruptedException, java.io.IOException, java.lang.ClassNotFoundException
tag
- message tag
java.lang.InterruptedException
java.io.IOException
java.lang.ClassNotFoundException
public void close()
public java.lang.String toString()
toString
in class java.lang.Thread
Thread.toString()
public int tagSize()
public int messages()
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
Thread.run()
public void terminate()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |