ASTERIXDB-1460: Fix log level crashing CC on start
The Hyracks CC would nullpoint on startup if the log level was
greater than FINEST. This works around the core issue that's in
ASTERIXDB-1460 since in this instance the way the log level was used
would cause the CC to fail on startup where the log level was
equal to or greater than FINEST.
Change-Id: I720eca41fac312fc6cbdbb880162a5bc8b0357dc
Reviewed-on: https://asterix-gerrit.ics.uci.edu/870
Reviewed-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <hubailmor@gmail.com>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/work/WorkQueue.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/work/WorkQueue.java
index 7786db7..1f61543 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/work/WorkQueue.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/work/WorkQueue.java
@@ -28,7 +28,8 @@
public class WorkQueue {
private static final Logger LOGGER = Logger.getLogger(WorkQueue.class.getName());
- private static final Level COUNT_LOGGING_LEVEL = Level.FINEST;
+ //to be fixed when application vs. hyracks log level issues are sorted
+ private static final boolean DEBUG = false;
private final LinkedBlockingQueue<AbstractWork> queue;
private final WorkerThread thread;
@@ -48,7 +49,7 @@
thread = new WorkerThread();
stopSemaphore = new Semaphore(1);
stopped = true;
- if (LOGGER.isLoggable(COUNT_LOGGING_LEVEL)) {
+ if(DEBUG) {
enqueueCount = new AtomicInteger(0);
dequeueCount = new AtomicInteger(0);
}
@@ -60,7 +61,7 @@
} catch (InterruptedException e) {
throw new HyracksException(e);
}
- if (LOGGER.isLoggable(COUNT_LOGGING_LEVEL)) {
+ if (DEBUG) {
enqueueCount.set(0);
dequeueCount.set(0);
}
@@ -85,8 +86,8 @@
}
public void schedule(AbstractWork event) {
- if (LOGGER.isLoggable(COUNT_LOGGING_LEVEL)) {
- LOGGER.log(COUNT_LOGGING_LEVEL, "Enqueue (" + hashCode() + "): " + enqueueCount.incrementAndGet());
+ if (DEBUG) {
+ LOGGER.log(Level.FINEST, "Enqueue (" + hashCode() + "): " + enqueueCount.incrementAndGet());
}
if (LOGGER.isLoggable(Level.FINER)) {
LOGGER.finer("Scheduling: " + event);
@@ -120,8 +121,8 @@
} catch (InterruptedException e) {
continue;
}
- if (LOGGER.isLoggable(COUNT_LOGGING_LEVEL)) {
- LOGGER.log(COUNT_LOGGING_LEVEL,
+ if (DEBUG) {
+ LOGGER.log(Level.FINEST,
"Dequeue (" + WorkQueue.this.hashCode() + "): " + dequeueCount.incrementAndGet() + "/"
+ enqueueCount);
}