org.activemq.transport.udp
Class UdpTransportChannel

java.lang.Object
  extended by org.activemq.transport.TransportChannelSupport
      extended by org.activemq.transport.udp.UdpTransportChannel
All Implemented Interfaces:
Runnable, Service, TransportChannel
Direct Known Subclasses:
MulticastTransportChannel

public class UdpTransportChannel
extends TransportChannelSupport
implements Runnable

A UDP implementation of a TransportChannel

Version:
$Revision: 1.1.1.1 $

Field Summary
protected  InetAddress inetAddress
           
protected  int port
           
protected  DatagramSocket socket
           
 
Fields inherited from class org.activemq.transport.TransportChannelSupport
cachingEnabled, currentWireFormat, noDelay, pendingStop, transportConnected, usedInternally
 
Constructor Summary
protected UdpTransportChannel(WireFormat wireFormat)
          Construct basic helpers
  UdpTransportChannel(WireFormat wireFormat, DatagramSocket socket)
           
  UdpTransportChannel(WireFormat wireFormat, DatagramSocket socket, int port)
           
  UdpTransportChannel(WireFormat wireFormat, URI remoteLocation)
           
  UdpTransportChannel(WireFormat wireFormat, URI remoteLocation, int port)
           
 
Method Summary
 void asyncSend(Packet packet)
          Asynchronously send a Packet
 boolean canProcessWireFormatVersion(int version)
          Can this wireformat process packets of this version
protected  void connect()
           
protected  DatagramPacket createDatagramPacket()
           
protected  DatagramPacket createDatagramPacket(Packet packet)
           
protected  DatagramSocket createSocket(int port)
           
 void forceDisconnect()
          Forces an immediate transport-level disconnect which will be asynchronously reported as an exception to the exceptionListener.
 int getCurrentWireFormatVersion()
           
 boolean isMulticast()
           
 void run()
          reads packets from a Socket
 void start()
          start listeneing for events
 void stop()
          close the channel
 String toString()
          pretty print for object
 
Methods inherited from class org.activemq.transport.TransportChannelSupport
addTransportStatusEventListener, asyncSendWithReceipt, doAsyncSend, doConsumePacket, doConsumePacket, doesSupportMessageCompression, doesSupportMessageFragmentation, doesSupportWireFormatVersioning, doHandleReceipt, doHandleWireFormat, fireStatusEvent, fireStatusEvent, getClientID, getEmbeddedBrokerConnector, getExceptionListener, getLastReceiptTimestamp, getPacketListener, getTransportChannelListener, getWireFormat, isCachingEnabled, isNoDelay, isPendingStop, isServerSide, isTransportConnected, isUsedInternally, onAsyncException, removeTransportStatusEventListener, requiresEmbeddedBroker, send, send, setCachingEnabled, setClientID, setExceptionListener, setNoDelay, setPacketListener, setPendingStop, setServerSide, setTransportChannelListener, setTransportConnected, setUsedInternally, setWireFormat, stopExecutor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

socket

protected DatagramSocket socket

port

protected int port

inetAddress

protected InetAddress inetAddress
Constructor Detail

UdpTransportChannel

protected UdpTransportChannel(WireFormat wireFormat)
Construct basic helpers


UdpTransportChannel

public UdpTransportChannel(WireFormat wireFormat,
                           URI remoteLocation)
                    throws JMSException
Throws:
JMSException

UdpTransportChannel

public UdpTransportChannel(WireFormat wireFormat,
                           URI remoteLocation,
                           int port)
                    throws JMSException
Throws:
JMSException

UdpTransportChannel

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

UdpTransportChannel

public UdpTransportChannel(WireFormat wireFormat,
                           DatagramSocket socket,
                           int port)
                    throws JMSException
Throws:
JMSException
Method Detail

stop

public void stop()
close the channel

Specified by:
stop in interface Service
Specified by:
stop in interface TransportChannel
Overrides:
stop in class TransportChannelSupport

forceDisconnect

public void forceDisconnect()
Description copied from interface: TransportChannel
Forces an immediate transport-level disconnect which will be asynchronously reported as an exception to the exceptionListener. If the channel isn't connected, the call will be ignored.

Specified by:
forceDisconnect in interface TransportChannel

start

public void start()
           throws JMSException
start listeneing for events

Specified by:
start in interface Service
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
Overrides:
isMulticast in class TransportChannelSupport
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 Runnable

canProcessWireFormatVersion

public boolean canProcessWireFormatVersion(int version)
Can this wireformat process packets of this version

Specified by:
canProcessWireFormatVersion in interface TransportChannel
Overrides:
canProcessWireFormatVersion in class TransportChannelSupport
Parameters:
version - the version number to test
Returns:
true if can accept the version

getCurrentWireFormatVersion

public int getCurrentWireFormatVersion()
Specified by:
getCurrentWireFormatVersion in interface TransportChannel
Overrides:
getCurrentWireFormatVersion in class TransportChannelSupport
Returns:
the current version of this wire format

createDatagramPacket

protected DatagramPacket createDatagramPacket()
Returns:

createDatagramPacket

protected DatagramPacket createDatagramPacket(Packet packet)
                                       throws IOException,
                                              JMSException
Throws:
IOException
JMSException

connect

protected void connect()
                throws IOException
Throws:
IOException

createSocket

protected DatagramSocket createSocket(int port)
                               throws IOException
Throws:
IOException

toString

public String toString()
pretty print for object

Overrides:
toString in class Object
Returns:
String representation of this object


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