[jboss-cvs] JBoss Messaging SVN: r5899 - trunk/src/main/org/jboss/messaging/core/management/impl.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Feb 19 07:24:56 EST 2009


Author: jmesnil
Date: 2009-02-19 07:24:56 -0500 (Thu, 19 Feb 2009)
New Revision: 5899

Modified:
   trunk/src/main/org/jboss/messaging/core/management/impl/ReplicationOperationInvokerImpl.java
Log:
synchronized the invoke() method since the ReplicationOperationInvoker is shared by all the JBM MBeans to replicate the management operations.

Modified: trunk/src/main/org/jboss/messaging/core/management/impl/ReplicationOperationInvokerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/ReplicationOperationInvokerImpl.java	2009-02-19 04:08:32 UTC (rev 5898)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/ReplicationOperationInvokerImpl.java	2009-02-19 12:24:56 UTC (rev 5899)
@@ -59,8 +59,6 @@
 
    private final SimpleString managementAddress;
 
-   private final ClientSessionFactory sf;
-
    private ClientSession clientSession;
 
    private ClientRequestor requestor;
@@ -75,27 +73,26 @@
 
    public ReplicationOperationInvokerImpl(final String clusterPassword,
                                          final SimpleString managementAddress,
-                                         final long managementRequestTimeout) throws Exception
+                                         final long managementRequestTimeout)
    {
       this.timeout = managementRequestTimeout;
       this.clusterPassword = clusterPassword;
       this.managementAddress = managementAddress;
-      sf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
    }
 
    // Public --------------------------------------------------------
 
-   public Object invoke(final ObjectName objectName,
+   public synchronized Object invoke(final ObjectName objectName,
                                            final String operationName,
                                            final Object... parameters) throws Exception
    {
       if (clientSession == null)
       {
+         ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
          clientSession = sf.createSession(CLUSTER_ADMIN_USER, clusterPassword, false, true, true, false, 1);
          requestor = new ClientRequestor(clientSession, managementAddress);
          clientSession.start();
       }
-
       ClientMessage mngmntMessage = clientSession.createClientMessage(false);
       ManagementHelper.putOperationInvocation(mngmntMessage, objectName, operationName, parameters);
       ClientMessage reply = requestor.request(mngmntMessage, timeout);
@@ -111,7 +108,7 @@
       else
       {
          throw new Exception(ManagementHelper.getOperationExceptionMessage(reply));
-      }
+      }      
    }
    
    public void stop() 




More information about the jboss-cvs-commits mailing list