KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > cjdbc > controller > recoverylog > events > StoreDumpCheckpointEvent


1 /**
2  * C-JDBC: Clustered JDBC.
3  * Copyright (C) 2005 Emic Networks.
4  * Contact: c-jdbc@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License as published by the
8  * Free Software Foundation; either version 2.1 of the License, or any later
9  * version.
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
14  * for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library; if not, write to the Free Software Foundation,
18  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
19  *
20  * Initial developer(s): Olivier Fambon.
21  * Contributor(s): ______________________.
22  */

23
24 package org.objectweb.cjdbc.controller.recoverylog.events;
25
26 import java.sql.SQLException JavaDoc;
27
28 import org.objectweb.cjdbc.common.i18n.Translate;
29 import org.objectweb.cjdbc.controller.recoverylog.LoggerThread;
30
31 /**
32  * This class is used to Store a Dump Checkpoint in the recovery log checkpoint
33  * tables so that it is available e.g. for restore operations.
34  *
35  * @author <a HREF="mailto:olivier.fambon@emicnetworks.com">Olivier Fambon</a>
36  * @version 1.0
37  */

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

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

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

66   public void execute(LoggerThread loggerThread)
67   {
68     try
69     {
70       loggerThread.storeCheckpoint(checkpointName, checkpointId);
71     }
72     catch (SQLException JavaDoc e)
73     {
74       loggerThread.invalidateLogStatements();
75       loggerThread.getLogger().error(
76           Translate.get("recovery.jdbc.checkpoint.store.failed", new Object JavaDoc[]{
77               checkpointName, e}), e);
78       // Push object back in the queue, it needs to be logged again => potential
79
// infinite loop
80
loggerThread.putBackAtHeadOfQueue(this);
81     }
82   }
83 }
84
Popular Tags