01: /**
02: * Sequoia: Database clustering technology.
03: * Copyright (C) 2006 Continuent, Inc.
04: * Contact: sequoia@continuent.org
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * 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, 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: */package org.continuent.sequoia.controller.virtualdatabase.protocol;
21:
22: import java.io.Serializable;
23:
24: import org.continuent.hedera.common.Member;
25: import org.continuent.sequoia.controller.requestmanager.distributed.DistributedRequestManager;
26: import org.continuent.sequoia.controller.virtualdatabase.DistributedVirtualDatabase;
27:
28: /**
29: * This class defines a FailoverForPersistentConnection to notify that a client
30: * has transparently failed over for the given persistent connection.
31: *
32: * @author <a href="mailto:emmanuel.cecchet@continuent.com">Emmanuel Cecchet</a>
33: * @version 1.0
34: */
35: public class FailoverForPersistentConnection extends
36: DistributedVirtualDatabaseMessage {
37: private static final long serialVersionUID = 7480377277487864642L;
38: private long connectionId;
39:
40: /**
41: * Creates a new <code>FailoverForPersistentConnection</code> object
42: *
43: * @param connectionId the persistent connection identifier
44: */
45: public FailoverForPersistentConnection(long connectionId) {
46: this .connectionId = connectionId;
47: }
48:
49: /**
50: * Returns the persistent connection id.
51: *
52: * @return Returns the connection id.
53: */
54: public long getConnectionId() {
55: return connectionId;
56: }
57:
58: /**
59: * @see org.continuent.sequoia.controller.virtualdatabase.protocol.DistributedVirtualDatabaseMessage#handleMessageSingleThreaded(org.continuent.sequoia.controller.virtualdatabase.DistributedVirtualDatabase,
60: * org.continuent.hedera.common.Member)
61: */
62: public Object handleMessageSingleThreaded(
63: DistributedVirtualDatabase dvdb, Member sender) {
64: return null;
65: }
66:
67: /**
68: * @see org.continuent.sequoia.controller.virtualdatabase.protocol.DistributedVirtualDatabaseMessage#handleMessageMultiThreaded(org.continuent.sequoia.controller.virtualdatabase.DistributedVirtualDatabase,
69: * org.continuent.hedera.common.Member, java.lang.Object)
70: */
71: public Serializable handleMessageMultiThreaded(
72: DistributedVirtualDatabase dvdb, Member sender,
73: Object handleMessageSingleThreadedResult) {
74: long controllerId = connectionId
75: & DistributedRequestManager.CONTROLLER_ID_BIT_MASK;
76:
77: Long cid = new Long(connectionId);
78:
79: dvdb.notifyPersistentConnectionFailover(new Long(controllerId),
80: cid);
81: return null;
82: }
83:
84: }
|