KickJava   Java API By Example, From Geeks To Geeks.

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


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
26 import org.continuent.hedera.common.Member;
27 import org.continuent.sequoia.controller.requestmanager.distributed.DistributedRequestManager;
28 import org.continuent.sequoia.controller.virtualdatabase.DistributedVirtualDatabase;
29
30 /**
31  * This class defines a FailoverForTransaction to notify that a client has
32  * transparently failed over for the given transaction.
33  *
34  * @author <a HREF="mailto:emmanuel.cecchet@continuent.com">Emmanuel Cecchet</a>
35  * @version 1.0
36  */

37 public class FailoverForTransaction extends DistributedVirtualDatabaseMessage
38 {
39   private static final long serialVersionUID = 4356953098910034513L;
40   private long transactionId;
41
42   /**
43    * Creates a new <code>FailoverForTransaction</code> object
44    *
45    * @param transactionId the transaction identifier
46    */

47   public FailoverForTransaction(long transactionId)
48   {
49     this.transactionId = transactionId;
50   }
51
52   /**
53    * Returns the transactionId value.
54    *
55    * @return Returns the transactionId.
56    */

57   public long getTransactionId()
58   {
59     return transactionId;
60   }
61
62   /**
63    * @see org.continuent.sequoia.controller.virtualdatabase.protocol.DistributedVirtualDatabaseMessage#handleMessageSingleThreaded(org.continuent.sequoia.controller.virtualdatabase.DistributedVirtualDatabase,
64    * org.continuent.hedera.common.Member)
65    */

66   public Object JavaDoc handleMessageSingleThreaded(DistributedVirtualDatabase dvdb,
67       Member sender)
68   {
69     return null;
70   }
71
72   /**
73    * @see org.continuent.sequoia.controller.virtualdatabase.protocol.DistributedVirtualDatabaseMessage#handleMessageMultiThreaded(org.continuent.sequoia.controller.virtualdatabase.DistributedVirtualDatabase,
74    * org.continuent.hedera.common.Member, java.lang.Object)
75    */

76   public Serializable JavaDoc handleMessageMultiThreaded(
77       DistributedVirtualDatabase dvdb, Member sender,
78       Object JavaDoc handleMessageSingleThreadedResult)
79   {
80     long controllerId = transactionId
81         & DistributedRequestManager.CONTROLLER_ID_BIT_MASK;
82     
83     Long JavaDoc tid = new Long JavaDoc(transactionId);
84     
85     dvdb.notifyTransactionFailover(new Long JavaDoc(controllerId), tid);
86     return null;
87   }
88
89 }
90
Popular Tags