KickJava   Java API By Example, From Geeks To Geeks.

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


1 /**
2  * Sequoia: Database clustering technology.
3  * Copyright (C) 2002-2004 French National Institute For Research In Computer
4  * Science And Control (INRIA).
5  * Copyright (C) 2005 AmicoSoft, Inc. dba Emic Networks
6  * Copyright (C) 2006 Continuent, Inc.
7  * Contact: sequoia@continuent.org
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  * Initial developer(s): Emmanuel Cecchet.
22  * Contributor(s): ______________________.
23  */

24
25 package org.continuent.sequoia.controller.virtualdatabase.protocol;
26
27 import java.io.Serializable JavaDoc;
28 import java.sql.SQLException JavaDoc;
29 import java.util.LinkedList JavaDoc;
30
31 import org.continuent.sequoia.controller.requestmanager.distributed.DistributedRequestManager;
32 import org.continuent.sequoia.controller.requests.AbstractWriteRequest;
33
34 /**
35  * This class defines a CacheInvalidate
36  *
37  * @author <a HREF="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a>
38  * @version 1.0
39  */

40 public class CacheInvalidate extends DistributedRequest
41 {
42   private static final long serialVersionUID = -3697012973169118466L;
43
44   /**
45    * Creates a new <code>CacheInvalidate</code> object
46    *
47    * @param request Write request that invalidates the cache
48    */

49   public CacheInvalidate(AbstractWriteRequest request)
50   {
51     super(request);
52   }
53
54   /**
55    * @see org.continuent.sequoia.controller.virtualdatabase.protocol.DistributedRequest#scheduleRequest(org.continuent.sequoia.controller.requestmanager.distributed.DistributedRequestManager)
56    */

57   public final Object JavaDoc scheduleRequest(DistributedRequestManager drm)
58       throws SQLException JavaDoc
59   {
60     LinkedList JavaDoc totalOrderQueue = drm.getVirtualDatabase().getTotalOrderQueue();
61     synchronized (totalOrderQueue)
62     {
63       totalOrderQueue.addLast(this);
64     }
65     return this;
66   }
67
68   /**
69    * @see org.continuent.sequoia.controller.virtualdatabase.protocol.DistributedRequest#executeScheduledRequest(org.continuent.sequoia.controller.requestmanager.distributed.DistributedRequestManager)
70    */

71   public final Serializable JavaDoc executeScheduledRequest(
72       DistributedRequestManager drm) throws SQLException JavaDoc
73   {
74     // Notify cache if any
75
if (drm.getResultCache() != null)
76     { // Update cache
77
drm.getResultCache().writeNotify(request);
78     }
79     return null;
80   }
81
82 }
Popular Tags