|
@@ -66,6 +66,9 @@ public class Bookie extends Thread {
|
|
|
|
|
|
// ZooKeeper client instance for the Bookie
|
|
// ZooKeeper client instance for the Bookie
|
|
ZooKeeper zk;
|
|
ZooKeeper zk;
|
|
|
|
+
|
|
|
|
+ // Running flag
|
|
|
|
+ private volatile boolean running = false;
|
|
|
|
|
|
public static class NoLedgerException extends IOException {
|
|
public static class NoLedgerException extends IOException {
|
|
private static final long serialVersionUID = 1L;
|
|
private static final long serialVersionUID = 1L;
|
|
@@ -378,6 +381,10 @@ public class Bookie extends Thread {
|
|
|
|
|
|
private LastLogMark lastLogMark = new LastLogMark(0, 0);
|
|
private LastLogMark lastLogMark = new LastLogMark(0, 0);
|
|
|
|
|
|
|
|
+ public boolean isRunning(){
|
|
|
|
+ return running;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void run() {
|
|
public void run() {
|
|
LinkedList<QueueEntry> toFlush = new LinkedList<QueueEntry>();
|
|
LinkedList<QueueEntry> toFlush = new LinkedList<QueueEntry>();
|
|
@@ -390,6 +397,7 @@ public class Bookie extends Thread {
|
|
long nextPrealloc = preAllocSize;
|
|
long nextPrealloc = preAllocSize;
|
|
long lastFlushPosition = 0;
|
|
long lastFlushPosition = 0;
|
|
logFile.write(zeros, nextPrealloc);
|
|
logFile.write(zeros, nextPrealloc);
|
|
|
|
+ running = true;
|
|
// TODO: Currently, when we roll over the journal logs, the older
|
|
// TODO: Currently, when we roll over the journal logs, the older
|
|
// ones are never garbage collected. We should remove a journal log
|
|
// ones are never garbage collected. We should remove a journal log
|
|
// once all of its entries have been synced with the entry logs.
|
|
// once all of its entries have been synced with the entry logs.
|
|
@@ -432,6 +440,7 @@ public class Bookie extends Thread {
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
LOG.fatal("Bookie thread exiting", e);
|
|
LOG.fatal("Bookie thread exiting", e);
|
|
}
|
|
}
|
|
|
|
+ running = false;
|
|
}
|
|
}
|
|
|
|
|
|
private FileChannel openChannel(long logId) throws FileNotFoundException {
|
|
private FileChannel openChannel(long logId) throws FileNotFoundException {
|