org.openarchitectureware.debug.communication
Class PacketSender

java.lang.Object
  extended by org.openarchitectureware.debug.communication.PacketSender
All Implemented Interfaces:
java.lang.Runnable

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

This Runnable sends packets out asynchroniously as they arrive from customers.

Author:
Clemens Kadura (zAJKa)

Method Summary
 void close()
          stop the sender thread.
static PacketSender newPacketSender(Connection connection)
          create a new instance and starts the runnable in a new thread
 void run()
           
 int sendPacket(AbstractPacket packet)
          Add a packet to be sent to the other side.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newPacketSender

public static PacketSender newPacketSender(Connection connection)
create a new instance and starts the runnable in a new thread

Parameters:
connection - the Connection that controls this data receiver.
Returns:
the instance

sendPacket

public int sendPacket(AbstractPacket packet)
               throws java.io.InterruptedIOException
Add a packet to be sent to the other side.

Parameters:
packet - the packet
Returns:
the packet id after it was sent
Throws:
java.io.InterruptedIOException

close

public void close()
stop the sender thread.


run

public void run()
Specified by:
run in interface java.lang.Runnable