FailoverException.java
01 /*
02  *
03  * Licensed to the Apache Software Foundation (ASF) under one
04  * or more contributor license agreements.  See the NOTICE file
05  * distributed with this work for additional information
06  * regarding copyright ownership.  The ASF licenses this file
07  * to you under the Apache License, Version 2.0 (the
08  * "License"); you may not use this file except in compliance
09  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  */
21 package org.apache.qpid.client.failover;
22 
23 /**
24  * FailoverException is used to indicate that a synchronous request has failed to receive the reply that it is waiting
25  * for because the fail-over process has been started whilst it was waiting for its reply. Synchronous methods generally
26  * raise this exception to indicate that they must be re-tried once the fail-over process has completed.
27  *
28  <p/><table id="crc"><caption>CRC Card</caption>
29  <tr><th> Responsibilities <th> Collaborations
30  <tr><td> Used to indicate failure of a synchronous request due to fail-over.
31  </table>
32  *
33  * @todo This exception is created and passed as an argument to a method, rather than thrown. The exception is being
34  *       used to represent an event, passed out to other threads. Use of exceptions as arguments rather than as
35  *       exceptions is extremly confusing. Ideally use a condition or set a flag and check it instead.
36  *       This exceptions-as-events pattern seems to be in a similar style to Mina code, which is not pretty, but
37  *       potentially acceptable for that reason. We have the option of extending the mina model to add more events
38  *       to it, that is, anything that is interested in handling failover as an event occurs below the main
39  *       amq event handler, which knows the specific interface of the qpid handlers, which can pass this down as
40  *       an explicit event, without it being an exception. Add failover method to BlockingMethodFrameListener,
41  *       have it set a flag or interrupt the waiting thread, which then creates and raises this exception.
42  */
43 public class FailoverException extends Exception
44 {
45     public FailoverException(String message)
46     {
47         super(message);
48     }
49 }