mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-06 02:07:07 +00:00
[Java] Add compaction style to options
Summary: Add compression type to options make rocksdbjava make sample Reviewers: haobo, yhchiang, sdong, dhruba, rsumbaly, zzbennett, swapnilghike Reviewed By: yhchiang, sdong CC: leveldb Differential Revision: https://reviews.facebook.net/D20463
This commit is contained in:
@@ -46,13 +46,19 @@ public class StatisticsCollector {
|
||||
_executorService.submit(collectStatistics());
|
||||
}
|
||||
|
||||
public void shutDown() throws InterruptedException {
|
||||
/**
|
||||
* Shuts down statistics collector.
|
||||
*
|
||||
* @param shutdownTimeout Time in milli-seconds to wait for shutdown before
|
||||
* killing the collection process.
|
||||
*/
|
||||
public void shutDown(int shutdownTimeout) throws InterruptedException {
|
||||
_isRunning = false;
|
||||
|
||||
_executorService.shutdown();
|
||||
_executorService.shutdownNow();
|
||||
// Wait for collectStatistics runnable to finish so that disposal of
|
||||
// statistics does not cause any exceptions to be thrown.
|
||||
_executorService.awaitTermination(Integer.MAX_VALUE, TimeUnit.SECONDS);
|
||||
_executorService.awaitTermination(shutdownTimeout, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
private Runnable collectStatistics() {
|
||||
@@ -62,6 +68,9 @@ public class StatisticsCollector {
|
||||
public void run() {
|
||||
while (_isRunning) {
|
||||
try {
|
||||
if(Thread.currentThread().isInterrupted()) {
|
||||
break;
|
||||
}
|
||||
for(StatsCollectorInput statsCollectorInput :
|
||||
_statsCollectorInputList) {
|
||||
Statistics statistics = statsCollectorInput.getStatistics();
|
||||
@@ -86,7 +95,7 @@ public class StatisticsCollector {
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new RuntimeException("Thread got interrupted!", e);
|
||||
break;
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new RuntimeException("Error while calculating statistics", e);
|
||||
|
||||
Reference in New Issue
Block a user