org.codehaus.activemq.transport.udp
Class UdpTransportChannel

java.lang.Object
  extended byorg.codehaus.activemq.transport.AbstractTransportChannel
      extended byorg.codehaus.activemq.transport.udp.UdpTransportChannel
All Implemented Interfaces:
java.lang.Runnable, Service, TransportChannel
Direct Known Subclasses:
MulticastTransportChannel

public class UdpTransportChannel
extends AbstractTransportChannel
implements java.lang.Runnable

A UDP implementation of a TransportChannel

Version:
$Revision: 1.19 $

Field Summary
protected  java.net.InetAddress inetAddress
           
protected  int port
           
protected  java.net.DatagramSocket socket
           
 
Constructor Summary
protected UdpTransportChannel(WireFormat wireFormat)
          Construct basic helpers
  UdpTransportChannel(WireFormat wireFormat, java.net.DatagramSocket socket)
           
  UdpTransportChannel(WireFormat wireFormat, java.net.DatagramSocket socket, int port)
           
  UdpTransportChannel(WireFormat wireFormat, java.net.URI remoteLocation)
           
  UdpTransportChannel(WireFormat wireFormat, java.net.URI remoteLocation, int port)
           
 
Method Summary
 void asyncSend(Packet packet)
          Asynchronously send a Packet
protected  void connect()
           
protected  java.net.DatagramPacket createDatagramPacket()
           
protected  java.net.DatagramPacket createDatagramPacket(Packet packet)
           
protected  java.net.DatagramSocket createSocket(int port)
           
 boolean isMulticast()
           
 void run()
          reads packets from a Socket
 void start()
          start listeneing for events
 void stop()
          close the channel
 java.lang.String toString()
          pretty print for object
 
Methods inherited from class org.codehaus.activemq.transport.AbstractTransportChannel
addTransportStatusEventListener, doAsyncSend, doConsumePacket, doHandleReceipt, fireStatusEvent, fireStatusEvent, getClientID, getExceptionListener, getPacketListener, getTransportChannelListener, onAsyncException, removeTransportStatusEventListener, send, send, setClientID, setExceptionListener, setPacketListener, setTransportChannelListener, stopExecutor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

socket

protected java.net.DatagramSocket socket

port

protected int port

inetAddress

protected java.net.InetAddress inetAddress
Constructor Detail

UdpTransportChannel

protected UdpTransportChannel(WireFormat wireFormat)
Construct basic helpers


UdpTransportChannel

public UdpTransportChannel(WireFormat wireFormat,
                           java.net.URI remoteLocation)
                    throws JMSException

UdpTransportChannel

public UdpTransportChannel(WireFormat wireFormat,
                           java.net.URI remoteLocation,
                           int port)
                    throws JMSException

UdpTransportChannel

public UdpTransportChannel(WireFormat wireFormat,
                           java.net.DatagramSocket socket)
                    throws JMSException
Parameters:
socket -
Throws:
JMSException

UdpTransportChannel

public UdpTransportChannel(WireFormat wireFormat,
                           java.net.DatagramSocket socket,
                           int port)
                    throws JMSException
Method Detail

stop

public void stop()
close the channel

Specified by:
stop in interface TransportChannel
Overrides:
stop in class AbstractTransportChannel

start

public void start()
           throws JMSException
start listeneing for events

Specified by:
start in interface TransportChannel
Throws:
JMSException - if an error occurs

asyncSend

public void asyncSend(Packet packet)
               throws JMSException
Asynchronously send a Packet

Specified by:
asyncSend in interface TransportChannel
Parameters:
packet -
Throws:
JMSException

isMulticast

public boolean isMulticast()
Specified by:
isMulticast in interface TransportChannel
Returns:
true if this transport is multicast based (i.e. broadcasts to multiple nodes)

run

public void run()
reads packets from a Socket

Specified by:
run in interface java.lang.Runnable

createDatagramPacket

protected java.net.DatagramPacket createDatagramPacket()
Returns:

createDatagramPacket

protected java.net.DatagramPacket createDatagramPacket(Packet packet)
                                                throws java.io.IOException,
                                                       JMSException
Throws:
java.io.IOException
JMSException

connect

protected void connect()
                throws java.io.IOException
Throws:
java.io.IOException

createSocket

protected java.net.DatagramSocket createSocket(int port)
                                        throws java.io.IOException
Throws:
java.io.IOException

toString

public java.lang.String toString()
pretty print for object

Returns:
String representation of this object


Copyright © 2004 Protique, Ltd.. All Rights Reserved.