|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
jBittorrentAPI.MessageSender
public class MessageSender
Thread created to send message to the remote peer. Hold a queue for outgoing messages
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
private javax.swing.event.EventListenerList |
listeners
|
private long |
lmst
|
private java.io.OutputStream |
os
|
private java.util.concurrent.LinkedBlockingQueue<Message> |
outgoingMessage
|
private boolean |
run
|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
MessageSender(java.lang.String id,
java.io.OutputStream os)
|
Method Summary | |
---|---|
void |
addMessageToQueue(Message m)
Puts the message in parameter in the queue, waiting to be sent |
void |
addOutgoingListener(OutgoingListener listener)
|
protected void |
fireConnectionClosed()
Called when the connection to the peer has been closed. |
protected void |
fireKeepAliveSent()
Called when a keep-alive message has been sent. |
OutgoingListener[] |
getOutgoingListeners()
|
void |
removeOutgoingListener(OutgoingListener listener)
|
void |
run()
Sends messages from the queue. |
void |
stopThread()
Sets the 'run' variable to false, causing the thread to stop on its next loop. |
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, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private final javax.swing.event.EventListenerList listeners
private long lmst
private java.io.OutputStream os
private java.util.concurrent.LinkedBlockingQueue<Message> outgoingMessage
private boolean run
Constructor Detail |
---|
public MessageSender(java.lang.String id, java.io.OutputStream os)
Method Detail |
---|
public void addMessageToQueue(Message m)
m
- Messagepublic void addOutgoingListener(OutgoingListener listener)
protected void fireConnectionClosed()
protected void fireKeepAliveSent()
public OutgoingListener[] getOutgoingListeners()
public void removeOutgoingListener(OutgoingListener listener)
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void stopThread()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |