01: /*
02: * $Id: IOCallException.java,v 1.21 2007/05/21 08:34:42 agoubard Exp $
03: *
04: * Copyright 2003-2007 Orange Nederland Breedband B.V.
05: * See the COPYRIGHT file for redistribution and use restrictions.
06: */
07: package org.xins.common.service;
08:
09: import java.io.IOException;
10:
11: /**
12: * Exception that indicates that an I/O error interrupted a service call.
13: *
14: * @version $Revision: 1.21 $ $Date: 2007/05/21 08:34:42 $
15: * @author <a href="mailto:ernst@ernstdehaan.com">Ernst de Haan</a>
16: *
17: * @since XINS 1.0.0
18: */
19: public final class IOCallException extends GenericCallException {
20:
21: /**
22: * Serial version UID. Used for serialization. The assigned value is for
23: * compatibility with XINS 1.2.5.
24: */
25: private static final long serialVersionUID = -1118963769763850776L;
26:
27: /**
28: * Constructs a new <code>IOCallException</code>.
29: *
30: * @param request
31: * the original request, cannot be <code>null</code>.
32: *
33: * @param target
34: * descriptor for the target that was attempted to be called, cannot be
35: * <code>null</code>.
36: *
37: * @param duration
38: * the call duration in milliseconds, must be >= 0.
39: *
40: * @param ioException
41: * the cause {@link IOException}, cannot be <code>null</code>.
42: *
43: * @throws IllegalArgumentException
44: * if <code>request == null
45: * || target == null
46: * || ioException == null
47: * || duration < 0</code>.
48: */
49: public IOCallException(CallRequest request,
50: TargetDescriptor target, long duration,
51: IOException ioException) throws IllegalArgumentException {
52:
53: // Trace, check arguments and then call constructor of superclass
54: super (getShortReason(request, target, ioException), request,
55: target, duration, null, ioException);
56: }
57:
58: /**
59: * Checks the arguments for the constructor and then returns the short
60: * reason.
61: *
62: * @param request
63: * the original request, cannot be <code>null</code>.
64: *
65: * @param target
66: * descriptor for the target that was attempted to be called, cannot be
67: * <code>null</code>.
68: *
69: * @param ioException
70: * the cause {@link IOException}, cannot be <code>null</code>.
71: *
72: * @return
73: * the short reason, never <code>null</code>.
74: */
75: private static String getShortReason(CallRequest request,
76: TargetDescriptor target, IOException ioException) {
77:
78: // Return the short reason
79: return "I/O error";
80: }
81: }
|