KickJava   Java API By Example, From Geeks To Geeks.

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


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.virtualdatabase.DistributedVirtualDatabase;
28
29 /**
30  * This interface defines a DistributedVirtualDatabaseMessage
31  *
32  * @author <a HREF="mailto:emmanuel.cecchet@continuent.com">Emmanuel Cecchet</a>
33  * @version 1.0
34  */

35 public abstract class DistributedVirtualDatabaseMessage implements Serializable JavaDoc
36 {
37
38   /**
39    * Single threaded part of the handler that will execute in mutual execution
40    * in the total order delivery thread of the group communication.
41    * <p>
42    * NEVER BLOCK IN THIS HANDLER !!!
43    *
44    * @param dvdb the local instance of the distributed virtual database
45    * @param sender the message sender
46    * @return an optional value to be passed to the multithreaded handler
47    */

48   public abstract Object JavaDoc handleMessageSingleThreaded(
49       DistributedVirtualDatabase dvdb, Member sender);
50
51   /**
52    * Multi-threaded part of the message handler.
53    *
54    * @param dvdb the local instance of the distributed virtual database
55    * @param sender the message sender
56    * @param handleMessageSingleThreadedResult value returned by the single
57    * threaded handler
58    * @return a Serializable object to be returned to the sender
59    */

60   public abstract Serializable JavaDoc handleMessageMultiThreaded(
61       DistributedVirtualDatabase dvdb, Member sender,
62       Object JavaDoc handleMessageSingleThreadedResult);
63
64   /**
65    * Cancel the message in a "best effort"-basis. Should try to undo message
66    * side-effects and clean-up reources.
67    *
68    * @param dvdb the local instance of the distributed virtual database
69    */

70   public void cancel(DistributedVirtualDatabase dvdb)
71   {
72     // Does nothing by default.
73
}
74 }
75
Popular Tags