org.mule.transport.tcp
Class TcpMessageReceiver.TcpWorker

java.lang.Object
  extended by org.mule.transport.AbstractReceiverWorker
      extended by org.mule.transport.AbstractReceiverResourceWorker
          extended by org.mule.transport.tcp.TcpMessageReceiver.TcpWorker
All Implemented Interfaces:
Runnable, javax.resource.spi.work.Work, Disposable, Expirable
Direct Known Subclasses:
ExceptionReturnTcpMessageReceiver.TcpWorker, SslMessageReceiver.SslWorker
Enclosing class:
TcpMessageReceiver

protected class TcpMessageReceiver.TcpWorker
extends AbstractReceiverResourceWorker
implements Disposable, Expirable


Field Summary
protected  TcpInputStream dataIn
           
protected  boolean dataInWorkFinished
           
protected  OutputStream dataOut
           
protected  Object notify
           
protected  TcpProtocol protocol
           
protected  Socket socket
           
protected  InputStream underlyingIn
           
 
Fields inherited from class org.mule.transport.AbstractReceiverResourceWorker
resource
 
Fields inherited from class org.mule.transport.AbstractReceiverWorker
endpoint, messages, out, receiver
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Constructor Summary
TcpMessageReceiver.TcpWorker(Socket socket, AbstractMessageReceiver receiver)
           
 
Method Summary
protected  void bindTransaction(Transaction 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.
 void expired()
           
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  boolean hasMoreMessages(Object message)
           
protected  void preRouteMuleMessage(MuleMessage message)
          This callback is called before a message is routed into Mule and can be used by the worker to set connection specific properties to message before it gets routed
 void release()
          This method is called once this worker is no longer required.
protected  void shutdownSocket()
           
 
Methods inherited from class org.mule.transport.AbstractReceiverResourceWorker
doRun
 
Methods inherited from class org.mule.transport.AbstractReceiverWorker
handleEventResults, postProcessMessage, preProcessMessage, processMessages, 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 TcpInputStream dataIn

underlyingIn

protected InputStream underlyingIn

dataOut

protected OutputStream dataOut

protocol

protected TcpProtocol protocol

dataInWorkFinished

protected boolean dataInWorkFinished

notify

protected Object notify
Constructor Detail

TcpMessageReceiver.TcpWorker

public TcpMessageReceiver.TcpWorker(Socket socket,
                                    AbstractMessageReceiver receiver)
                             throws IOException
Throws:
IOException
Method Detail

expired

public void expired()
Specified by:
expired in interface Expirable

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 javax.resource.spi.work.Work
Overrides:
release in class AbstractReceiverWorker

shutdownSocket

protected void shutdownSocket()
                       throws IOException
Throws:
IOException

bindTransaction

protected void bindTransaction(Transaction 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[].
Throws:
Exception

hasMoreMessages

protected boolean hasMoreMessages(Object message)
Overrides:
hasMoreMessages in class AbstractReceiverResourceWorker

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

preRouteMuleMessage

protected void preRouteMuleMessage(MuleMessage message)
                            throws Exception
Description copied from class: AbstractReceiverWorker
This callback is called before a message is routed into Mule and can be used by the worker to set connection specific properties to message before it gets routed

Overrides:
preRouteMuleMessage in class AbstractReceiverWorker
Parameters:
message - the next message to be processed
Throws:
Exception


Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.