de.fzj.unicore.wsrflite.xfire
Class ReliableProxy

java.lang.Object
  extended by de.fzj.unicore.wsrflite.xfire.ReliableProxy
All Implemented Interfaces:
InvocationHandler

public class ReliableProxy
extends Object
implements InvocationHandler

Replacement for XFireProxy
The behaviour in case of errors can be controlled by configuring this class with an instance of ReliableProxy.RetryDecider, allowing to decide whether a particular call shall be retried.
By default, no retries will be attempted.

Author:
schuller

Nested Class Summary
static interface ReliableProxy.RetryDecider
          this interface encapsulates the rules that shall be followed when dealing with failed webservice calls
 
Field Summary
protected  ReliableProxy.RetryDecider retryDecider
           
 
Constructor Summary
ReliableProxy(org.codehaus.xfire.client.Client client)
           
 
Method Summary
protected  Object doInvoke(Object proxy, Method method, Object[] args)
          Handles the object invocation.
 org.codehaus.xfire.client.Client getClient()
           
static ReliableProxy.RetryDecider getDefaultDecider(ReliableProxy parent)
          creates and returns a default ReliableProxy.RetryDecider implementation that will resubmit a fixed number of times, and will throw any application errors indicated by XFireFault or FaultInfoException
 int getFailedSubmits()
           
 Integer getMaxSubmits()
           
 Object invoke(Object proxy, Method method, Object[] args)
          Handles the object invocation.
 void setMaxSubmits(int maxSubmits)
           
 void setRetryDecider(ReliableProxy.RetryDecider handler)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

retryDecider

protected ReliableProxy.RetryDecider retryDecider
Constructor Detail

ReliableProxy

public ReliableProxy(org.codehaus.xfire.client.Client client)
Method Detail

getClient

public org.codehaus.xfire.client.Client getClient()

setRetryDecider

public void setRetryDecider(ReliableProxy.RetryDecider handler)

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              throws Throwable
Handles the object invocation.

Specified by:
invoke in interface InvocationHandler
Parameters:
proxy - the proxy object to invoke
method - the method to call
args - the arguments to the proxy object
Throws:
Throwable

doInvoke

protected Object doInvoke(Object proxy,
                          Method method,
                          Object[] args)
                   throws Throwable
Handles the object invocation.

Parameters:
proxy - the proxy object to invoke
method - the method to call
args - the arguments to the proxy object
Throws:
Throwable

getMaxSubmits

public Integer getMaxSubmits()

setMaxSubmits

public void setMaxSubmits(int maxSubmits)

getFailedSubmits

public int getFailedSubmits()

getDefaultDecider

public static ReliableProxy.RetryDecider getDefaultDecider(ReliableProxy parent)
creates and returns a default ReliableProxy.RetryDecider implementation that will resubmit a fixed number of times, and will throw any application errors indicated by XFireFault or FaultInfoException

Parameters:
maxSubmits - - the number of tries a failed call shall be retried
Returns:
a ReliableProxy.RetryDecider instance


Copyright © 2010. All Rights Reserved.