View Javadoc

1   /*
2    * $Id: ReceiveException.java 7963 2007-08-21 08:53:15Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.umo.provider;
12  
13  import org.mule.config.i18n.CoreMessages;
14  import org.mule.config.i18n.Message;
15  import org.mule.umo.UMOException;
16  import org.mule.umo.endpoint.UMOImmutableEndpoint;
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 UMOException
24  {
25      /**
26       * Serial version
27       */
28      private static final long serialVersionUID = 1960304517882133951L;
29  
30      private UMOImmutableEndpoint endpoint;
31  
32      /**
33       * @param message the exception message
34       */
35      public ReceiveException(Message message, UMOImmutableEndpoint endpoint, long timeout)
36      {
37          super(message);
38          this.endpoint = endpoint;
39          addInfo("Endpoint", ObjectUtils.toString(this.endpoint, "null"));
40          addInfo("Timeout", String.valueOf(timeout));
41      }
42  
43      /**
44       * @param message the exception message
45       * @param cause the exception that cause this exception to be thrown
46       */
47      public ReceiveException(Message message, UMOImmutableEndpoint endpoint, long timeout, Throwable cause)
48      {
49          super(message, cause);
50          this.endpoint = endpoint;
51          addInfo("Endpoint", ObjectUtils.toString(this.endpoint, "null"));
52          addInfo("Timeout", String.valueOf(timeout));
53      }
54  
55      public ReceiveException(UMOImmutableEndpoint endpoint, long timeout, Throwable cause)
56      {
57          this(CoreMessages.failedToRecevieWithTimeout(endpoint, timeout),
58              endpoint, timeout, cause);
59      }
60  }