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

Quick Search    Search Deep

Freenet
Class ConnectionHandler  view ConnectionHandler download ConnectionHandler.java

java.lang.Object
  extended byjava.lang.Thread
      extended byFreenet.ConnectionHandler
All Implemented Interfaces:
java.lang.Runnable

public class ConnectionHandler
extends java.lang.Thread

Handles both sending and receiving messages on a connection.


Nested Class Summary
protected  class ConnectionHandler.ConnectionCB
           
 
Nested classes inherited from class java.lang.Thread
java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private  Connection c
           
private  boolean closed
           
private  long id
           
private static long ids
           
private  MessageHandler mh
           
private  java.lang.Long pongs
           
private  boolean waiting
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ConnectionHandler(Connection c, MessageHandler mh)
           
 
Method Summary
 void close()
           
 void forceClose()
          forces this connection to close.
 boolean isOpen()
          Checks whether the connection is alive
 Address local()
           
 Address local(ListeningAddress laddr)
           
 Address peer()
           
 Address peer(ListeningAddress laddr)
           
 void run()
          The method of Thread that will be run if there is no Runnable object associated with the Thread.
 void sendMessage(Message m)
          Sends a message using this connection
 void sendMessage(Message m, Freenet.support.SplitOutputStream datatunnel, Freenet.support.ByteCounter count)
          Sends a message using this connection
 
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

ids

private static long ids

id

private long id

c

private Connection c

mh

private MessageHandler mh

pongs

private volatile java.lang.Long pongs

closed

private boolean closed

waiting

private boolean waiting
Constructor Detail

ConnectionHandler

public ConnectionHandler(Connection c,
                         MessageHandler mh)
Method Detail

run

public void run()
Description copied from class: java.lang.Thread
The method of Thread that will be run if there is no Runnable object associated with the Thread. Thread's implementation does nothing at all.


sendMessage

public void sendMessage(Message m)
                 throws SendFailedException
Sends a message using this connection


sendMessage

public void sendMessage(Message m,
                        Freenet.support.SplitOutputStream datatunnel,
                        Freenet.support.ByteCounter count)
                 throws SendFailedException
Sends a message using this connection


close

public void close()

forceClose

public void forceClose()
forces this connection to close. Bad things will happen if you use this carelessly.


isOpen

public boolean isOpen()
Checks whether the connection is alive


peer

public Address peer()

peer

public Address peer(ListeningAddress laddr)

local

public Address local()

local

public Address local(ListeningAddress laddr)