public EventLogQueue(Metrics metrics, int max,
String[] types, String[] actions) {
this.lookupTime = metrics.timer(this, "lookupTime");
this.processTime = metrics.timer(this, "processTime");
this.nextCount = metrics.counter(this, "nextCount");
this.priorityCount = metrics.counter(this, "priorityCount");
this.regularCount = metrics.counter(this, "regularCount");
this.failureCount = metrics.counter(this, "failureCount");
long memory = Runtime.getRuntime().maxMemory();
long queueBytes = max * 100;
if (queueBytes > (.25 * memory)) {
this.max = max/10;
log.warn("max_partition_size set to more than 25% of "
+ "total heap size. Reducing by 1/10th to {}", this.max);
} else {
this.max = max;
}
this.types = Arrays.asList(types);
this.actions = Arrays.asList(actions);
this.data = new Data(priorityCount, regularCount, failureCount,
this.types);
}