KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > continuent > sequoia > controller > virtualdatabase > protocol > NotifyInconsistency


1 /**
2  * Sequoia: Database clustering technology.
3  * Copyright (C) 2006 Continuent, Inc.
4  * Contact: sequoia@continuent.org
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * Initial developer(s): Emmanuel Cecchet.
19  * Contributor(s): ______________________.
20  */

21
22 package org.continuent.sequoia.controller.virtualdatabase.protocol;
23
24 import java.io.Serializable JavaDoc;
25 import java.sql.SQLException JavaDoc;
26
27 import org.continuent.sequoia.common.exceptions.VirtualDatabaseException;
28 import org.continuent.sequoia.controller.requestmanager.distributed.DistributedRequestManager;
29 import org.continuent.sequoia.controller.requests.AbstractRequest;
30
31 /**
32  * This class defines a inconsistency notification command that is sent to
33  * controllers that reported a result that is inconsistent with other
34  * controllers. As a consequence, all backends of the inconsistent controllers
35  * are disabled.
36  *
37  * @author <a HREF="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a>
38  * @version 1.0
39  */

40 public class NotifyInconsistency extends DistributedRequest
41 {
42   private static final long serialVersionUID = -5744767614853747783L;
43
44   /**
45    * Creates a new <code>NotifyInconsistency</code> object
46    *
47    * @param request the request that generated the inconsistency
48    */

49   public NotifyInconsistency(AbstractRequest request)
50   {
51     super(request);
52   }
53
54   /**
55    * @see org.continuent.sequoia.controller.virtualdatabase.protocol.DistributedRequest#scheduleRequest(org.continuent.sequoia.controller.requestmanager.distributed.DistributedRequestManager)
56    */

57   public final Object JavaDoc scheduleRequest(DistributedRequestManager drm)
58       throws SQLException JavaDoc
59   {
60     return null;
61   }
62
63   /**
64    * @see org.continuent.sequoia.controller.virtualdatabase.protocol.DistributedRequest#executeScheduledRequest(org.continuent.sequoia.controller.requestmanager.distributed.DistributedRequestManager)
65    */

66   public final Serializable JavaDoc executeScheduledRequest(
67       DistributedRequestManager drm) throws SQLException JavaDoc
68   {
69     try
70     {
71       drm.getLogger()
72           .warn(
73               "Disabling all backends after an inconsistency was detected for request "
74                   + request.getId()
75                   + (request.isAutoCommit() ? "" : " "
76                       + request.getTransactionId()) + " " + request);
77       drm.getVirtualDatabase().disableAllBackends(true);
78     }
79     catch (VirtualDatabaseException e)
80     {
81       drm
82           .getLogger()
83           .error(
84               "An error occured while disabling all backends after an inconsistency was detected for request "
85                   + request.getId()
86                   + (request.isAutoCommit() ? "" : " "
87                       + request.getTransactionId()) + " " + request, e);
88     }
89     return null;
90   }
91
92 }
Popular Tags