FailoverSupport.java
01 /*
02  *  Licensed to the Apache Software Foundation (ASF) under one
03  *  or more contributor license agreements.  See the NOTICE file
04  *  distributed with this work for additional information
05  *  regarding copyright ownership.  The ASF licenses this file
06  *  to you under the Apache License, Version 2.0 (the
07  *  "License"); you may not use this file except in compliance
08  *  with the License.  You may obtain a copy of the License at
09  *
10  *    http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *  Unless required by applicable law or agreed to in writing,
13  *  software distributed under the License is distributed on an
14  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  *  KIND, either express or implied.  See the License for the
16  *  specific language governing permissions and limitations
17  *  under the License.
18  *
19  *
20  */
21 
22 package org.apache.qpid.client.failover;
23 
24 /**
25  * FailoverSupport defines an interface for different types of fail-over handlers, that provide different types of
26  * behaviour for handling fail-overs during operations that can be interrupted by the fail-over process. For example,
27  * the support could automatically retry once the fail-over process completes, could prevent an operation from being
28  * started whilst fail-over is running, or could quietly abandon the operation or raise an exception, and so on.
29  *
30  <p><table id="crc"><caption>CRC Card</caption>
31  <tr><th> Responsibilities
32  <tr><td> Perform a fail-over protected operation with handling for fail-over conditions.
33  </table>
34  *
35  * @todo Continuation, extend some sort of re-usable Continuation interface, which might look very like this one.
36  */
37 public interface FailoverSupport<T, E extends Exception>
38 {
39     /**
40      * Delegates to another continuation which is to be provided with fail-over handling.
41      *
42      @return The return value from the delegated to continuation.
43      *
44      @throws E Any exception that the delegated to continuation may raise.
45      */
46     public T execute() throws E;
47 }