org.mule.retry
Class DefaultRetryContext

java.lang.Object
  extended by org.mule.retry.DefaultRetryContext
All Implemented Interfaces:
MuleContextAware, RetryContext

public class DefaultRetryContext
extends Object
implements RetryContext, MuleContextAware

The RetryContext is used to store any data which carries over from attempt to attempt such as response messages.


Field Summary
 
Fields inherited from interface org.mule.api.retry.RetryContext
FAILED_DISPATCHER, FAILED_RECEIVER, FAILED_REQUESTER
 
Constructor Summary
DefaultRetryContext(String description, Map<Object,Object> metaInfo)
           
 
Method Summary
 void addReturnMessage(MuleMessage result)
           
 String getDescription()
           
 MuleMessage getFirstReturnMessage()
           
 Throwable getLastFailure()
          The most recent failure which prevented the context from validating the connection.
 Map<Object,Object> getMetaInfo()
           
 MuleContext getMuleContext()
           
 MuleMessage[] getReturnMessages()
           
 boolean isOk()
          Note that it's possible for an implementation to return false and have no failure specified, thus the subsequent RetryContext.getLastFailure() may return null.
 void setFailed(Throwable lastFailure)
          Typically called by validation logic to mark a problem and an optional root cause.
 void setMuleContext(MuleContext context)
           
 void setOk()
          Typically called by validation logic to mark no problems with the current connection.
 void setReturnMessages(MuleMessage[] returnMessages)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultRetryContext

public DefaultRetryContext(String description,
                           Map<Object,Object> metaInfo)
Method Detail

setMuleContext

public void setMuleContext(MuleContext context)
Specified by:
setMuleContext in interface MuleContextAware

getMuleContext

public MuleContext getMuleContext()
Specified by:
getMuleContext in interface RetryContext

getMetaInfo

public Map<Object,Object> getMetaInfo()
Specified by:
getMetaInfo in interface RetryContext
Returns:
a read-only meta-info map or an empty map, never null.

getReturnMessages

public MuleMessage[] getReturnMessages()
Specified by:
getReturnMessages in interface RetryContext

getFirstReturnMessage

public MuleMessage getFirstReturnMessage()
Specified by:
getFirstReturnMessage in interface RetryContext

setReturnMessages

public void setReturnMessages(MuleMessage[] returnMessages)
Specified by:
setReturnMessages in interface RetryContext

addReturnMessage

public void addReturnMessage(MuleMessage result)
Specified by:
addReturnMessage in interface RetryContext

getDescription

public String getDescription()
Specified by:
getDescription in interface RetryContext

getLastFailure

public Throwable getLastFailure()
Description copied from interface: RetryContext
The most recent failure which prevented the context from validating the connection. Note that the method may return null. Instead, the RetryContext.isOk() should be consulted first.

Specified by:
getLastFailure in interface RetryContext
Returns:
last failure or null

setOk

public void setOk()
Description copied from interface: RetryContext
Typically called by validation logic to mark no problems with the current connection. Additionally, clears any previous failure set.

Specified by:
setOk in interface RetryContext

isOk

public boolean isOk()
Description copied from interface: RetryContext
Note that it's possible for an implementation to return false and have no failure specified, thus the subsequent RetryContext.getLastFailure() may return null.

Specified by:
isOk in interface RetryContext
Returns:
true if no problems detected before

setFailed

public void setFailed(Throwable lastFailure)
Description copied from interface: RetryContext
Typically called by validation logic to mark a problem and an optional root cause.

Specified by:
setFailed in interface RetryContext
Parameters:
lastFailure - the most recent failure, can be null


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