01: /**
02: * Sequoia: Database clustering technology.
03: * Copyright (C) 2005 AmicoSoft, Inc. dba Emic Networks
04: * Copyright (C) 2005-2006 Continuent, Inc.
05: * Contact: sequoia@continuent.org
06: *
07: * Licensed under the Apache License, Version 2.0 (the "License");
08: * you may not use this file except in compliance with the License.
09: * You may obtain a copy of the License at
10: *
11: * http://www.apache.org/licenses/LICENSE-2.0
12: *
13: * Unless required by applicable law or agreed to in writing, software
14: * distributed under the License is distributed on an "AS IS" BASIS,
15: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16: * See the License for the specific language governing permissions and
17: * limitations under the License.
18: *
19: * Initial developer(s): Olivier Fambon.
20: * Contributor(s): Emmanuel Cecchet.
21: */package org.continuent.sequoia.controller.virtualdatabase.protocol;
22:
23: import java.io.Serializable;
24:
25: import org.continuent.hedera.common.Member;
26: import org.continuent.sequoia.controller.recoverylog.events.LogEntry;
27: import org.continuent.sequoia.controller.virtualdatabase.DistributedVirtualDatabase;
28:
29: /**
30: * This class defines a CopyLogEntry message. It is used to send recovery log
31: * entries over to a remote peer. Entries are sent one by one instead of as big
32: * bunch because each log entry can potentially be a huge object, e.g. if it
33: * contains a blob, and it should fit in memory.
34: *
35: * @author <a href="mailto:olivier.fambon@emicnetworks.com">Olivier Fambon </a>
36: * @author <a href="mailto:emmanuel.cecchet@continuent.com">Emmanuel Cecchet</a>
37: * @version 1.0
38: */
39: public class CopyLogEntry extends DistributedVirtualDatabaseMessage {
40: private static final long serialVersionUID = 1L;
41:
42: private LogEntry entry;
43:
44: /**
45: * Creates a new <code>CopyLogEntry</code> object
46: *
47: * @param entry the entry to be sent over to the remote peer.
48: */
49: public CopyLogEntry(LogEntry entry) {
50: this .entry = entry;
51: }
52:
53: /**
54: * Returns the recovery LogEntry to be copied.
55: *
56: * @return the entry
57: */
58: public LogEntry getEntry() {
59: return entry;
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 handleMessageSingleThreaded(
67: DistributedVirtualDatabase dvdb, Member sender) {
68: if (!dvdb.hasRecoveryLog()) {
69: dvdb
70: .getLogger()
71: .warn(
72: "Tentative CopyLogEntry on vdb with no recovery log");
73: return null;
74: }
75:
76: dvdb.getRequestManager().getRecoveryLog().logLogEntry(entry);
77: return null;
78: }
79:
80: /**
81: * @see org.continuent.sequoia.controller.virtualdatabase.protocol.DistributedVirtualDatabaseMessage#handleMessageMultiThreaded(org.continuent.sequoia.controller.virtualdatabase.DistributedVirtualDatabase,
82: * org.continuent.hedera.common.Member, java.lang.Object)
83: */
84: public Serializable handleMessageMultiThreaded(
85: DistributedVirtualDatabase dvdb, Member sender,
86: Object handleMessageSingleThreadedResult) {
87: return null;
88: }
89: }
|