KickJava   Java API By Example, From Geeks To Geeks.

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


1 /**
2  * Sequoia: Database clustering technology.
3  * Copyright (C) 2005 AmicoSoft, Inc. dba Emic Networks
4  * Copyright (C) 2005-2006 Continuent, Inc.
5  * Contact: sequoia@continuent.org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * 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  */

22
23 package org.continuent.sequoia.controller.virtualdatabase.protocol;
24
25 import java.io.Serializable JavaDoc;
26
27 import org.continuent.hedera.common.Member;
28 import org.continuent.sequoia.controller.recoverylog.events.LogEntry;
29 import org.continuent.sequoia.controller.virtualdatabase.DistributedVirtualDatabase;
30
31 /**
32  * This class defines a CopyLogEntry message. It is used to send recovery log
33  * entries over to a remote peer. Entries are sent one by one instead of as big
34  * bunch because each log entry can potentially be a huge object, e.g. if it
35  * contains a blob, and it should fit in memory.
36  *
37  * @author <a HREF="mailto:olivier.fambon@emicnetworks.com">Olivier Fambon </a>
38  * @author <a HREF="mailto:emmanuel.cecchet@continuent.com">Emmanuel Cecchet</a>
39  * @version 1.0
40  */

41 public class CopyLogEntry extends DistributedVirtualDatabaseMessage
42 {
43   private static final long serialVersionUID = 1L;
44
45   private LogEntry entry;
46
47   /**
48    * Creates a new <code>CopyLogEntry</code> object
49    *
50    * @param entry the entry to be sent over to the remote peer.
51    */

52   public CopyLogEntry(LogEntry entry)
53   {
54     this.entry = entry;
55   }
56
57   /**
58    * Returns the recovery LogEntry to be copied.
59    *
60    * @return the entry
61    */

62   public LogEntry getEntry()
63   {
64     return entry;
65   }
66
67   /**
68    * @see org.continuent.sequoia.controller.virtualdatabase.protocol.DistributedVirtualDatabaseMessage#handleMessageSingleThreaded(org.continuent.sequoia.controller.virtualdatabase.DistributedVirtualDatabase,
69    * org.continuent.hedera.common.Member)
70    */

71   public Object JavaDoc handleMessageSingleThreaded(DistributedVirtualDatabase dvdb,
72       Member sender)
73   {
74     if (!dvdb.hasRecoveryLog())
75     {
76       dvdb.getLogger().warn(
77           "Tentative CopyLogEntry on vdb with no recovery log");
78       return null;
79     }
80
81     dvdb.getRequestManager().getRecoveryLog().logLogEntry(entry);
82     return null;
83   }
84
85   /**
86    * @see org.continuent.sequoia.controller.virtualdatabase.protocol.DistributedVirtualDatabaseMessage#handleMessageMultiThreaded(org.continuent.sequoia.controller.virtualdatabase.DistributedVirtualDatabase,
87    * org.continuent.hedera.common.Member, java.lang.Object)
88    */

89   public Serializable JavaDoc handleMessageMultiThreaded(
90       DistributedVirtualDatabase dvdb, Member sender,
91       Object JavaDoc handleMessageSingleThreadedResult)
92   {
93     return null;
94   }
95 }
96
Popular Tags