org.mule.providers.tcp
Class TcpMessageReceiver.TcpWorker

java.lang.Object
  extended byorg.mule.providers.AbstractReceiverWorker
      extended byorg.mule.providers.AbstractReceiverResourceWorker
          extended byorg.mule.providers.tcp.TcpMessageReceiver.TcpWorker
All Implemented Interfaces:
Disposable, Runnable, Work
Direct Known Subclasses:
TcpMessageReceiver.TcpStreamWorker
Enclosing class:
TcpMessageReceiver

protected class TcpMessageReceiver.TcpWorker
extends AbstractReceiverResourceWorker
implements Disposable


Field Summary
protected  AtomicBoolean closed
           
protected  InputStream dataIn
           
protected  OutputStream dataOut
           
protected  TcpProtocol protocol
           
protected  Socket socket
           
 
Fields inherited from class org.mule.providers.AbstractReceiverResourceWorker
resource
 
Fields inherited from class org.mule.providers.AbstractReceiverWorker
endpoint, messages, out, receiver
 
Constructor Summary
TcpMessageReceiver.TcpWorker(Object resource, AbstractMessageReceiver receiver)
           
 
Method Summary
protected  void bindTransaction(UMOTransaction tx)
          Template method used to bind the resources of this receiver to the transaction.
 void dispose()
          A lifecycle method where implementor should free up any resources.
protected  Object getNextMessage(Object resource)
          The method used to read the next message from the underlying transport.
protected  void handleResults(List messages)
          When Mule has finished processing the current messages, there may be zero or more messages to process by the receiver if request/response messaging is being used.
protected  Object processData(Object data)
           
 void release()
          This method is called once this worker is no longer required.
 
Methods inherited from class org.mule.providers.AbstractReceiverResourceWorker
doRun
 
Methods inherited from class org.mule.providers.AbstractReceiverWorker
handleException, postProcessMessage, preProcessMessage, preRouteMuleMessage, run
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

socket

protected Socket socket

dataIn

protected InputStream dataIn

dataOut

protected OutputStream dataOut

closed

protected AtomicBoolean closed

protocol

protected TcpProtocol protocol
Constructor Detail

TcpMessageReceiver.TcpWorker

public TcpMessageReceiver.TcpWorker(Object resource,
                                    AbstractMessageReceiver receiver)
                             throws IOException
Method Detail

dispose

public void dispose()
Description copied from interface: Disposable
A lifecycle method where implementor should free up any resources. If an exception is thrown it should just be logged and processing should continue. This method should not throw Runtime exceptions.

Specified by:
dispose in interface Disposable

release

public void release()
Description copied from class: AbstractReceiverWorker
This method is called once this worker is no longer required. Any resources *only* associated with this worker should be cleaned up here.

Specified by:
release in interface Work
Overrides:
release in class AbstractReceiverWorker

bindTransaction

protected void bindTransaction(UMOTransaction tx)
                        throws TransactionException
Description copied from class: AbstractReceiverWorker
Template method used to bind the resources of this receiver to the transaction. Only transactional transports need implment this method

Specified by:
bindTransaction in class AbstractReceiverWorker
Parameters:
tx - the current transaction or null if there is no transaction
Throws:
TransactionException

getNextMessage

protected Object getNextMessage(Object resource)
                         throws Exception
Description copied from class: AbstractReceiverResourceWorker
The method used to read the next message from the underlying transport.

Specified by:
getNextMessage in class AbstractReceiverResourceWorker
Parameters:
resource - the resource to read from, this may be a socket, a directory or some higher level representation.
Returns:
the message read from the resource. This can be raw data such as a byte[] or a UMOMessageAdapter.
Throws:
Exception

handleResults

protected void handleResults(List messages)
                      throws Exception
Description copied from class: AbstractReceiverWorker
When Mule has finished processing the current messages, there may be zero or more messages to process by the receiver if request/response messaging is being used. The result(s) should be passed back to the callee.

Overrides:
handleResults in class AbstractReceiverWorker
Parameters:
messages - a list of messages. This argument will not be null
Throws:
Exception

processData

protected Object processData(Object data)
                      throws Exception
Throws:
Exception


Copyright © 2003-2008 MuleSource, Inc.. All Rights Reserved.