org.xins.common.service
Class CallException

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended byorg.xins.common.service.CallException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
GenericCallException, HTTPCallException, XINSCallException

public abstract class CallException
extends Exception

Root class for all exceptions that indicate a ServiceCaller call failed. This exception is typically only thrown by class ServiceCaller and subclasses.

Call exceptions can be linked. The first exception is then actually thrown to the caller. The caller can get the linked exceptions using getNext().

Since:
XINS 1.0.0
Version:
$Revision: 1.35 $ $Date: 2010/03/20 13:35:58 $
Author:
Ernst de Haan
See Also:
Serialized Form

Constructor Summary
protected CallException(String shortReason, CallRequest request, TargetDescriptor target, long duration, String detail, Throwable cause)
          Constructs a new CallException based on a short reason, the original request, target called, call duration, detail message and cause exception.
 
Method Summary
 String getDetail()
          Returns a detailed description of problem, if any.
 long getDuration()
          Returns the call duration.
 String getMessage()
          Returns the detail message string of this exception.
 CallException getNext()
          Gets the next linked CallException, if there is any.
 CallRequest getRequest()
          Returns the original request.
 TargetDescriptor getTarget()
          Returns the descriptor for the target that was attempted to be called.
 boolean isFailOverAllowed()
          Indicates whether this call exception allow for the ServiceCaller to fail over another TargetDescriptor if available.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CallException

protected CallException(String shortReason,
                        CallRequest request,
                        TargetDescriptor target,
                        long duration,
                        String detail,
                        Throwable cause)
                 throws IllegalArgumentException
Constructs a new CallException based on a short reason, the original request, target called, call duration, detail message and cause exception.

Parameters:
shortReason - the short reason, cannot be null.
request - the original request, cannot be null.
target - descriptor for the target that was attempted to be called, can be null.
duration - the call duration in milliseconds, must be >= 0.
detail - a detailed description of the problem, can be null if there is no more detail.
cause - the cause exception, can be null.
Throws:
IllegalArgumentException - if shortReason == null || request == null || duration < 0.
Method Detail

getMessage

public String getMessage()
Returns the detail message string of this exception.

Returns:
the detail message string of this exception, never null.

getRequest

public final CallRequest getRequest()
Returns the original request.

Returns:
the original request, never null.

getTarget

public final TargetDescriptor getTarget()
Returns the descriptor for the target that was attempted to be called.

Returns:
the target descriptor, can be null.

getDuration

public final long getDuration()
Returns the call duration. This is defined as the time elapsed between the time the call attempt was started and the time the call returned. The duration is in milliseconds and is always >= 0.

Returns:
the call duration in milliseconds, always >= 0.

getNext

public final CallException getNext()
Gets the next linked CallException, if there is any.

Returns:
the next linked CallException, or null if there is none.

getDetail

public String getDetail()
Returns a detailed description of problem, if any.

Returns:
a detailed description, if available, otherwise null.

isFailOverAllowed

public boolean isFailOverAllowed()
Indicates whether this call exception allow for the ServiceCaller to fail over another TargetDescriptor if available. Note that when an exception doesn't know if the call (or part of the call) has been executed, false should be returned.

Returns:
true if the service can fail over, false otherwise.


See http://www.xins.org/.