net.sf.neem.impl
Class Transport

java.lang.Object
  extended by net.sf.neem.impl.Transport
All Implemented Interfaces:
java.lang.Runnable

public class Transport
extends java.lang.Object
implements java.lang.Runnable

Implementation of the network layer.


Field Summary
 int accepted
           
 int bytesIn
           
 int bytesOut
           
 int connected
           
 int pktIn
           
 int pktOut
           
 
Constructor Summary
Transport(java.util.Random rand, java.net.InetSocketAddress local)
           
 
Method Summary
 void add(java.net.InetSocketAddress addr)
          Initiate connection to peer.
 void close()
          Close all socket connections and release polling thread.
 Connection[] connections()
          Get all connections.
 void gc()
          Call periodically to garbage collect idle connections.
 int getBufferSize()
           
 java.net.InetSocketAddress getLocalSocketAddress()
          Get local address.
 java.net.InetSocketAddress[] getPeers()
          Get addresses of all connected peers.
 int getQueueSize()
           
 void queue(java.lang.Runnable task)
          Queue processing task.
 void resetCounters()
           
 void run()
          Main loop.
 void schedule(java.lang.Runnable task, long delay)
          Schedule processing task.
 void setBufferSize(int bufferSize)
           
 void setConnectionListener(ConnectionListener handler)
          Sets the reference to the connection handler.
 void setDataListener(DataListener handler, short port)
          Add a reference to a message handler.
 void setQueueSize(int queueSize)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

accepted

public int accepted

connected

public int connected

pktOut

public int pktOut

pktIn

public int pktIn

bytesOut

public int bytesOut

bytesIn

public int bytesIn
Constructor Detail

Transport

public Transport(java.util.Random rand,
                 java.net.InetSocketAddress local)
          throws java.io.IOException,
                 java.net.BindException
Throws:
java.io.IOException
java.net.BindException
Method Detail

getLocalSocketAddress

public java.net.InetSocketAddress getLocalSocketAddress()
Get local address.


connections

public Connection[] connections()
Get all connections.


getPeers

public java.net.InetSocketAddress[] getPeers()
Get addresses of all connected peers.


gc

public void gc()
Call periodically to garbage collect idle connections.


close

public void close()
Close all socket connections and release polling thread.


queue

public void queue(java.lang.Runnable task)
Queue processing task.


schedule

public void schedule(java.lang.Runnable task,
                     long delay)
Schedule processing task.

Parameters:
delay - delay before execution

add

public void add(java.net.InetSocketAddress addr)
Initiate connection to peer. This is effective only after the open callback.


setDataListener

public void setDataListener(DataListener handler,
                            short port)
Add a reference to a message handler.


setConnectionListener

public void setConnectionListener(ConnectionListener handler)
Sets the reference to the connection handler.


run

public void run()
Main loop.

Specified by:
run in interface java.lang.Runnable

getQueueSize

public int getQueueSize()

setQueueSize

public void setQueueSize(int queueSize)

getBufferSize

public int getBufferSize()

setBufferSize

public void setBufferSize(int bufferSize)

resetCounters

public void resetCounters()


Copyright © 2005 University of Minho, Portugal. All Rights Reserved.