KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > continuent > sequoia > controller > recoverylog > events > RemoveCheckpointEvent


1 /**
2  * Sequoia: Database clustering technology.
3  * Copyright (C) 2005 Emic Networks.
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): Jeff Mesnil.
19  * Contributor(s): ______________________.
20  */

21
22 package org.continuent.sequoia.controller.recoverylog.events;
23
24 import java.sql.SQLException JavaDoc;
25
26 import org.continuent.sequoia.controller.recoverylog.LoggerThread;
27
28 /**
29  * This class is used to remove a Checkpoint from the recovery log checkpoint
30  * tables.
31  */

32 public class RemoveCheckpointEvent implements LogEvent
33 {
34
35   private String JavaDoc checkpointName;
36
37   /**
38    * Create a new <code>RemoveCheckpointEvent</code> object.
39    *
40    * @param checkpointName the checkpoint name to remove
41    */

42   public RemoveCheckpointEvent(String JavaDoc checkpointName)
43   {
44     this.checkpointName = checkpointName;
45   }
46
47   /**
48    * @see org.continuent.sequoia.controller.recoverylog.events.LogEvent#belongToTransaction(long)
49    */

50   public boolean belongToTransaction(long tid)
51   {
52     return false;
53   }
54
55   /**
56    * @see org.continuent.sequoia.controller.recoverylog.events.LogEvent#execute(org.continuent.sequoia.controller.recoverylog.LoggerThread)
57    */

58   public void execute(LoggerThread loggerThread)
59   {
60
61     try
62     {
63       loggerThread.removeCheckpoint(checkpointName);
64     }
65     catch (SQLException JavaDoc e)
66     {
67       // Push object back in the queue, it needs to be logged again => potential
68
// infinite loop
69
loggerThread.putBackAtHeadOfQueue(this, e);
70     }
71
72     // Notify task completion
73
synchronized (this)
74     {
75       notify();
76     }
77   }
78
79   /**
80    * @see java.lang.Object#toString()
81    */

82   public String JavaDoc toString()
83   {
84     return "RemoveCheckpointEvent for checkpoint " + checkpointName;
85   }
86
87 }
88
Popular Tags