KickJava   Java API By Example, From Geeks To Geeks.

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


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.recoverylog.events;
24
25 import java.sql.SQLException JavaDoc;
26
27 import org.continuent.sequoia.controller.recoverylog.LoggerThread;
28
29 /**
30  * This class is used to Store a Checkpoint in the recovery log checkpoint
31  * tables so that it is available e.g. for restore operations.
32  *
33  * @author <a HREF="mailto:olivier.fambon@emicnetworks.com">Olivier Fambon</a>
34  * @author <a HREF="mailto:emmanuel.cecchet@continuent.com">Emmanuel Cecchet</a>
35  * @version 1.0
36  */

37 public class StoreCheckpointWithLogIdEvent implements LogEvent
38 {
39   private long checkpointId;
40   private String JavaDoc checkpointName;
41
42   /**
43    * Creates a new <code>StoreCheckpointWithLogIdEvent</code> object
44    *
45    * @param checkpointName the checkpoint name to create.
46    * @param checkpointId the id of the checkpoint
47    */

48   public StoreCheckpointWithLogIdEvent(String JavaDoc checkpointName, long checkpointId)
49   {
50     this.checkpointId = checkpointId;
51     this.checkpointName = checkpointName;
52   }
53
54   /**
55    * @see org.continuent.sequoia.controller.recoverylog.events.LogEvent#belongToTransaction(long)
56    */

57   public boolean belongToTransaction(long tid)
58   {
59     return false;
60   }
61
62   /**
63    * @see org.continuent.sequoia.controller.recoverylog.events.LogEvent#execute(org.continuent.sequoia.controller.recoverylog.LoggerThread)
64    */

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

82   public String JavaDoc toString()
83   {
84     return "Storing checkpoint " + checkpointName + " with id " + checkpointId;
85   }
86
87 }
88
Popular Tags