Commit c0fb60d8 authored by Andre Freyssinet's avatar Andre Freyssinet

Adds JMX monitoring for acquisition handler.

parent d51c33e9
/*
* 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
......@@ -48,7 +48,7 @@ import fr.dyade.aaa.common.Debug;
*/
public class AcquisitionModule implements ReliableTransmitter {
public static Logger logger = Debug.getLogger(AcquisitionModule.class.getName());
/** Verify that one and only one correct interface is implemented. */
public static void checkAcquisitionClass(String className) throws Exception {
if (className == null) {
......@@ -70,11 +70,9 @@ public class AcquisitionModule implements ReliableTransmitter {
clazz = clazz.getSuperclass();
}
if (isDaemon && isHandler) {
throw new Exception("Acquisition class " + className
+ " can't implement both AcquisitionHandler and AcquisitionDaemon interfaces.");
throw new Exception("Acquisition class " + className + " can't implement both AcquisitionHandler and AcquisitionDaemon interfaces.");
} else if (!isDaemon && !isHandler) {
throw new Exception("Acquisition class " + className
+ " must implement either AcquisitionHandler or AcquisitionDaemon interface.");
throw new Exception("Acquisition class " + className + " must implement either AcquisitionHandler or AcquisitionDaemon interface.");
}
}
......@@ -129,6 +127,10 @@ public class AcquisitionModule implements ReliableTransmitter {
/** <code>true</code> if the acquisition daemon is running. */
private boolean running;
public boolean isRunning() {
return running;
}
public AcquisitionModule(Destination destination, String className, Properties properties) {
if (logger.isLoggable(BasicLevel.DEBUG)) {
logger.log(BasicLevel.DEBUG, "AcquisitionModule.<init> prop = " + properties);
......
/*
* 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
......@@ -295,6 +295,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
......@@ -72,10 +72,15 @@ public interface AcquisitionQueueMBean extends QueueMBean, AcquisitionMBean {
* @return the minimum threshold of waiting messages in the destination.
*/
long getPendingMin();
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