org.mule.impl.model.seda.optimised
Class OptimisedMuleProxy

java.lang.Object
  extended byorg.mule.impl.model.seda.optimised.OptimisedMuleProxy
All Implemented Interfaces:
Disposable, Lifecycle, MuleProxy, Runnable, Startable, Stoppable, Work

public class OptimisedMuleProxy
extends Object
implements MuleProxy

MuleProxy is a proxy to a UMO. It is a poolable object that can be executed in its own thread.


Constructor Summary
OptimisedMuleProxy(Callable component, MuleDescriptor descriptor, ObjectPool proxyPool)
          Constructs a Proxy using the UMO's AbstractMessageDispatcher and the UMO itself
 
Method Summary
 void dispose()
          A lifecycle method where implementor should free up any resources.
 UMOImmutableDescriptor getDescriptor()
           
 ComponentStatistics getStatistics()
           
 void handleException(Exception exception)
          When an exception occurs this method can be called to invoke the configured UMOExceptionStrategy on the UMO
protected  UMOMessage invokeUmo(UMOEventContext context)
           
 boolean isStarted()
           
 boolean isSuspended()
          Determines if the proxy is suspended
 Object onCall(UMOEvent event)
          Makes a synchronous call on the UMO
 void onEvent(QueueSession session, UMOEvent event)
          Sets the current event being processed
 void release()
           
 void resume()
          Triggers the UMO to resume processing of events if it is suspended
 void run()
           
 void setStatistics(ComponentStatistics stat)
           
 void start()
           
 void stop()
           
 void suspend()
          Controls the suspension of the UMO event processing
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OptimisedMuleProxy

public OptimisedMuleProxy(Callable component,
                          MuleDescriptor descriptor,
                          ObjectPool proxyPool)
                   throws UMOException
Constructs a Proxy using the UMO's AbstractMessageDispatcher and the UMO itself

Parameters:
component - the underlying object that with receive events
descriptor - the UMOComponent descriptor associated with the component
Method Detail

start

public void start()
           throws UMOException
Specified by:
start in interface Startable
Throws:
UMOException

isStarted

public boolean isStarted()

stop

public void stop()
          throws UMOException
Specified by:
stop in interface Stoppable
Throws:
UMOException

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

onEvent

public void onEvent(QueueSession session,
                    UMOEvent event)
Sets the current event being processed

Specified by:
onEvent in interface MuleProxy
Parameters:
event - the event being processed

getStatistics

public ComponentStatistics getStatistics()
Specified by:
getStatistics in interface MuleProxy

setStatistics

public void setStatistics(ComponentStatistics stat)
Specified by:
setStatistics in interface MuleProxy

onCall

public Object onCall(UMOEvent event)
              throws UMOException
Makes a synchronous call on the UMO

Specified by:
onCall in interface MuleProxy
Parameters:
event - the event to pass to the UMO
Returns:
the return event from the UMO
Throws:
UMOException - if the call fails

invokeUmo

protected UMOMessage invokeUmo(UMOEventContext context)
                        throws Exception
Throws:
Exception

handleException

public void handleException(Exception exception)
When an exception occurs this method can be called to invoke the configured UMOExceptionStrategy on the UMO

Specified by:
handleException in interface MuleProxy
Parameters:
exception - If the UMOExceptionStrategy implementation fails

toString

public String toString()

isSuspended

public boolean isSuspended()
Determines if the proxy is suspended

Specified by:
isSuspended in interface MuleProxy
Returns:
true if the proxy (and the UMO) are suspended

suspend

public void suspend()
Controls the suspension of the UMO event processing

Specified by:
suspend in interface MuleProxy

resume

public void resume()
Triggers the UMO to resume processing of events if it is suspended

Specified by:
resume in interface MuleProxy

run

public void run()
Specified by:
run in interface Runnable

release

public void release()
Specified by:
release in interface Work

getDescriptor

public UMOImmutableDescriptor getDescriptor()
Specified by:
getDescriptor in interface MuleProxy


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