001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.ha.framework.interfaces;
023:
024: import org.jboss.util.NestedException;
025:
026: /**
027: * Generic clustering exception that can be used to replace other exceptions
028: * that occur on the server. Thus, only this class is needed on the client side
029: * and some specific server side exceptions class are not needed on the client side
030: * (such as JMX exceptions for example).
031: * Furhtermore, it has support for "COMPLETED" status flag a la IIOP.
032: *
033: * @author <a href="mailto:sacha.labourey@cogito-info.ch">Sacha Labourey</a>.
034: * @version $Revision: 57188 $
035: *
036: * <p><b>Revisions:</b>
037: *
038: * <p><b>8 avril 2002 Sacha Labourey:</b>
039: * <ul>
040: * <li> First implementation </li>
041: * </ul>
042: */
043:
044: public class GenericClusteringException extends NestedException {
045: // When an invocation reaches a node, it may be invoked on the actual
046: // target or not (or not completely). If COMPLETED_NO and working in
047: // a clustered environment, the client proxy is allowed to invoke
048: // the same invocation on a different node. Otherwise, it will depend
049: // if the target method is idempotent: this is no more the problem of
050: // this class but rather the meta-data of the business environment
051: // that can give this information
052: //
053: public final static int COMPLETED_YES = 0;
054: public final static int COMPLETED_NO = 1;
055: public final static int COMPLETED_MAYBE = 2;
056:
057: public boolean isDefinitive = true;
058:
059: // if yes, then the invocation may be retried against another node
060: // because the state has not been modified by the current invocation
061: //
062: public int completed;
063:
064: public GenericClusteringException() {
065: this .completed = this .COMPLETED_MAYBE;
066: }
067:
068: public GenericClusteringException(int CompletionStatus) {
069: this .completed = CompletionStatus;
070: }
071:
072: public GenericClusteringException(int CompletionStatus, String s) {
073: super (s);
074: this .completed = CompletionStatus;
075: }
076:
077: public GenericClusteringException(int CompletionStatus, String s,
078: boolean isDefinitive) {
079: super (s);
080: this .completed = CompletionStatus;
081: this .isDefinitive = isDefinitive;
082: }
083:
084: public GenericClusteringException(int CompletionStatus,
085: Throwable nested, boolean isDefinitive) {
086: super (nested);
087: this .completed = CompletionStatus;
088: this .isDefinitive = isDefinitive;
089: }
090:
091: public GenericClusteringException(int CompletionStatus,
092: Throwable nested) {
093: super (nested);
094: this .completed = CompletionStatus;
095: }
096:
097: public int getCompletionStatus() {
098: return this .completed;
099: }
100:
101: public void setCompletionStatus(int completionStatus) {
102: this .completed = completionStatus;
103: }
104:
105: // Indicates if the exception will most probably be repetitive (definitive)
106: // or if it is just a temporary failure and new attempts should be tried
107: //
108: public boolean isDefinitive() {
109: return this .isDefinitive;
110: }
111:
112: public void setIsDefinitive(boolean definitive) {
113: this.isDefinitive = definitive;
114: }
115: }
|