01: /*
02: * $Id: ReceiveException.java 10489 2008-01-23 17:53:38Z dfeist $
03: * --------------------------------------------------------------------------------------
04: * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
05: *
06: * The software in this package is published under the terms of the CPAL v1.0
07: * license, a copy of which has been included with this distribution in the
08: * LICENSE.txt file.
09: */
10:
11: package org.mule.api.transport;
12:
13: import org.mule.api.MuleException;
14: import org.mule.api.endpoint.ImmutableEndpoint;
15: import org.mule.config.i18n.CoreMessages;
16: import org.mule.config.i18n.Message;
17: import org.mule.util.ObjectUtils;
18:
19: /**
20: * <code>ReceiveException</code> is specifically thrown by the Provider receive
21: * method if something fails in the underlying transport
22: */
23: public class ReceiveException extends MuleException {
24: /**
25: * Serial version
26: */
27: private static final long serialVersionUID = 1960304517882133951L;
28:
29: private ImmutableEndpoint endpoint;
30:
31: /**
32: * @param message the exception message
33: */
34: public ReceiveException(Message message,
35: ImmutableEndpoint endpoint, long timeout) {
36: super (message);
37: this .endpoint = endpoint;
38: addInfo("Endpoint", ObjectUtils.toString(this .endpoint, "null"));
39: addInfo("Timeout", String.valueOf(timeout));
40: }
41:
42: /**
43: * @param message the exception message
44: * @param cause the exception that cause this exception to be thrown
45: */
46: public ReceiveException(Message message,
47: ImmutableEndpoint endpoint, long timeout, Throwable cause) {
48: super (message, cause);
49: this .endpoint = endpoint;
50: addInfo("Endpoint", ObjectUtils.toString(this .endpoint, "null"));
51: addInfo("Timeout", String.valueOf(timeout));
52: }
53:
54: public ReceiveException(ImmutableEndpoint endpoint, long timeout,
55: Throwable cause) {
56: this(
57: CoreMessages.failedToRecevieWithTimeout(endpoint,
58: timeout), endpoint, timeout, cause);
59: }
60: }
|