Commit 13fd3b40 authored by afreyssin's avatar afreyssin

Adds TCP paramters to JNDI service MBean (JORAM-240).

parent cb6c5ffa
......@@ -29,6 +29,8 @@ import org.objectweb.util.monolog.api.BasicLevel;
import fr.dyade.aaa.agent.AgentId;
import fr.dyade.aaa.agent.AgentServer;
import fr.dyade.aaa.jndi2.impl.Trace;
import fr.dyade.aaa.util.management.MXWrapper;
/**
* Class of a JNDI centralized server. This agent may be accessed either by
......@@ -95,13 +97,25 @@ public class JndiServer {
container.deploy();
}
try {
MXWrapper.registerMBean(tcpServer, "JNDI", "service=tcp");
} catch (Exception exc) {
Trace.logger.log(BasicLevel.WARN, " JNDI server jmx failed", exc);
}
tcpServer.start();
}
/**
* Stops the <code>JndiServer</code> service.
*/
public static void stopService() {
try {
MXWrapper.unregisterMBean("JNDI", "service=tcp");
} catch (Exception exc) {
Trace.logger.log(BasicLevel.WARN, "JNDI server jmx failed", exc);
}
tcpServer.stop();
}
......
......@@ -33,7 +33,7 @@ import fr.dyade.aaa.agent.AgentServer;
import fr.dyade.aaa.agent.Channel;
import fr.dyade.aaa.common.Daemon;
public class TcpServer {
public class TcpServer implements TcpServerMBean {
private volatile ServerSocket listen;
......@@ -52,6 +52,24 @@ public class TcpServer {
}
}
/**
* Gets the number of threads of the pool.
*
* @return the number of threads of the pool.
*/
public int getPoolSize() {
return monitors.length;
}
/**
* Gets the listen port of the server.
*
* @return the listen port of the server.
*/
public int getListenPort() {
return listen.getLocalPort();
}
public final void start() {
for (int i = 0; i < monitors.length; i++) {
monitors[i].start();
......
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2001 - 2010 ScalAgent Distributed Technologies
* Copyright (C) 1996 - 2000 Dyade
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Initial developer(s): Sofiane Chibani
* Contributor(s): ScalAgent Distributed Technologies
*/
package fr.dyade.aaa.jndi2.server;
public interface TcpServerMBean {
/**
* Gets the number of threads of the pool.
*
* @return the number of threads of the pool.
*/
public int getPoolSize();
/**
* Gets the listen port of the server.
*
* @return the listen port of the server.
*/
public int getListenPort();
}
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