OW2 Consortium joram

Compare Revisions

Ignore whitespace Rev 6472 → Rev 6473

/trunk/joram/joram/mom/core/src/main/java/org/objectweb/joram/mom/dest/AcquisitionQueue.java
25,6 → 25,7
import java.util.Properties;
 
import org.objectweb.joram.mom.notifications.ClientMessages;
import org.objectweb.joram.shared.DestinationConstants;
import org.objectweb.joram.shared.excepts.AccessException;
import org.objectweb.joram.shared.excepts.RequestException;
import org.objectweb.util.monolog.api.BasicLevel;
70,9 → 71,6
private long diff_max = 20;
private long diff_min = 10;
private String ACQ_QUEUE_MAX_MSG = "acquisition.max_msg";
private String ACQ_QUEUE_MIN_MSG = "acquisition.min_msg";
/**
* Returns the maximum number of acquired messages waiting to be handled by
* the destination. When the number of messages waiting to be handled is greater
102,9 → 100,6
private long pending_max = 20;
private long pending_min = 10;
private String ACQ_QUEUE_MAX_PND = "acquisition.max_pnd";
private String ACQ_QUEUE_MIN_PND = "acquisition.min_pnd";
/**
* Returns the maximum number of waiting messages in the destination. When the number
* of waiting messages is greater the acquisition handler is temporarily stopped.
154,14 → 149,14
this.properties = properties;
diff_max = Long.parseLong(properties.getProperty(ACQ_QUEUE_MAX_MSG, String.valueOf(diff_max)));
diff_min = Long.parseLong(properties.getProperty(ACQ_QUEUE_MIN_MSG, String.valueOf(diff_min)));
diff_max = Long.parseLong(properties.getProperty(DestinationConstants.ACQ_QUEUE_MAX_MSG, String.valueOf(diff_max)));
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(ACQ_QUEUE_MAX_PND, String.valueOf(pending_max)));
pending_min = Long.parseLong(properties.getProperty(ACQ_QUEUE_MIN_PND, String.valueOf(pending_min)));
pending_max = Long.parseLong(properties.getProperty(DestinationConstants.ACQ_QUEUE_MAX_PND, String.valueOf(pending_max)));
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;
173,11 → 168,11
// Acquisition class name can only be set the first time.
if (firstTime) {
if (properties != null) {
acquisitionClassName = properties.getProperty(AcquisitionModule.CLASS_NAME);
properties.remove(AcquisitionModule.CLASS_NAME);
acquisitionClassName = properties.getProperty(DestinationConstants.ACQUISITION_CLASS_NAME);
properties.remove(DestinationConstants.ACQUISITION_CLASS_NAME);
}
if (acquisitionClassName == null) {
throw new RequestException("Acquisition class name not found: " + AcquisitionModule.CLASS_NAME
throw new RequestException("Acquisition class name not found: " + DestinationConstants.ACQUISITION_CLASS_NAME
+ " property must be set on queue creation.");
}
try {
288,6 → 283,19
}
 
/**
* Start the handler.
* To be use by MBean interface
*/
@Override
public void start() {
try {
startHandler(properties);
} catch (Exception exc) {
logger.log(BasicLevel.ERROR, "AcquisitionQueue.start(" + properties + ')');
}
}
 
/**
* Stop the handler.
*
* @param prop properties for stop if needed
305,6 → 313,19
}
 
/**
* Stop the handler.
* To be use by MBean interface
*/
@Override
public void stop() {
try {
stopHandler(properties);
} catch (Exception exc) {
logger.log(BasicLevel.ERROR, "AcquisitionQueue.start(" + properties + ')');
}
}
 
/**
* This method process messages from the acquisition module.
* The method addClientMessages of base implementation is used to handle
* incoming messages.
375,5 → 396,4
// Not defined: still not encodable
return -1;
}
 
}