KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > ha > framework > interfaces > GenericClusteringException


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.ha.framework.interfaces;
23
24 import org.jboss.util.NestedException;
25
26 /**
27  * Generic clustering exception that can be used to replace other exceptions
28  * that occur on the server. Thus, only this class is needed on the client side
29  * and some specific server side exceptions class are not needed on the client side
30  * (such as JMX exceptions for example).
31  * Furhtermore, it has support for "COMPLETED" status flag a la IIOP.
32  *
33  * @author <a HREF="mailto:sacha.labourey@cogito-info.ch">Sacha Labourey</a>.
34  * @version $Revision: 37459 $
35  *
36  * <p><b>Revisions:</b>
37  *
38  * <p><b>8 avril 2002 Sacha Labourey:</b>
39  * <ul>
40  * <li> First implementation </li>
41  * </ul>
42  */

43
44 public class GenericClusteringException
45    extends NestedException
46 {
47    // When an invocation reaches a node, it may be invoked on the actual
48
// target or not (or not completely). If COMPLETED_NO and working in
49
// a clustered environment, the client proxy is allowed to invoke
50
// the same invocation on a different node. Otherwise, it will depend
51
// if the target method is idempotent: this is no more the problem of
52
// this class but rather the meta-data of the business environment
53
// that can give this information
54
//
55
public final static int COMPLETED_YES = 0;
56    public final static int COMPLETED_NO = 1;
57    public final static int COMPLETED_MAYBE = 2;
58    
59    public boolean isDefinitive = true;
60    
61    // if yes, then the invocation may be retried against another node
62
// because the state has not been modified by the current invocation
63
//
64
public int completed;
65    
66    public GenericClusteringException ()
67    {
68       this.completed = this.COMPLETED_MAYBE;
69    }
70    
71    public GenericClusteringException (int CompletionStatus)
72    {
73       this.completed = CompletionStatus;
74    }
75
76    public GenericClusteringException (int CompletionStatus, String JavaDoc s)
77    {
78       super(s);
79       this.completed = CompletionStatus;
80    }
81
82    public GenericClusteringException (int CompletionStatus, String JavaDoc s, boolean isDefinitive)
83    {
84       super(s);
85       this.completed = CompletionStatus;
86       this.isDefinitive = isDefinitive;
87    }
88
89    public GenericClusteringException (int CompletionStatus, Throwable JavaDoc nested, boolean isDefinitive)
90    {
91       super(nested);
92       this.completed = CompletionStatus;
93       this.isDefinitive = isDefinitive;
94    }
95    
96    public GenericClusteringException (int CompletionStatus, Throwable JavaDoc nested)
97    {
98       super(nested);
99       this.completed = CompletionStatus;
100    }
101    
102    public int getCompletionStatus ()
103    {
104       return this.completed;
105    }
106    
107    public void setCompletionStatus (int completionStatus)
108    {
109       this.completed = completionStatus;
110    }
111    
112    // Indicates if the exception will most probably be repetitive (definitive)
113
// or if it is just a temporary failure and new attempts should be tried
114
//
115
public boolean isDefinitive ()
116    {
117       return this.isDefinitive;
118    }
119    
120    public void setIsDefinitive (boolean definitive)
121    {
122       this.isDefinitive = definitive;
123    }
124 }
125
Popular Tags