comparison src/org/dancres/blitz/txn/CheckpointTask.java @ 0:3dc0c5604566

Initial checkin of blitz 2.0 fcs - no installer yet.
author Dan Creswell <dan.creswell@gmail.com>
date Sat, 21 Mar 2009 11:00:06 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:3dc0c5604566
1 package org.dancres.blitz.txn;
2
3 import java.io.IOException;
4
5 import java.util.logging.Level;
6
7 import org.dancres.blitz.task.Task;
8
9 class CheckpointTask implements Task {
10 private boolean isDone = false;
11 private IOException theIOE = null;
12
13 public void run() {
14 try {
15 TxnManager.get().requestAsyncCheckpoint();
16 } catch (IOException anIOE) {
17 TxnManager.theLogger.log(Level.SEVERE,
18 "Checkpoint failed to complete",
19 anIOE);
20 theIOE = anIOE;
21 }
22
23 synchronized(this) {
24 isDone = true;
25 notify();
26 }
27 }
28
29 void waitForCompletion() throws IOException {
30 synchronized(this) {
31 while (!isDone) {
32 try {
33 wait();
34 } catch (InterruptedException anIE) {
35 TxnManager.theLogger.log(Level.SEVERE,
36 "Failed to wait for checkpoint completion",
37 anIE);
38 }
39 }
40
41 if (theIOE != null)
42 throw theIOE;
43 }
44 }
45 }