Commit f3226cef authored by Andre Freyssinet's avatar Andre Freyssinet

Disables flow control if max value is less than 0.

Adds a JMX attribute to monitor the handler status.
parent 47d9ef21
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2010 - 2015 ScalAgent Distributed Technologies
* Copyright (C) 2010 - 2021 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -180,16 +180,25 @@ public class AcquisitionQueue extends Queue implements AcquisitionQueueMBean {
this.properties = properties;
diff_max = Long.parseLong(properties.getProperty(DestinationConstants.ACQ_QUEUE_MAX_MSG, String.valueOf(diff_max)));
if (diff_max <= 0) {
// Flow-control is disabled
diff_max = diff_min = 0;
} else {
diff_min = Long.parseLong(properties.getProperty(DestinationConstants.ACQ_QUEUE_MIN_MSG, String.valueOf(diff_min)));
if (diff_max < 2) diff_max = 2;
if (diff_min >= diff_max) diff_min = diff_max -2;
if (diff_min < 0) diff_min = 0;
}
pending_max = Long.parseLong(properties.getProperty(DestinationConstants.ACQ_QUEUE_MAX_PND, String.valueOf(pending_max)));
if (pending_max <= 0) {
pending_max = pending_min = 0;
} else {
pending_min = Long.parseLong(properties.getProperty(DestinationConstants.ACQ_QUEUE_MIN_PND, String.valueOf(pending_min)));
if (pending_max < 2) pending_max = 2;
if (pending_min >= pending_max) pending_min = pending_max -2;
if (pending_min < 0) pending_min = 0;
}
if (logger.isLoggable(BasicLevel.INFO))
logger.log(BasicLevel.INFO,
......@@ -295,6 +304,19 @@ public class AcquisitionQueue extends Queue implements AcquisitionQueueMBean {
return null;
}
/**
* Returns the acquisition handler status.
* To be use by MBean interface.
*
* @return the acquisition handler status.
*/
@Override
public boolean isHandlerRunning() {
if (acquisitionModule == null)
return false;
return acquisitionModule.isRunning();
}
/**
* Start the handler.
*
......
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2010 - 2017 ScalAgent Distributed Technologies
* Copyright (C) 2010 - 2021 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -76,6 +76,12 @@ public interface AcquisitionQueueMBean extends QueueMBean, AcquisitionMBean {
public String dumpProperties();
/**
* Returns the acquisition handler status.
* @return the acquisition handler status.
*/
public boolean isHandlerRunning();
/**
* Starts the handler.
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment