01: /**
02: * Sequoia: Database clustering technology.
03: * Copyright (C) 2005 Emic Networks.
04: * Contact: sequoia@continuent.org
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
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: */package org.continuent.sequoia.controller.recoverylog.events;
21:
22: import java.sql.SQLException;
23:
24: import org.continuent.sequoia.controller.recoverylog.LoggerThread;
25:
26: /**
27: * This class is used to remove a Checkpoint from the recovery log checkpoint
28: * tables.
29: */
30: public class RemoveCheckpointEvent implements LogEvent {
31:
32: private String checkpointName;
33:
34: /**
35: * Create a new <code>RemoveCheckpointEvent</code> object.
36: *
37: * @param checkpointName the checkpoint name to remove
38: */
39: public RemoveCheckpointEvent(String checkpointName) {
40: this .checkpointName = checkpointName;
41: }
42:
43: /**
44: * @see org.continuent.sequoia.controller.recoverylog.events.LogEvent#belongToTransaction(long)
45: */
46: public boolean belongToTransaction(long tid) {
47: return false;
48: }
49:
50: /**
51: * @see org.continuent.sequoia.controller.recoverylog.events.LogEvent#execute(org.continuent.sequoia.controller.recoverylog.LoggerThread)
52: */
53: public void execute(LoggerThread loggerThread) {
54:
55: try {
56: loggerThread.removeCheckpoint(checkpointName);
57: } catch (SQLException e) {
58: // Push object back in the queue, it needs to be logged again => potential
59: // infinite loop
60: loggerThread.putBackAtHeadOfQueue(this , e);
61: }
62:
63: // Notify task completion
64: synchronized (this ) {
65: notify();
66: }
67: }
68:
69: /**
70: * @see java.lang.Object#toString()
71: */
72: public String toString() {
73: return "RemoveCheckpointEvent for checkpoint " + checkpointName;
74: }
75:
76: }
|