Skip to content

Commit

Permalink
(issue #29) producer cluster example with shutdown hook
Browse files Browse the repository at this point in the history
  • Loading branch information
bluestreak01 committed Jan 22, 2015
1 parent 9b4e5fa commit 29d9544
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import com.nfsdb.JournalWriter;
import com.nfsdb.exceptions.JournalException;
import com.nfsdb.exceptions.JournalNetworkException;
import com.nfsdb.factory.JournalFactory;
import com.nfsdb.factory.configuration.JournalConfigurationBuilder;
import com.nfsdb.net.cluster.ClusterController;
Expand Down Expand Up @@ -58,6 +59,17 @@ public static void main(String[] args) throws JournalException {
);

cc.start();

Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
try {
cc.halt();
} catch (JournalNetworkException e) {
e.printStackTrace();
}
}
});
}

/**
Expand Down

0 comments on commit 29d9544

Please sign in to comment.