01: /**
02: * Sequoia: Database clustering technology.
03: * Copyright (C) 2006 Continuent, Inc.
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): Emmanuel Cecchet.
19: * Contributor(s): ______________________.
20: */package org.continuent.sequoia.controller.recoverylog.events;
21:
22: import org.continuent.sequoia.controller.recoverylog.LoggerThread;
23:
24: /**
25: * This class defines a ShutdownLogEvent. Post an instance
26: * of this class to the recoverly log to force it to shut down.
27: *
28: * @author <a href="mailto:robert.hodges@continuent.com">Robert Hodges</a>
29: * @version 1.0
30: */
31: public class ShutdownLogEvent implements LogEvent {
32: /**
33: * Creates a new <code>ShutdownLogEvent</code> instance.
34: */
35: public ShutdownLogEvent() {
36: super ();
37: }
38:
39: /**
40: * @see org.continuent.sequoia.controller.recoverylog.events.LogEvent#belongToTransaction(long)
41: */
42: public boolean belongToTransaction(long tid) {
43: return false;
44: }
45:
46: /**
47: * Close recovery log and invoke shutdown on the logger thread which will
48: * cause it to terminate as soon as processing of this event is completed.
49: *
50: * @see org.continuent.sequoia.controller.recoverylog.events.LogEvent#execute(org.continuent.sequoia.controller.recoverylog.LoggerThread)
51: */
52: public void execute(LoggerThread loggerThread) {
53: // This closes the database. For local Hypersonic recovery logs we
54: // may in future want to issue a SHUTDOWN COMPACT to ensure the
55: // database is stored efficiently.
56: loggerThread.invalidateLogStatements();
57: loggerThread.shutdown();
58: synchronized (this ) {
59: notify();
60: }
61: loggerThread.getLogger().info("Executed log shutdown event");
62: }
63: }
|