Class CommandDatagramSocket
java.lang.Object
org.apache.activemq.transport.udp.CommandChannelSupport
org.apache.activemq.transport.udp.CommandDatagramSocket
- All Implemented Interfaces:
Service,Replayer,CommandChannel
A strategy for reading datagrams and de-fragmenting them together.
-
Field Summary
Fields inherited from class org.apache.activemq.transport.udp.CommandChannelSupport
datagramSize, headerMarshaller, name, replayAddress, sequenceGenerator, targetAddress, wireFormat -
Constructor Summary
ConstructorsConstructorDescriptionCommandDatagramSocket(UdpTransport transport, OpenWireFormat wireFormat, int datagramSize, SocketAddress targetAddress, DatagramHeaderMarshaller headerMarshaller, DatagramSocket channel) -
Method Summary
Modifier and TypeMethodDescriptionprotected ByteArrayOutputStreamprotected DatagramPacketintintread()protected intremaining(ByteArrayOutputStream buffer) voidsendBuffer(int commandId, Object buffer) Sends the given buffer back to the transport if the buffer could be found - otherwise maybe send some kind of exceptionprotected voidsendWriteBuffer(int commandId, SocketAddress address, byte[] data, boolean redelivery) protected voidsendWriteBuffer(SocketAddress address, ByteArrayOutputStream writeBuffer, int commandId) voidsetDatagramSize(int datagramSize) Sets the default size of a datagram on the network.voidstart()voidstop()voidwrite(Command command, SocketAddress address) Methods inherited from class org.apache.activemq.transport.udp.CommandChannelSupport
getHeaderMarshaller, getReplayAddress, getReplayBuffer, getTargetAddress, setHeaderMarshaller, setReplayAddress, setReplayBuffer, setTargetAddress, toString, write
-
Constructor Details
-
CommandDatagramSocket
public CommandDatagramSocket(UdpTransport transport, OpenWireFormat wireFormat, int datagramSize, SocketAddress targetAddress, DatagramHeaderMarshaller headerMarshaller, DatagramSocket channel)
-
-
Method Details
-
start
- Throws:
Exception
-
stop
- Throws:
Exception
-
read
- Throws:
IOException
-
write
- Throws:
IOException
-
getDatagramSize
public int getDatagramSize()- Specified by:
getDatagramSizein interfaceCommandChannel- Overrides:
getDatagramSizein classCommandChannelSupport
-
setDatagramSize
public void setDatagramSize(int datagramSize) Description copied from class:CommandChannelSupportSets the default size of a datagram on the network.- Specified by:
setDatagramSizein interfaceCommandChannel- Overrides:
setDatagramSizein classCommandChannelSupport
-
sendWriteBuffer
protected void sendWriteBuffer(SocketAddress address, ByteArrayOutputStream writeBuffer, int commandId) throws IOException - Throws:
IOException
-
sendWriteBuffer
protected void sendWriteBuffer(int commandId, SocketAddress address, byte[] data, boolean redelivery) throws IOException - Throws:
IOException
-
sendBuffer
Description copied from interface:ReplayerSends the given buffer back to the transport if the buffer could be found - otherwise maybe send some kind of exception- Parameters:
commandId- the command IDbuffer- the buffer to be sent - or null if the buffer no longer exists in the buffer- Throws:
IOException
-
createDatagramPacket
-
remaining
-
createByteArrayOutputStream
-
getReceiveCounter
public int getReceiveCounter()
-