[jboss-svn-commits] JBL Code SVN: r22388 - in labs/jbosstm/trunk: ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/utils and 9 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Sep 4 06:52:28 EDT 2008
Author: jhalliday
Date: 2008-09-04 06:52:27 -0400 (Thu, 04 Sep 2008)
New Revision: 22388
Modified:
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/recovery/RecoveryManager.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/recovery/TransactionStatusManager.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/utils/Utility.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/PeriodicRecovery.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/RecoveryManagerImple.java
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/utils/SocketProcessId.java
labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/jacorb/recoverycoordinators/JacOrbRCServiceInit.java
labs/jbosstm/trunk/ArjunaJTS/jts/etc/default-jts-properties.xml
labs/jbosstm/trunk/XTS/sar/META-INF/jboss-beans.xml
labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/XTSService.java
labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jta/TransactionManagerService.java
labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jta/TransactionManagerServiceMBean.java
labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jts/TransactionManagerService.java
labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jts/TransactionManagerServiceMBean.java
labs/jbosstm/trunk/qa/config/jbossjts-properties.xml
Log:
Adapt the JBossAS integration to support ServiceBindingManager for AS 5.0. Along the way, fix inconsistent port number for recovery manager (4711/4712 -> 4712). JBTM-394.
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/recovery/RecoveryManager.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/recovery/RecoveryManager.java 2008-09-04 10:50:12 UTC (rev 22387)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/recovery/RecoveryManager.java 2008-09-04 10:52:27 UTC (rev 22388)
@@ -1,20 +1,20 @@
/*
* JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
* See the copyright.txt in the distribution for a
- * full listing of individual contributors.
+ * full listing of individual contributors.
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
* v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
- *
+ *
* (C) 2005-2006,
* @author JBoss Inc.
*/
@@ -66,11 +66,11 @@
public void run ()
{
_theImple.scan();
-
+
if (_callback != null)
_callback.completed();
}
-
+
private RecoveryManagerImple _theImple;
private RecoveryScan _callback;
}
@@ -107,12 +107,12 @@
*
* @return the manager.
*/
-
+
public static synchronized final RecoveryManager manager () throws IllegalArgumentException
{
return manager(RecoveryManager.INDIRECT_MANAGEMENT);
}
-
+
/**
* Obtain a reference to the RecoveryManager singleton. If it hasn't
* been created yet then it will be. The manager can be created in a
@@ -135,10 +135,10 @@
if (_recoveryManager.mode() != mode)
throw new IllegalArgumentException();
}
-
+
return _recoveryManager;
}
-
+
/**
* Delay the start of the recovery manager thread when creating an indirect recovery manager.
*/
@@ -170,10 +170,10 @@
public final void scan (RecoveryScan callback)
{
ScanThread st = new ScanThread(_theImple, callback);
-
+
st.start();
}
-
+
/**
* Stop the periodic recovery manager waiting for any recovery scan in progress to complete
*/
@@ -197,7 +197,7 @@
* Suspend the recovery manager. If the recovery manager is in the process of
* doing recovery scans then it will be suspended afterwards, in order to
* preserve data integrity.
- *
+ *
* @param async false means wait for the recovery manager to finish any scans before returning.
*/
@@ -210,7 +210,7 @@
{
_theImple.resumeScan();
}
-
+
/**
* Start the recovery manager thread.
*/
@@ -234,7 +234,7 @@
* Remove a recovery module from the system.
*
* @param module The module to remove.
- * @param waitOnScan true if the remove operation should wait for any in-progress scan to complete
+ * @param waitOnScan true if the remove operation should wait for any in-progress scan to complete
*/
public final void removeModule (RecoveryModule module, boolean waitOnScan)
@@ -251,7 +251,7 @@
{
return _theImple.getModules();
}
-
+
/**
* Indicates what mode (INDIRECT_MANAGEMENT or DIRECT_MANAGEMENT)
* the recovery manager is configured for.
@@ -264,7 +264,7 @@
return _mode;
}
- public static InetAddress getRecoveryManagerHost(boolean useASBindAddress) throws UnknownHostException
+ public static InetAddress getRecoveryManagerHost() throws UnknownHostException
{
PropertyManager pm = PropertyManagerFactory.getPropertyManager("com.arjuna.ats.propertymanager", "recoverymanager");
@@ -272,7 +272,7 @@
return InetAddress.getLocalHost();
String hostPropName = com.arjuna.ats.arjuna.common.Environment.RECOVERY_MANAGER_ADDRESS;
- String host = ((useASBindAddress) ? Utility.getServerBindAddress(pm, hostPropName) : pm.getProperty(hostPropName));
+ String host = pm.getProperty(hostPropName);
return Utility.hostNameToInetAddress(host, "com.arjuna.ats.arjuna.recovery.RecoveryManager_2");
}
@@ -308,16 +308,13 @@
/**
* Obtain a client connection to the recovery manager
- *
- * @param useASBindAddress if true and the recovery manager is running within an appserver then
- * bind the socket to the same address that the AS is using. Otherwise use the environment config
- * to choose which address to bind to
+ *
* @return a bound client socket connection to the recovery manager
* @throws IOException
*/
- public static Socket getClientSocket (boolean useASBindAddress) throws IOException
+ public static Socket getClientSocket () throws IOException
{
- Socket socket = new Socket(getRecoveryManagerHost(useASBindAddress), getRecoveryManagerPort());
+ Socket socket = new Socket(getRecoveryManagerHost(), getRecoveryManagerPort());
if (tsLogger.arjLogger.isInfoEnabled())
{
@@ -327,7 +324,7 @@
return socket;
}
-
+
/**
* Run the RecoveryManager. See Administration manual for details.
*/
@@ -357,7 +354,7 @@
try
{
manager();
-
+
if (testMode)
System.out.println("Ready");
}
@@ -376,10 +373,10 @@
_mode = mode;
}
-
+
private RecoveryManagerImple _theImple = null;
private int _mode;
-
+
private static RecoveryManager _recoveryManager = null;
private static boolean delayRecoveryManagerThread ;
}
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/recovery/TransactionStatusManager.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/recovery/TransactionStatusManager.java 2008-09-04 10:50:12 UTC (rev 22387)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/recovery/TransactionStatusManager.java 2008-09-04 10:52:27 UTC (rev 22388)
@@ -1,20 +1,20 @@
/*
* JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
* See the copyright.txt in the distribution for a
- * full listing of individual contributors.
+ * full listing of individual contributors.
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
* v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
- *
+ *
* (C) 2005-2006,
* @author JBoss Inc.
*/
@@ -28,7 +28,7 @@
*
* $Id: TransactionStatusManager.java 2342 2006-03-30 13:06:17Z $
*/
-
+
package com.arjuna.ats.arjuna.recovery ;
import java.io.* ;
@@ -71,22 +71,22 @@
{
start( _defaultTsmService, null, -1 ) ;
}
-
+
public TransactionStatusManager( int port )
{
start( _defaultTsmService, null, port ) ;
}
-
+
public TransactionStatusManager( String serviceName )
{
start( serviceName, null, -1 ) ;
}
-
+
public TransactionStatusManager( String serviceName, int port )
{
start( serviceName, null, port ) ;
}
-
+
/**
* The work item to be executed.
*/
@@ -99,8 +99,8 @@
if (tsLogger.arjLoggerI18N.isInfoEnabled())
{
- tsLogger.arjLoggerI18N.info("com.arjuna.ats.arjuna.recovery.TransactionStatusManager_1",
- new Object[]{service.getClass().getName(),
+ tsLogger.arjLoggerI18N.info("com.arjuna.ats.arjuna.recovery.TransactionStatusManager_1",
+ new Object[]{service.getClass().getName(),
Integer.toString(serverSocket.getLocalPort())});
}
@@ -111,7 +111,7 @@
tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.recovery.TransactionStatusManager_2");
}
}
-
+
/**
* Removes the TransactionStatusManager from the object store
* and closes down the listener thread.
@@ -124,7 +124,7 @@
_listener.stopListener() ;
TransactionStatusManagerItem.removeThis( Utility.getProcessUid() ) ;
- }
+ }
}
/**
@@ -135,18 +135,18 @@
try
{
Class serviceClass = Thread.currentThread().getContextClassLoader().loadClass( serviceName ) ;
-
+
Service service = (Service) serviceClass.newInstance() ;
-
+
ServerSocket socketServer = getTsmServerSocket(host, port);
addService( service, socketServer ) ;
-
+
TransactionStatusManagerItem.createAndSave(socketServer.getInetAddress().getHostAddress(), socketServer.getLocalPort() ) ;
if (tsLogger.arjLoggerI18N.isInfoEnabled())
{
- tsLogger.arjLoggerI18N.info("com.arjuna.ats.arjuna.recovery.TransactionStatusManager_3",
+ tsLogger.arjLoggerI18N.info("com.arjuna.ats.arjuna.recovery.TransactionStatusManager_3",
new Object[]{Integer.toString(socketServer.getLocalPort()), socketServer.getInetAddress().getHostAddress(), serviceName});
}
}
@@ -154,7 +154,7 @@
{
if (tsLogger.arjLoggerI18N.isWarnEnabled())
{
- tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.recovery.TransactionStatusManager_4",
+ tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.recovery.TransactionStatusManager_4",
new Object[]{serviceName});
}
}
@@ -162,7 +162,7 @@
{
if (tsLogger.arjLoggerI18N.isWarnEnabled())
{
- tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.recovery.TransactionStatusManager_5",
+ tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.recovery.TransactionStatusManager_5",
new Object[]{serviceName});
}
}
@@ -170,7 +170,7 @@
{
if (tsLogger.arjLoggerI18N.isWarnEnabled())
{
- tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.recovery.TransactionStatusManager_6",
+ tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.recovery.TransactionStatusManager_6",
new Object[]{serviceName});
}
}
@@ -178,7 +178,7 @@
{
if (tsLogger.arjLoggerI18N.isWarnEnabled())
{
- tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.recovery.TransactionStatusManager_14",
+ tsLogger.arjLoggerI18N.warn("com.arjuna.ats.arjuna.recovery.TransactionStatusManager_14",
new Object[]{getListenerHostName(), getListenerPort(-1)});
}
@@ -225,7 +225,7 @@
PropertyManager pm = PropertyManagerFactory.getPropertyManager("com.arjuna.ats.propertymanager", "recoverymanager");
//pm = arjPropertyManager.propertyManager;
- return Utility.getServerBindAddress(pm, com.arjuna.ats.arjuna.common.Environment.TRANSACTION_STATUS_MANAGER_ADDRESS);
+ return pm.getProperty(com.arjuna.ats.arjuna.common.Environment.TRANSACTION_STATUS_MANAGER_ADDRESS);
}
/**
@@ -276,15 +276,15 @@
* Listener thread.
*/
private Listener _listener ;
-
+
/**
* Default service run on listener thread.
- */
+ */
private static final String _defaultTsmService = "com.arjuna.ats.arjuna.recovery.ActionStatusService" ;
/**
* Flag used to ensure finalize gets called just once.
- */
+ */
private boolean _finalizeCalled = false ;
/**
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/utils/Utility.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/utils/Utility.java 2008-09-04 10:50:12 UTC (rev 22387)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/utils/Utility.java 2008-09-04 10:52:27 UTC (rev 22388)
@@ -1,20 +1,20 @@
/*
* JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
* See the copyright.txt in the distribution for a
- * full listing of individual contributors.
+ * full listing of individual contributors.
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
* v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
- *
+ *
* (C) 2005-2006,
* @author JBoss Inc.
*/
@@ -24,7 +24,7 @@
* Arjuna Solutions Limited,
* Newcastle upon Tyne,
* Tyne and Wear,
- * UK.
+ * UK.
*
* $Id: Utility.java 2342 2006-03-30 13:06:17Z $
*/
@@ -57,7 +57,7 @@
/**
* Convert integer to hex String.
*/
-
+
public static String intToHexString (int number) throws NumberFormatException
{
return Integer.toString(number, 16);
@@ -73,7 +73,7 @@
{
boolean isNeg;
String toUse = s;
-
+
if (s.startsWith(Utility.hexStart))
toUse = s.substring(Utility.hexStart.length());
@@ -90,9 +90,9 @@
Integer i = Integer.valueOf(toUse, 16);
int val = i.intValue();
-
+
val = val << 4;
-
+
if (isNeg) {
val -= Integer.valueOf(lastString, 16).intValue();
} else {
@@ -119,7 +119,7 @@
{
boolean isNeg;
String toUse = s;
-
+
if (s.startsWith(Utility.hexStart))
toUse = s.substring(Utility.hexStart.length());
@@ -136,9 +136,9 @@
Long i = Long.valueOf(toUse, 16);
long val = i.longValue();
-
+
val = val << 4;
-
+
if (isNeg) {
val -= Long.valueOf(lastString, 16).longValue();
} else {
@@ -146,7 +146,7 @@
}
return val;
- }
+ }
/**
* @return an integer representing the ip address of the local
@@ -169,17 +169,17 @@
{
InetAddress addr = InetAddress.getLocalHost();
byte[] b = addr.getAddress();
-
+
for (int i = 0; i < b.length; i++)
{
/*
* Convert signed byte into unsigned.
*/
-
+
int l = 0x7f & b[i];
l += (0x80 & b[i]);
-
+
myAddr = (myAddr << 8) | l;
}
}
@@ -188,24 +188,6 @@
}
/**
- * If the transaction service is running within a JBoss instance return the jboss bind port
- *
- * @param hostPropName the hostname property to use if running standalone (must not be null)
- * @return the host name
- */
- public static final String getServerBindAddress(PropertyManager pm, String hostPropName)
- {
- String host = System.getProperty(Environment.SERVER_BIND_ADDRESS);
-
- if (host == null)
- {
- host = pm.getProperty(hostPropName);
- }
-
- return host;
- }
-
- /**
* Convert a host name into an InetAddress object
*
* @param host if empty or null then the loopback address is used
@@ -287,11 +269,11 @@
*
* @since JTS 2.1.
*/
-
+
public static final int getpid ()
{
Process handle = getProcess();
-
+
return ((handle == null) ? -1 : handle.getpid());
}
@@ -312,7 +294,7 @@
public static final boolean isWindows ()
{
String os = arjPropertyManager.propertyManager.getProperty("os.name");
-
+
if (("WIN32".equals(os)) || (os.indexOf("Windows") != -1))
return true;
else
@@ -325,14 +307,14 @@
}
/**
- * @message com.arjuna.ats.arjuna.utils.Utility_1 [com.arjuna.ats.arjuna.utils.Utility_1] - Utility.getDefaultProcess - failed with
+ * @message com.arjuna.ats.arjuna.utils.Utility_1 [com.arjuna.ats.arjuna.utils.Utility_1] - Utility.getDefaultProcess - failed with
*/
public static final Process getDefaultProcess ()
{
try
{
Class c = Thread.currentThread().getContextClassLoader().loadClass(defaultProcessId);
-
+
return (Process) c.newInstance();
}
catch (Exception e)
@@ -349,14 +331,14 @@
{
processHandle = getDefaultProcess();
}
-
+
return processHandle;
}
-
+
private static int myAddr = 0;
private static Uid processUid = null;
private static Process processHandle = null;
-
+
private static final String hexStart = "0x";
private static final String defaultProcessId = "com.arjuna.ats.internal.arjuna.utils.SocketProcessId";
@@ -368,6 +350,6 @@
/**
* Maximum value for a socket port
*/
- public static final int MAX_PORT = 65535;
+ public static final int MAX_PORT = 65535;
}
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/PeriodicRecovery.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/PeriodicRecovery.java 2008-09-04 10:50:12 UTC (rev 22387)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/PeriodicRecovery.java 2008-09-04 10:52:27 UTC (rev 22388)
@@ -316,7 +316,7 @@
synchronized (PeriodicRecovery._socketLock)
{
if (_socket == null)
- _socket = new ServerSocket(RecoveryManager.getRecoveryManagerPort(), Utility.BACKLOG, RecoveryManager.getRecoveryManagerHost(true));
+ _socket = new ServerSocket(RecoveryManager.getRecoveryManagerPort(), Utility.BACKLOG, RecoveryManager.getRecoveryManagerHost());
return _socket;
}
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/RecoveryManagerImple.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/RecoveryManagerImple.java 2008-09-04 10:50:12 UTC (rev 22387)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/recovery/RecoveryManagerImple.java 2008-09-04 10:52:27 UTC (rev 22388)
@@ -1,20 +1,20 @@
/*
* JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
* See the copyright.txt in the distribution for a
- * full listing of individual contributors.
+ * full listing of individual contributors.
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
* v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
- *
+ *
* (C) 2005-2006,
* @author JBoss Inc.
*/
@@ -61,11 +61,11 @@
/**
* Does the work of setting up crash recovery.
- *
+ *
* @param threaded
* if <code>true</code> then the manager will start a separate
* thread to run recovery periodically.
- *
+ *
* @message com.arjuna.ats.internal.arjuna.recovery.RecoveryManagerImple_1
* [com.arjuna.ats.internal.arjuna.recovery.RecoveryManagerImple_1] -
* property io exception {0}
@@ -128,7 +128,7 @@
tsLogger.arjLoggerI18N.fatal(
"com.arjuna.ats.internal.arjuna.recovery.fail",
new Object[] {
- RecoveryManager.getRecoveryManagerHost(true), RecoveryManager.getRecoveryManagerPort()
+ RecoveryManager.getRecoveryManagerHost(), RecoveryManager.getRecoveryManagerPort()
}
);
}
@@ -228,20 +228,20 @@
* Suspend the recovery manager. If the recovery manager is in the process of
* doing recovery scans then it will be suspended afterwards, in order to
* preserve data integrity.
- *
+ *
* @param async false means wait for the recovery manager to finish any scans before returning.
*/
-
+
public void suspendScan (boolean async)
{
_periodicRecovery.suspendScan(async);
}
-
+
public void resumeScan ()
{
_periodicRecovery.resumeScan();
}
-
+
public void finalize ()
{
stop(true);
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/utils/SocketProcessId.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/utils/SocketProcessId.java 2008-09-04 10:50:12 UTC (rev 22387)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/utils/SocketProcessId.java 2008-09-04 10:52:27 UTC (rev 22388)
@@ -1,20 +1,20 @@
/*
* JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
* See the copyright.txt in the distribution for a
- * full listing of individual contributors.
+ * full listing of individual contributors.
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
* v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
- *
+ *
* (C) 2005-2006,
* @author JBoss Inc.
*/
@@ -24,7 +24,7 @@
* Hewlett-Packard Arjuna Labs,
* Newcastle upon Tyne,
* Tyne and Wear,
- * UK.
+ * UK.
*
* $Id: SocketProcessId.java 2342 2006-03-30 13:06:17Z $
*/
@@ -58,11 +58,11 @@
* @return the process id. This had better be unique between processes
* on the same machine. If not we're in trouble!
*
- * @message com.arjuna.ats.internal.arjuna.utils.SocketProcessId_1 [com.arjuna.ats.internal.arjuna.utils.SocketProcessId_1]- Invalid port specified
+ * @message com.arjuna.ats.internal.arjuna.utils.SocketProcessId_1 [com.arjuna.ats.internal.arjuna.utils.SocketProcessId_1]- Invalid port specified
* @message com.arjuna.ats.internal.arjuna.utils.SocketProcessId_2 [com.arjuna.ats.internal.arjuna.utils.SocketProcessId_2] - SocketProcessId.getpid could not get unique port.
* @message com.arjuna.ats.internal.arjuna.utils.SocketProcessId_3 [com.arjuna.ats.internal.arjuna.utils.SocketProcessId_3]- Invalid value for SocketProcessIdMaxPorts specified {0}
*/
-
+
public int getpid ()
{
synchronized (SocketProcessId._lock)
@@ -78,7 +78,7 @@
"com.arjuna.ats.internal.arjuna.utils.SocketProcessId_3",
0, Utility.MAX_PORT);
int maxPort;
-
+
if (maxPorts <= 1)
{
maxPort = port;
@@ -103,7 +103,7 @@
if (_thePort == -1)
throw new FatalError(tsLogger.log_mesg.getString("com.arjuna.ats.internal.arjuna.utils.SocketProcessId_2"));
-
+
return _thePort;
}
@@ -111,7 +111,7 @@
{
try
{
- return new ServerSocket(port);
+ return new ServerSocket(port, 0, InetAddress.getLocalHost());
}
catch (IOException e)
{
@@ -126,7 +126,7 @@
return _theSocket;
}
}
-
+
private static int _thePort = 0;
private static ServerSocket _theSocket = null;
private static final Object _lock = new Object();
@@ -136,5 +136,5 @@
*/
private static final int _defaultPort = 0 ;
-
+
}
Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/jacorb/recoverycoordinators/JacOrbRCServiceInit.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/jacorb/recoverycoordinators/JacOrbRCServiceInit.java 2008-09-04 10:50:12 UTC (rev 22387)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/jacorb/recoverycoordinators/JacOrbRCServiceInit.java 2008-09-04 10:52:27 UTC (rev 22388)
@@ -1,8 +1,8 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
- * See the copyright.txt in the distribution for a full listing
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
* of individual contributors.
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
@@ -14,7 +14,7 @@
* v.2.1 along with this distribution; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
- *
+ *
* (C) 2005-2006,
* @author JBoss Inc.
*/
@@ -24,7 +24,7 @@
* Arjuna Solutions Limited,
* Newcastle upon Tyne,
* Tyne and Wear,
- * UK.
+ * UK.
*
* $Id: JacOrbRCServiceInit.java 2342 2006-03-30 13:06:17Z $
*
@@ -83,25 +83,25 @@
public JacOrbRCServiceInit()
{
}
-
+
/**
* Provide the POA for the recoverycoordinator.
* Construct with the policies appropriate for its use in the RecoveryManager,
* but the policies are usable by the JacOrbRCManager to create the IOR's in
* TS-using processes.
*/
-
+
static POA getRCPOA (String domainName)
{
String rcServiceName = GenericRecoveryCreator.getRecCoordServiceName();
if (jtsLogger.logger.isDebugEnabled())
{
- jtsLogger.logger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_CRASH_RECOVERY,
+ jtsLogger.logger.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_CRASH_RECOVERY,
"JacOrbRCServiceInit.getRCPOA " + rcServiceName );
}
-
+
if (_poa == null)
{
String poaName = POA_NAME_PREFIX + rcServiceName+domainName;
@@ -117,8 +117,8 @@
{
_orb = com.arjuna.orbportability.internal.InternalORB.getInstance("RecoveryServer");
String[] params = null;
- String recoveryManagerPort = jtsPropertyManager.propertyManager.getProperty(com.arjuna.ats.jts.common.Environment.RECOVERY_MANAGER_PORT, "4711");
- String recoveryManagerAddr = Utility.getServerBindAddress(jtsPropertyManager.propertyManager, com.arjuna.ats.jts.common.Environment.RECOVERY_MANAGER_ADDRESS);
+ String recoveryManagerPort = jtsPropertyManager.propertyManager.getProperty(com.arjuna.ats.jts.common.Environment.RECOVERY_MANAGER_PORT, "4712");
+ String recoveryManagerAddr = jtsPropertyManager.propertyManager.getProperty(com.arjuna.ats.jts.common.Environment.RECOVERY_MANAGER_ADDRESS);
if (recoveryManagerAddr == null)
recoveryManagerAddr = "";
@@ -154,7 +154,7 @@
p.setProperty(oaAddr, recoveryManagerAddr);
System.setProperty(oaAddr, oldAddr);
}
-
+
_orb.initORB(params, p);
_oa = OA.getRootOA(_orb);
@@ -179,7 +179,7 @@
jtsLogger.loggerI18N.info("com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRCServiceInit_6a", new java.lang.Object[]{oldPort});
}
}
-
+
try
{
/*
@@ -206,11 +206,11 @@
org.omg.CORBA.ORB theORB = _orb.orb();
org.omg.PortableServer.POA rootPOA = _oa.rootPoa ();
-
+
// create direct persistent POA
// make the policy lists, with standard policies
org.omg.CORBA.Policy[] policies = null;
-
+
policies = new Policy []
{
rootPOA.create_lifespan_policy(LifespanPolicyValue.PERSISTENT),
@@ -219,7 +219,7 @@
rootPOA.create_id_uniqueness_policy(IdUniquenessPolicyValue.MULTIPLE_ID),
rootPOA.create_request_processing_policy(RequestProcessingPolicyValue.USE_DEFAULT_SERVANT)
};
-
+
_poa = rootPOA.create_POA(poaName, rootPOA.the_POAManager(), policies);
}
catch (Exception ex)
@@ -227,33 +227,33 @@
jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRCServiceInit_1",ex);
}
}
-
- return _poa;
+
+ return _poa;
}
-
+
/**
* This starts the service in the RecoveryManager.
*/
-
+
public boolean startRCservice ()
{
POA ourPOA = getRCPOA("recovery_coordinator");
-
- try
+
+ try
{
// get the orb, so we can pass it to the default servant
-
+
// make the default servant
JacOrbRCDefaultServant theButler = new JacOrbRCDefaultServant(_orb.orb());
-
+
// register it on the POA
ourPOA.set_servant(theButler);
-
- org.omg.CORBA.Object obj = ourPOA.create_reference_with_id("RecoveryManager".getBytes(),
+
+ org.omg.CORBA.Object obj = ourPOA.create_reference_with_id("RecoveryManager".getBytes(),
RecoveryCoordinatorHelper.id());
-
- // Write the object refenece in the file
+ // Write the object refenece in the file
+
String reference = _orb.orb().object_to_string(obj);
try
@@ -271,34 +271,34 @@
{
jtsLogger.loggerI18N.fatal("com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRCServiceInit_5");
}
-
+
if (jtsLogger.loggerI18N.isDebugEnabled())
{
- jtsLogger.loggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
- FacilityCode.FAC_CRASH_RECOVERY,
+ jtsLogger.loggerI18N.debug(DebugLevel.FUNCTIONS, VisibilityLevel.VIS_PUBLIC,
+ FacilityCode.FAC_CRASH_RECOVERY,
"com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRCServiceInit_2");
}
-
- // activate the poa
-
+
+ // activate the poa
+
_oa.rootPoa().the_POAManager().activate();
-
+
//_oa.run();
ORBRunner _runOA = new ORBRunner();
-
+
return true;
} catch (Exception ex) {
jtsLogger.loggerI18N.warn("com.arjuna.ats.internal.jts.orbspecific.jacorb.recoverycoordinators.JacOrbRCServiceInit_3", ex);
return false;
- }
-
+ }
+
}
-
+
public static void shutdownRCService ()
{
_poa = null;
}
-
+
public static String type ()
{
return "/RecoveryCoordinator";
@@ -306,12 +306,12 @@
private static final String POA_NAME_PREFIX = "RcvCo-";
-
+
protected static POA _poa = null;
-
+
protected static com.arjuna.orbportability.ORB _orb = null;
protected static com.arjuna.orbportability.RootOA _oa = null;
-
+
protected static String RecoveryIdStore = "RecoveryCoordinatorIdStore";
protected static String RecoveryCoordStore = "RecoveryCoordinator";
@@ -320,8 +320,8 @@
private ObjectStore currentStore;
static protected String uid4Recovery = "52e38d0c:c91:4140398c:0";
-
-
+
+
};
Modified: labs/jbosstm/trunk/ArjunaJTS/jts/etc/default-jts-properties.xml
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/etc/default-jts-properties.xml 2008-09-04 10:50:12 UTC (rev 22387)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/etc/default-jts-properties.xml 2008-09-04 10:52:27 UTC (rev 22388)
@@ -2,8 +2,8 @@
<!--
JBoss, Home of Professional Open Source
Copyright 2006, Red Hat Middleware LLC, and individual contributors
- as indicated by the @author tags.
- See the copyright.txt in the distribution for a full listing
+ as indicated by the @author tags.
+ See the copyright.txt in the distribution for a full listing
of individual contributors.
This copyrighted material is made available to anyone wishing to use,
modify, copy, or redistribute it subject to the terms and conditions
@@ -16,7 +16,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
-
+
(C) 2005-2006,
@author JBoss Inc.
-->
@@ -24,7 +24,7 @@
<!--
These options are described in the ArjunaJTS manual.
Defaults are provided here for convenience only.
-
+
Please read through this file prior to using the system, and consider
updating the specified entries.
-->
@@ -89,7 +89,7 @@
<property
name="com.arjuna.ats.jts.contextPropMode"
value="INTERPOSITION"/>
-
+
</properties>
<properties name="orbportability">
@@ -137,7 +137,7 @@
-->
<property
name="com.arjuna.ats.jts.recoveryManagerPort"
- value="4711"/>
+ value="4712"/>
<!--
This property controls the address on which the Recovery ORB binds - defaults to the loopback connection
Modified: labs/jbosstm/trunk/XTS/sar/META-INF/jboss-beans.xml
===================================================================
--- labs/jbosstm/trunk/XTS/sar/META-INF/jboss-beans.xml 2008-09-04 10:50:12 UTC (rev 22387)
+++ labs/jbosstm/trunk/XTS/sar/META-INF/jboss-beans.xml 2008-09-04 10:52:27 UTC (rev 22388)
@@ -6,7 +6,31 @@
<depends>jboss.web:service=WebServer</depends>
<depends>jboss:service=TransactionManager</depends>
- <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
+ <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
+
+
+ <property name="httpBindInetAddress">
+ <value-factory bean="ServiceBindingManager"
+ method="getInetAddressBinding" >
+ <parameter>jboss.web:service=WebServer</parameter>
+ </value-factory>
+ </property>
+
+ <property name="httpPort">
+ <value-factory bean="ServiceBindingManager"
+ method="getIntBinding" >
+ <parameter>jboss.web:service=WebServer</parameter>
+ </value-factory>
+ </property>
+
+ <property name="httpsPort">
+ <value-factory bean="ServiceBindingManager"
+ method="getIntBinding" >
+ <parameter>jboss.web:service=WebServer</parameter>
+ <parameter>HttpsConnector</parameter>
+ </value-factory>
+ </property>
+
</bean>
</deployment>
\ No newline at end of file
Modified: labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/XTSService.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/XTSService.java 2008-09-04 10:50:12 UTC (rev 22387)
+++ labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/XTSService.java 2008-09-04 10:52:27 UTC (rev 22388)
@@ -79,6 +79,7 @@
import javax.management.JMException;
import javax.management.MBeanServer;
import java.util.Set;
+import java.net.InetAddress;
//import com.arjuna.ats.arjuna.recovery.RecoveryModule;
/**
@@ -137,25 +138,31 @@
// bind address and the web service port so they services register themselves
// in the registry using the correct URL
- // the Transaction Service initialization saves the server bind address using a System
- // property. we can use this to define the binding address used by the XTS services
+ // the app server's MicroContainer and ServiceBindingManager should work together
+ // to supply us the properties used by the web server. Check that it's done so:
+ // if this blows up, changes are binding.xml or XTS's jboss-beans.xml is broken.
+ if(httpBindInetAddress == null || (httpPort == 0 && httpsPort == 0)) {
+ log.error("insufficient webserver address:port information available - unable to start XTS.");
+ throw new Exception("insufficient webserver address:port information available - unable to start XTS.");
+ }
- String bindAddress = System.getProperty(com.arjuna.ats.arjuna.common.Environment.SERVER_BIND_ADDRESS);
+ // The app servers gives us a InetAddress, but our config system is String based.
+ // so we convert it here, then XTS internally convert it back later. sigh.
+ // likewise for ints to Strings for hte port numbers.
+
+ String bindAddress = httpBindInetAddress.getHostAddress();
+
System.setProperty(com.arjuna.wsc.common.Environment.XTS_BIND_ADDRESS, bindAddress);
System.setProperty(com.arjuna.wsc11.common.Environment.XTS_BIND_ADDRESS, bindAddress);
- // the web service exposes its listen port somehow or other
- String bindPortString = getConnectorPort("HTTP/1.1", false);
- String secureBindPortString = getConnectorPort("HTTP/1.1", true);
-
- if (bindPortString != null) {
- System.setProperty(com.arjuna.wsc.common.Environment.XTS_BIND_PORT, bindPortString);
- System.setProperty(com.arjuna.wsc11.common.Environment.XTS_BIND_PORT, bindPortString);
+ if(httpPort != 0) {
+ System.setProperty(com.arjuna.wsc.common.Environment.XTS_BIND_PORT, ""+httpPort);
+ System.setProperty(com.arjuna.wsc11.common.Environment.XTS_BIND_PORT, ""+httpPort);
}
- if (secureBindPortString != null) {
- System.setProperty(com.arjuna.wsc.common.Environment.XTS_SECURE_BIND_PORT, secureBindPortString);
- System.setProperty(com.arjuna.wsc11.common.Environment.XTS_SECURE_BIND_PORT, secureBindPortString);
+ if(httpsPort != 0) {
+ System.setProperty(com.arjuna.wsc.common.Environment.XTS_SECURE_BIND_PORT, ""+httpsPort);
+ System.setProperty(com.arjuna.wsc11.common.Environment.XTS_SECURE_BIND_PORT, ""+httpsPort);
}
// see if the coordinatorURL or host/port has been specified on the command line
@@ -176,7 +183,7 @@
coordinatorHost = (bindAddress != null ? bindAddress : "127.0.0.1");
}
if (coordinatorPort == null) {
- coordinatorPort = (bindPortString != null ? bindPortString : "8080");
+ coordinatorPort = (httpPort != 0 ? ""+httpPort : "8080");
}
if (coordinatorPath == null) {
coordinatorPath = "ws-c10/soap/ActivationCoordinator";
@@ -201,7 +208,7 @@
coordinatorHost = (bindAddress != null ? bindAddress : "127.0.0.1");
}
if (coordinatorPort == null) {
- coordinatorPort = (bindPortString != null ? bindPortString : "8080");
+ coordinatorPort = (httpPort != 0 ? ""+httpPort : "8080");
}
if (coordinatorPath == null) {
coordinatorPath = "ws-c11/ActivationService";
@@ -217,48 +224,6 @@
TaskManagerInitialisation(); // com.arjuna.services.framework.admin.TaskManagerInitialisation : initialise the Task Manager
- /*
- * initialisation is done by 1.0/1.1 war files so as to allow us to iunclude either WS-COOR/AT/BA 1.0 or 1.1
- * or both
- */
- /*
- //// wscf.war:
-
- WSCFInitialisation(); // com.arjuna.mw.wsc.deploy.WSCFInitialisation: Initialise WSCF
-
- //// ws-c.war:
-
- TaskManagerInitialisation(); // com.arjuna.services.framework.admin.TaskManagerInitialisation : initialise the Task Manager
- ActivationCoordinatorInitialisation(); // com.arjuna.webservices.wscoor.server.ActivationCoordinatorInitialisation : Activate the Activation Coordinator service
- ActivationRequesterInitialisation(); // com.arjuna.webservices.wscoor.server.ActivationRequesterInitialisation : Activate the Activation Requester service
- RegistrationCoordinatorInitialisation(); // com.arjuna.webservices.wscoor.server.RegistrationCoordinatorInitialisation : Activate the Registration Coordinator service
- RegistrationRequesterInitialisation(); // com.arjuna.webservices.wscoor.server.RegistrationRequesterInitialisation : Activate the Registration Requester service
- CoordinationInitialisation(); // com.arjuna.wsc.messaging.deploy.CoordinationInitialisation : Initialise the coordination services.
- HttpClientInitialisation(); // com.arjuna.webservices.transport.http.HttpClientInitialisation : initialise the HTTP clients.
- // TODO: HTTP SOAP Service Multiplexor Servlet
-
- //// ws-t.war:
-
- TerminationParticipantInitialisation(); // com.arjuna.webservices.wsarjtx.server.TerminationParticipantInitialisation : Arjuna TX - Activate the Terminator Participant service
- TerminationCoordinatorInitialisation(); // com.arjuna.webservices.wsarjtx.server.TerminationCoordinatorInitialisation : Arjuna TX - Activate the Terminator Coordinator service
-
- CompletionCoordinatorInitialisation(); // com.arjuna.webservices.wsat.server.CompletionCoordinatorInitialisation : WS-AT - Activate the Completion Coordinator service
- CompletionInitiatorInitialisation(); // com.arjuna.webservices.wsat.server.CompletionInitiatorInitialisation : WS-AT - Activate the Completion Initiator service
- CoordinatorInitialisation(); // com.arjuna.webservices.wsat.server.CoordinatorInitialisation : WS-AT: Activate the Coordinator service
- ParticipantInitialisation(); // com.arjuna.webservices.wsat.server.ParticipantInitialisation : WS-AT - Activate the Participant service
-
- CoordinatorCompletionCoordinatorInitialisation(); // com.arjuna.webservices.wsba.server.CoordinatorCompletionCoordinatorInitialisation : WS-BA - Activate the Coordinator Completion Coordinator service
- CoordinatorCompletionParticipantInitialisation(); // com.arjuna.webservices.wsba.server.CoordinatorCompletionParticipantInitialisation : WS-BA - Activate the Coordinator Completion Participant service
- ParticipantCompletionCoordinatorInitialisation(); // com.arjuna.webservices.wsba.server.ParticipantCompletionCoordinatorInitialisation : WS-BA - Activate the Participant Completion Coordinator service
- ParticipantCompletionParticipantInitialisation(); // com.arjuna.webservices.wsba.server.ParticipantCompletionParticipantInitialisation : WS-BA - Activate the Participant Completion Participant service
-
- TransactionInitialisation(); // com.arjuna.wst.messaging.deploy.TransactionInitialisation : WS-T - Initialise the transaction services.
-
- //// wstx.war:
-
- WSTXInitialisation(); // com.arjuna.mw.wst.deploy.WSTXInitialisation : Initialise WSTX
- */
-
acCoordinatorRecoveryModule = new ACCoordinatorRecoveryModule();
// ensure Implementations are installed into the inventory before we register the module
@@ -313,291 +278,50 @@
taskManager.setMaximumWorkerCount(taskManagerMaxWorkerCount) ;
}
- /*
- * this is now done by war listeners -- see above for rationale
- ///////////////////////////////
-
- private void WSCFInitialisation() throws Exception
+ public MBeanServer getMbeanServer()
{
- //Configuration.initialise("/wscf.xml");
-
- final ContextFactoryMapper wscfImpl = ContextFactoryMapper.getFactory() ;
-
- wscfImpl.setSubordinateContextFactoryMapper(new ContextFactoryMapperImple());
+ return mbeanServer;
}
- private void TaskManagerInitialisation()
+ public void setMbeanServer(MBeanServer mbeanServer)
{
- final TaskManager taskManager = TaskManager.getManager() ;
- taskManager.setMinimumWorkerCount(taskManagerMinWorkerCount) ;
- taskManager.setMaximumWorkerCount(taskManagerMaxWorkerCount) ;
+ this.mbeanServer = mbeanServer;
}
- private void ActivationCoordinatorInitialisation()
- {
- final HandlerRegistry handlerRegistry = new HandlerRegistry() ;
+ private MBeanServer mbeanServer = null;
- // Add WS-Addressing
- AddressingPolicy.register(handlerRegistry) ;
- // Add Activation coordinator.
- ActivationCoordinatorPolicy.register(handlerRegistry) ;
+ ///////////////
- addToSOAPRegistry(CoordinationConstants.SERVICE_ACTIVATION_COORDINATOR, handlerRegistry);
- }
+ // These setters are used to allow MC/ServiceBindingManger to relay information from the Web server
+ // seee bindings.xml and jboss-beans.xml
- private void ActivationRequesterInitialisation()
- {
- final HandlerRegistry handlerRegistry = new HandlerRegistry() ;
-
- // Add WS-Addressing
- AddressingPolicy.register(handlerRegistry) ;
- // Add Activation coordinator.
- ActivationRequesterPolicy.register(handlerRegistry) ;
-
- addToSOAPRegistry(CoordinationConstants.SERVICE_ACTIVATION_REQUESTER, handlerRegistry);
+ public InetAddress getHttpBindInetAddress() {
+ return httpBindInetAddress;
}
- private void RegistrationCoordinatorInitialisation()
- {
- final HandlerRegistry handlerRegistry = getHandlerRegistry();
-
- // Add Registration coordinator.
- RegistrationCoordinatorPolicy.register(handlerRegistry) ;
-
- addToSOAPRegistry(CoordinationConstants.SERVICE_REGISTRATION_COORDINATOR, handlerRegistry);
+ public void setHttpBindInetAddress(InetAddress httpBindInetAddress) {
+ this.httpBindInetAddress = httpBindInetAddress;
}
- private void RegistrationRequesterInitialisation()
- {
- final HandlerRegistry handlerRegistry = new HandlerRegistry() ;
+ private InetAddress httpBindInetAddress = null;
- // Add WS-Addressing
- AddressingPolicy.register(handlerRegistry) ;
- // Add Registration coordinator.
- RegistrationRequesterPolicy.register(handlerRegistry) ;
-
- addToSOAPRegistry(CoordinationConstants.SERVICE_REGISTRATION_REQUESTER, handlerRegistry);
+ public int getHttpPort() {
+ return httpPort;
}
- private void CoordinationInitialisation()
- {
- ActivationCoordinatorProcessor.setCoordinator(new ActivationCoordinatorProcessorImpl()) ;
- RegistrationCoordinatorProcessor.setCoordinator(new RegistrationCoordinatorProcessorImpl()) ;
+ public void setHttpPort(int httpPort) {
+ this.httpPort = httpPort;
}
- private void HttpClientInitialisation()
- {
- final SoapRegistry soapRegistry = SoapRegistry.getRegistry() ;
- final SoapClient client = new HttpClient() ;
- soapRegistry.registerSoapClient("http", client) ;
- soapRegistry.registerSoapClient("https", client) ;
- }
+ int httpPort = 0;
- private void TerminationParticipantInitialisation()
- {
- final HandlerRegistry handlerRegistry = getHandlerRegistry();
-
- // Add Terminator coordinator.
- TerminationParticipantPolicy.register(handlerRegistry) ;
-
- addToSOAPRegistry(ArjunaTXConstants.SERVICE_TERMINATION_PARTICIPANT, handlerRegistry);
+ public int getHttpsPort() {
+ return httpsPort;
}
- private void TerminationCoordinatorInitialisation()
- {
- final HandlerRegistry handlerRegistry = getHandlerRegistry();
-
- // Add Terminator participant.
- TerminationCoordinatorPolicy.register(handlerRegistry) ;
-
- addToSOAPRegistry(ArjunaTXConstants.SERVICE_TERMINATION_COORDINATOR, handlerRegistry);
+ public void setHttpsPort(int httpsPort) {
+ this.httpsPort = httpsPort;
}
- private void CompletionCoordinatorInitialisation()
- {
- final HandlerRegistry handlerRegistry = getHandlerRegistry();
-
- // Add Completion coordinator.
- CompletionCoordinatorPolicy.register(handlerRegistry) ;
-
- addToSOAPRegistry(AtomicTransactionConstants.SERVICE_COMPLETION_COORDINATOR, handlerRegistry);
- }
-
- private void CompletionInitiatorInitialisation()
- {
- final HandlerRegistry handlerRegistry = getHandlerRegistry();
-
- // Add Completion initiator.
- CompletionInitiatorPolicy.register(handlerRegistry);
-
- addToSOAPRegistry(AtomicTransactionConstants.SERVICE_COMPLETION_INITIATOR, handlerRegistry);
- }
-
- private void CoordinatorInitialisation()
- {
- final HandlerRegistry handlerRegistry = getHandlerRegistry();
-
- // Add coordinator.
- CoordinatorPolicy.register(handlerRegistry) ;
-
- addToSOAPRegistry(AtomicTransactionConstants.SERVICE_COORDINATOR, handlerRegistry);
- }
-
- private void ParticipantInitialisation()
- {
- final HandlerRegistry handlerRegistry = getHandlerRegistry();
-
- // Add Participant.
- ParticipantPolicy.register(handlerRegistry) ;
-
- addToSOAPRegistry(AtomicTransactionConstants.SERVICE_PARTICIPANT, handlerRegistry);
- }
-
- private void CoordinatorCompletionCoordinatorInitialisation()
- {
- final HandlerRegistry handlerRegistry = getHandlerRegistry();
-
- // Add Coordinator Completion coordinator.
- CoordinatorCompletionCoordinatorPolicy.register(handlerRegistry) ;
-
- addToSOAPRegistry(BusinessActivityConstants.SERVICE_COORDINATOR_COMPLETION_COORDINATOR, handlerRegistry);
- }
-
- private void CoordinatorCompletionParticipantInitialisation()
- {
- final HandlerRegistry handlerRegistry = getHandlerRegistry();
-
- // Add Coordinator Completion participant.
- CoordinatorCompletionParticipantPolicy.register(handlerRegistry) ;
-
- addToSOAPRegistry(BusinessActivityConstants.SERVICE_COORDINATOR_COMPLETION_PARTICIPANT, handlerRegistry);
- }
-
- private void ParticipantCompletionCoordinatorInitialisation()
- {
- final HandlerRegistry handlerRegistry = getHandlerRegistry();
-
- // Add Participant Completion coordinator.
- ParticipantCompletionCoordinatorPolicy.register(handlerRegistry) ;
-
- addToSOAPRegistry(BusinessActivityConstants.SERVICE_PARTICIPANT_COMPLETION_COORDINATOR, handlerRegistry);
- }
-
- private void ParticipantCompletionParticipantInitialisation()
- {
- final HandlerRegistry handlerRegistry = getHandlerRegistry();
-
- // Add Participant Completion participant.
- ParticipantCompletionParticipantPolicy.register(handlerRegistry) ;
-
- addToSOAPRegistry(BusinessActivityConstants.SERVICE_PARTICIPANT_COMPLETION_PARTICIPANT, handlerRegistry);
- }
-
- private void TransactionInitialisation()
- {
- CompletionCoordinatorProcessor.setProcessor(new CompletionCoordinatorProcessorImpl()) ;
- ParticipantProcessor.setProcessor(new ParticipantProcessorImpl()) ;
- CoordinatorProcessor.setProcessor(new CoordinatorProcessorImpl()) ;
- TerminationCoordinatorProcessor.setProcessor(new TerminatorParticipantProcessorImpl()) ;
- CoordinatorCompletionParticipantProcessor.setProcessor(new CoordinatorCompletionParticipantProcessorImpl()) ;
- ParticipantCompletionParticipantProcessor.setProcessor(new ParticipantCompletionParticipantProcessorImpl()) ;
- CoordinatorCompletionCoordinatorProcessor.setProcessor(new CoordinatorCompletionCoordinatorProcessorImpl()) ;
- ParticipantCompletionCoordinatorProcessor.setProcessor(new ParticipantCompletionCoordinatorProcessorImpl()) ;
- }
-
- private void WSTXInitialisation() throws Exception
- {
- // we don't know if the servlet is inited yet since its deploy is async,
- // so play it safe and set the URL here too since UserTransactionImple needs it.
- System.setProperty("com.arjuna.mw.wst.coordinatorURL", "http://localhost:8080/jbossxts/soap/ActivationCoordinator");
-
- // wst.xml ignored. TODO: make these configurable again (mbean properties?):
- UserTransaction.setUserTransaction(new com.arjuna.mwlabs.wst.at.remote.UserTransactionImple());
- TransactionManager.setTransactionManager(new com.arjuna.mwlabs.wst.at.remote.TransactionManagerImple());
- UserBusinessActivity.setUserBusinessActivity(new com.arjuna.mwlabs.wst.ba.remote.UserBusinessActivityImple());
- BusinessActivityManager.setBusinessActivityManager(new com.arjuna.mwlabs.wst.ba.remote.BusinessActivityManagerImple());
-
- // TODO: should this really be after the above? At least one property from this file (coordinatorURL)
- // would seem to be required at an earlier stage.
- //Configuration.initialise("/wstx.xml");
-
- }
- ////
-
- private HandlerRegistry getHandlerRegistry() {
- final HandlerRegistry handlerRegistry = new HandlerRegistry() ;
-
- // Add WS-Addressing
- AddressingPolicy.register(handlerRegistry) ;
- // Add Arjuna handlers
- ArjunaPolicy.register(handlerRegistry) ;
-
- return handlerRegistry;
- }
-
- private void addToSOAPRegistry(String serviceName, HandlerRegistry handlerRegistry)
- {
- final SoapRegistry soapRegistry = SoapRegistry.getRegistry() ;
- soapRegistry.registerSoapService(serviceName, new SoapService(handlerRegistry)) ;
- }
- */
-
- private String getConnectorPort(final String protocol, final boolean secure)
- {
- int port = -1;
-
- try
- {
- ObjectName connectors = new ObjectName("jboss.web:type=Connector,*");
-
- Set connectorNames = getMbeanServer().queryNames(connectors, null);
- for (Object current : connectorNames)
- {
- ObjectName currentName = (ObjectName)current;
-
- try
- {
- int connectorPort = (Integer)getMbeanServer().getAttribute(currentName, "port");
- boolean connectorSecure = (Boolean)getMbeanServer().getAttribute(currentName, "secure");
- String connectorProtocol = (String)getMbeanServer().getAttribute(currentName, "protocol");
-
- if (protocol.equals(connectorProtocol) && secure == connectorSecure)
- {
- if (port > -1)
- {
- log.warn("Found multiple connectors for protocol='" + protocol + "' and secure='" + secure + "', using first port found '" + port + "'");
- }
- else
- {
- port = connectorPort;
- }
- }
- }
- catch (AttributeNotFoundException ignored)
- {
- }
- }
-
- if (port < 0) {
- return null;
- } else {
- return Integer.toString(port);
- }
- }
- catch (JMException e)
- {
- return null;
- }
- }
- public MBeanServer getMbeanServer()
- {
- return mbeanServer;
- }
-
- public void setMbeanServer(MBeanServer mbeanServer)
- {
- this.mbeanServer = mbeanServer;
- }
-
- private MBeanServer mbeanServer = null;
+ int httpsPort = 0;
}
\ No newline at end of file
Modified: labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jta/TransactionManagerService.java
===================================================================
--- labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jta/TransactionManagerService.java 2008-09-04 10:50:12 UTC (rev 22387)
+++ labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jta/TransactionManagerService.java 2008-09-04 10:52:27 UTC (rev 22388)
@@ -49,6 +49,8 @@
import com.arjuna.ats.arjuna.coordinator.TxStats;
import com.arjuna.ats.arjuna.recovery.RecoveryManager;
import com.arjuna.ats.arjuna.recovery.RecoveryModule;
+import com.arjuna.ats.arjuna.utils.Utility;
+import com.arjuna.ats.arjuna.common.arjPropertyManager;
import com.arjuna.ats.internal.tsmx.mbeans.PropertyServiceJMXPlugin;
import com.arjuna.common.util.propertyservice.PropertyManagerFactory;
@@ -61,6 +63,8 @@
import javax.transaction.TransactionManager;
import javax.transaction.UserTransaction;
import java.net.Socket;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintStream;
@@ -75,7 +79,7 @@
public class TransactionManagerService implements TransactionManagerServiceMBean, XAResourceRecoveryRegistry
{
/*
- deploy/transaction-beans.xml:
+ deploy/transaction-jboss-beans.xml:
<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="urn:jboss:bean-deployer:2.0">
@@ -120,6 +124,9 @@
private boolean configured;
private byte[] configuredLock = new byte[0] ;
+ private boolean isTransactionStatusManagerBindAddressSet;
+ private boolean isRecoveryManagerBindAddressSet;
+
private MBeanServer mbeanServer;
/**
@@ -137,6 +144,22 @@
{
synchronized(configuredLock)
{
+ // if the app server's ServerBindingManager has NOT been used to configure the listen addresses
+ // (which it should be by default via the binding.xml and transaction-jboss-beans.xml) then we
+ // want to fall back to using the SERVER_BIND_ADDRESS in preference to the value from the
+ // jbossjta-properties.xml. Belt and Braces...
+
+ InetAddress serverInetAddress = InetAddress.getByName(System.getProperty(ServerConfig.SERVER_BIND_ADDRESS));
+ if(!isRecoveryManagerBindAddressSet) {
+ setRecoveryInetAddress(serverInetAddress);
+ }
+ if(!isTransactionStatusManagerBindAddressSet) {
+ setTransactionStatusManagerInetAddress(serverInetAddress);
+ }
+
+ // we are now done configuring things. The transaction system gets unhappy if we change config
+ // once it's running, so prevent any further alterations before we start it up...
+
configured = true ;
}
@@ -149,7 +172,6 @@
System.setProperty(com.arjuna.ats.tsmx.TransactionServiceMX.AGENT_IMPLEMENTATION_PROPERTY,
com.arjuna.ats.internal.jbossatx.agent.LocalJBossAgentImpl.class.getName());
System.setProperty(Environment.LAST_RESOURCE_OPTIMISATION_INTERFACE, LastResource.class.getName()) ;
- System.setProperty(com.arjuna.ats.arjuna.common.Environment.SERVER_BIND_ADDRESS, System.getProperty(ServerConfig.SERVER_BIND_ADDRESS));
if (timeout != 0)
{
@@ -242,7 +264,7 @@
try
{
- Socket sckt = RecoveryManager.getClientSocket(getRunInVMRecoveryManager());
+ Socket sckt = RecoveryManager.getClientSocket();
in = new BufferedReader(new InputStreamReader(sckt.getInputStream()));
out = new PrintStream(sckt.getOutputStream());
@@ -257,7 +279,18 @@
}
catch (Exception ex)
{
- log.error("Failed to connect to recovery manager", ex);
+ try
+ {
+ InetAddress host = RecoveryManager.getRecoveryManagerHost();
+ int port = RecoveryManager.getRecoveryManagerPort();
+
+ log.error("Failed to connect to recovery manager on " + host.getHostAddress() + ':' + port);
+ }
+ catch (UnknownHostException e)
+ {
+ log.error("Failed to connect to recovery manager", ex);
+ }
+
active = false;
}
finally
@@ -649,4 +682,133 @@
Reference ref = new Reference(className, className, null);
new InitialContext().bind(jndiName, ref);
}
+
+ ///////////////////
+
+ // note that the address/port setters rely on having the property manager initialized first, or their settings
+ // would be overridden by those in the config files when the properties are loaded from file. Fortunatly the static
+ // block for the logging has the nice side effect of loading the config too, so it works out ok.
+
+ public InetAddress getTransactionStatusManagerInetAddress()
+ {
+ PropertyManager pm = PropertyManagerFactory.getPropertyManager("com.arjuna.ats.propertymanager", "recoverymanager");
+ try {
+ return Utility.hostNameToInetAddress(pm.getProperty(com.arjuna.ats.arjuna.common.Environment.TRANSACTION_STATUS_MANAGER_ADDRESS), "");
+ } catch(UnknownHostException e) {
+ log.warn("UnknownHostException from getTransactionStatusManagerInetAddress, input was: "+pm.getProperty(com.arjuna.ats.arjuna.common.Environment.TRANSACTION_STATUS_MANAGER_ADDRESS));
+ return null;
+ }
+ }
+
+ public void setTransactionStatusManagerInetAddress(InetAddress tsmInetAddress) throws IllegalStateException
+ {
+ synchronized(configuredLock)
+ {
+ if (configured)
+ {
+ if(!tsmInetAddress.getAddress().equals(getTransactionStatusManagerInetAddress().getAddress())) {
+ throw new IllegalStateException("Cannot set transactionStatusManagerInetAddress once the MBean has configured");
+ }
+ }
+ else
+ {
+ PropertyManager pm = PropertyManagerFactory.getPropertyManager("com.arjuna.ats.propertymanager", "recoverymanager");
+ pm.setProperty(com.arjuna.ats.arjuna.common.Environment.TRANSACTION_STATUS_MANAGER_ADDRESS, tsmInetAddress.getHostAddress());
+ isTransactionStatusManagerBindAddressSet = true;
+ }
+ }
+ }
+
+ public int getTransactionStatusManagerPort()
+ {
+ PropertyManager pm = PropertyManagerFactory.getPropertyManager("com.arjuna.ats.propertymanager", "recoverymanager");
+ return Integer.parseInt(pm.getProperty(com.arjuna.ats.arjuna.common.Environment.TRANSACTION_STATUS_MANAGER_PORT));
+ }
+
+ public void setTransactionStatusManagerPort(int port) throws IllegalStateException
+ {
+ if (configured)
+ {
+ if(port != getTransactionStatusManagerPort()) {
+ throw new IllegalStateException("Cannot set transactionStatusManagerPort once the MBean has configured");
+ }
+ }
+ else
+ {
+ PropertyManager pm = PropertyManagerFactory.getPropertyManager("com.arjuna.ats.propertymanager", "recoverymanager");
+ pm.setProperty(com.arjuna.ats.arjuna.common.Environment.TRANSACTION_STATUS_MANAGER_PORT, ""+port);
+ }
+ }
+
+
+
+ public InetAddress getRecoveryInetAddress()
+ {
+ PropertyManager pm = PropertyManagerFactory.getPropertyManager("com.arjuna.ats.propertymanager", "recoverymanager");
+ try {
+ return Utility.hostNameToInetAddress(pm.getProperty(com.arjuna.ats.arjuna.common.Environment.RECOVERY_MANAGER_ADDRESS), "");
+ } catch(UnknownHostException e) {
+ log.warn("UnknownHostException from getRecoveryInetAddress, input was: "+pm.getProperty(com.arjuna.ats.arjuna.common.Environment.RECOVERY_MANAGER_ADDRESS));
+ return null;
+ }
+ }
+
+ public void setRecoveryInetAddress(InetAddress recoveryInetAddress) throws IllegalStateException
+ {
+ if (configured)
+ {
+ if(!recoveryInetAddress.getAddress().equals(getRecoveryInetAddress().getAddress())) {
+ throw new IllegalStateException("Cannot set recoveryInetAddress once the MBean has configured");
+ }
+ }
+ else
+ {
+ PropertyManager pm = PropertyManagerFactory.getPropertyManager("com.arjuna.ats.propertymanager", "recoverymanager");
+ pm.setProperty(com.arjuna.ats.arjuna.common.Environment.RECOVERY_MANAGER_ADDRESS, recoveryInetAddress.getHostAddress());
+ isRecoveryManagerBindAddressSet = true;
+ }
+ }
+
+ public int getRecoveryPort()
+ {
+ PropertyManager pm = PropertyManagerFactory.getPropertyManager("com.arjuna.ats.propertymanager", "recoverymanager");
+ return Integer.parseInt(pm.getProperty(com.arjuna.ats.arjuna.common.Environment.RECOVERY_MANAGER_PORT));
+ }
+
+ public void setRecoveryPort(int port) throws IllegalStateException
+ {
+ if (configured)
+ {
+ if(port != getRecoveryPort()) {
+ throw new IllegalStateException("Cannot set recoveryPort once the MBean has configured");
+ }
+ }
+ else
+ {
+ PropertyManager pm = PropertyManagerFactory.getPropertyManager("com.arjuna.ats.propertymanager", "recoverymanager");
+ pm.setProperty(com.arjuna.ats.arjuna.common.Environment.RECOVERY_MANAGER_PORT, ""+port);
+ }
+ }
+
+
+ public int getSocketProcessIdPort()
+ {
+ PropertyManager pm = arjPropertyManager.getPropertyManager();
+ return Integer.parseInt(pm.getProperty(com.arjuna.ats.arjuna.common.Environment.SOCKET_PROCESS_ID_PORT));
+ }
+
+ public void setSocketProcessIdPort(int port) throws IllegalStateException
+ {
+ if (configured)
+ {
+ if(port != getSocketProcessIdPort()) {
+ throw new IllegalStateException("Cannot set socketProcessIdPort once the MBean has configured");
+ }
+ }
+ else
+ {
+ PropertyManager pm = arjPropertyManager.getPropertyManager();
+ pm.setProperty(com.arjuna.ats.arjuna.common.Environment.SOCKET_PROCESS_ID_PORT, ""+port);
+ }
+ }
}
Modified: labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jta/TransactionManagerServiceMBean.java
===================================================================
--- labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jta/TransactionManagerServiceMBean.java 2008-09-04 10:50:12 UTC (rev 22387)
+++ labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jta/TransactionManagerServiceMBean.java 2008-09-04 10:52:27 UTC (rev 22388)
@@ -36,6 +36,7 @@
import javax.transaction.TransactionManager;
import javax.transaction.UserTransaction;
+import java.net.InetAddress;
/**
* The MBean interface for the TransactionManager JBoss service.
@@ -215,5 +216,73 @@
* @return objectStoreDir The object store directory.
*/
public String getObjectStoreDir() ;
+
+
+ /**
+ * Gets the address to which the TransactionStatusManager listener will bind.
+ * @return InetAddress the address.
+ */
+ public InetAddress getTransactionStatusManagerInetAddress();
+
+ /**
+ * Sets the address to which the TransactionStatusManager will bind.
+ * @param tsmInetAddress the address to set.
+ * @throws IllegalStateException if the MBean has already started.
+ */
+ public void setTransactionStatusManagerInetAddress(InetAddress tsmInetAddress) throws IllegalStateException;
+
+ /**
+ * Gets the port number to which the TransactionStatusManager will bind.
+ * @return int the port number.
+ */
+ public int getTransactionStatusManagerPort();
+
+ /**
+ * Sets the port number to which the TransactionStatusManager will bind.
+ * @param port the port number to set.
+ * @throws IllegalStateException if the MBean has already started.
+ */
+ public void setTransactionStatusManagerPort(int port) throws IllegalStateException;
+
+
+ /**
+ * Gets the address to which the RecoveryManager will bind, if it runs in-process with the application server.
+ * @return InetAddress the address.
+ */
+ public InetAddress getRecoveryInetAddress();
+
+ /**
+ * Sets the address to which the RecvoeryManager will bind, if it runs in-process with the application server.
+ * @param recoveryInetAddress the address to set
+ * @throws IllegalStateException if the MBean has already started.
+ */
+ public void setRecoveryInetAddress(InetAddress recoveryInetAddress) throws IllegalStateException;
+
+ /**
+ * Gets the port number to which the RecoveryManager will bind, if it runs in-process with the application server.
+ * @return int the port number.
+ */
+ public int getRecoveryPort();
+
+ /**
+ * Sets the port number to which the RecoveryManager will bind, if it runs in-process with the application server.
+ * @param port
+ * @throws IllegalStateException if the MBean has already started.
+ */
+ public void setRecoveryPort(int port) throws IllegalStateException;
+
+ /**
+ * Gets the port number to which the SocketProcessId service will bind.
+ * @return
+ */
+ public int getSocketProcessIdPort();
+
+ /**
+ * Sets the port number to which the SocketProcessId service will bind.
+ * @param port
+ * @throws IllegalStateException if the MBean has already started.
+ */
+ public void setSocketProcessIdPort(int port) throws IllegalStateException;
+
}
Modified: labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jts/TransactionManagerService.java
===================================================================
--- labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jts/TransactionManagerService.java 2008-09-04 10:50:12 UTC (rev 22387)
+++ labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jts/TransactionManagerService.java 2008-09-04 10:52:27 UTC (rev 22388)
@@ -54,6 +54,8 @@
import com.arjuna.ats.arjuna.coordinator.TxStats;
import com.arjuna.ats.arjuna.recovery.RecoveryManager;
import com.arjuna.ats.arjuna.recovery.RecoveryModule;
+import com.arjuna.ats.arjuna.utils.Utility;
+import com.arjuna.ats.arjuna.common.arjPropertyManager;
import com.arjuna.orbportability.ORB;
import com.arjuna.orbportability.OA;
@@ -85,7 +87,7 @@
public class TransactionManagerService implements TransactionManagerServiceMBean, XAResourceRecoveryRegistry
{
/*
- deploy/transaction-beans.xml:
+ deploy/transaction-jboss-beans.xml:
<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="urn:jboss:bean-deployer:2.0">
@@ -133,6 +135,9 @@
private boolean configured;
private byte[] configuredLock = new byte[0] ;
+ private boolean isTransactionStatusManagerBindAddressSet;
+ private boolean isRecoveryManagerBindAddressSet;
+
private MBeanServer mbeanServer;
/**
* Use the short class name as the default for the service name.
@@ -149,6 +154,22 @@
{
synchronized(configuredLock)
{
+ // if the app server's ServerBindingManager has NOT been used to configure the listen addresses
+ // (which it should be by default via the binding.xml and transaction-jboss-beans.xml) then we
+ // want to fall back to using the SERVER_BIND_ADDRESS in preference to the value from the
+ // jbossjta-properties.xml. Belt and Braces...
+
+ InetAddress serverInetAddress = InetAddress.getByName(System.getProperty(ServerConfig.SERVER_BIND_ADDRESS));
+ if(!isRecoveryManagerBindAddressSet) {
+ setRecoveryInetAddress(serverInetAddress);
+ }
+ if(!isTransactionStatusManagerBindAddressSet) {
+ setTransactionStatusManagerInetAddress(serverInetAddress);
+ }
+
+ // we are now done configuring things. The transaction system gets unhappy if we change config
+ // once it's running, so prevent any further alterations before we start it up...
+
configured = true ;
}
@@ -164,8 +185,6 @@
com.arjuna.ats.internal.jbossatx.agent.LocalJBossAgentImpl.class.getName());
System.setProperty(Environment.LAST_RESOURCE_OPTIMISATION_INTERFACE, LastResource.class.getName()) ;
- System.setProperty(com.arjuna.ats.arjuna.common.Environment.SERVER_BIND_ADDRESS, System.getProperty(ServerConfig.SERVER_BIND_ADDRESS));
-
final String alwaysPropagateProperty = alwaysPropagateContext ? "YES" : "NO" ;
System.setProperty(com.arjuna.ats.jts.common.Environment.ALWAYS_PROPAGATE_CONTEXT, alwaysPropagateProperty);
@@ -266,7 +285,7 @@
try
{
- Socket sckt = RecoveryManager.getClientSocket(getRunInVMRecoveryManager());
+ Socket sckt = RecoveryManager.getClientSocket();
in = new BufferedReader(new InputStreamReader(sckt.getInputStream()));
out = new PrintStream(sckt.getOutputStream());
@@ -283,7 +302,7 @@
{
try
{
- InetAddress host = RecoveryManager.getRecoveryManagerHost(getRunInVMRecoveryManager());
+ InetAddress host = RecoveryManager.getRecoveryManagerHost();
int port = RecoveryManager.getRecoveryManagerPort();
log.error("Failed to connect to recovery manager on " + host.getHostAddress() + ':' + port);
@@ -727,4 +746,133 @@
return alwaysPropagateContext ;
}
}
+
+ ///////////////////
+
+ // note that the address/port setters rely on having the property manager initialized first, or their settings
+ // would be overridden by those in the config files when the properties are loaded from file. Fortunatly the static
+ // block for the logging has the nice side effect of loading the config too, so it works out ok.
+
+ public InetAddress getTransactionStatusManagerInetAddress()
+ {
+ PropertyManager pm = PropertyManagerFactory.getPropertyManager("com.arjuna.ats.propertymanager", "recoverymanager");
+ try {
+ return Utility.hostNameToInetAddress(pm.getProperty(com.arjuna.ats.arjuna.common.Environment.TRANSACTION_STATUS_MANAGER_ADDRESS), "");
+ } catch(UnknownHostException e) {
+ log.warn("UnknownHostException from getTransactionStatusManagerInetAddress, input was: "+pm.getProperty(com.arjuna.ats.arjuna.common.Environment.TRANSACTION_STATUS_MANAGER_ADDRESS));
+ return null;
+ }
+ }
+
+ public void setTransactionStatusManagerInetAddress(InetAddress tsmInetAddress) throws IllegalStateException
+ {
+ synchronized(configuredLock)
+ {
+ if (configured)
+ {
+ if(!tsmInetAddress.getAddress().equals(getTransactionStatusManagerInetAddress().getAddress())) {
+ throw new IllegalStateException("Cannot set transactionStatusManagerInetAddress once the MBean has configured");
+ }
+ }
+ else
+ {
+ PropertyManager pm = PropertyManagerFactory.getPropertyManager("com.arjuna.ats.propertymanager", "recoverymanager");
+ pm.setProperty(com.arjuna.ats.arjuna.common.Environment.TRANSACTION_STATUS_MANAGER_ADDRESS, tsmInetAddress.getHostAddress());
+ isTransactionStatusManagerBindAddressSet = true;
+ }
+ }
+ }
+
+ public int getTransactionStatusManagerPort()
+ {
+ PropertyManager pm = PropertyManagerFactory.getPropertyManager("com.arjuna.ats.propertymanager", "recoverymanager");
+ return Integer.parseInt(pm.getProperty(com.arjuna.ats.arjuna.common.Environment.TRANSACTION_STATUS_MANAGER_PORT));
+ }
+
+ public void setTransactionStatusManagerPort(int port) throws IllegalStateException
+ {
+ if (configured)
+ {
+ if(port != getTransactionStatusManagerPort()) {
+ throw new IllegalStateException("Cannot set transactionStatusManagerPort once the MBean has configured");
+ }
+ }
+ else
+ {
+ PropertyManager pm = PropertyManagerFactory.getPropertyManager("com.arjuna.ats.propertymanager", "recoverymanager");
+ pm.setProperty(com.arjuna.ats.arjuna.common.Environment.TRANSACTION_STATUS_MANAGER_PORT, ""+port);
+ }
+ }
+
+
+
+ public InetAddress getRecoveryInetAddress()
+ {
+ PropertyManager pm = PropertyManagerFactory.getPropertyManager("com.arjuna.ats.propertymanager", "recoverymanager");
+ try {
+ return Utility.hostNameToInetAddress(pm.getProperty(com.arjuna.ats.arjuna.common.Environment.RECOVERY_MANAGER_ADDRESS), "");
+ } catch(UnknownHostException e) {
+ log.warn("UnknownHostException from getRecoveryInetAddress, input was: "+pm.getProperty(com.arjuna.ats.arjuna.common.Environment.RECOVERY_MANAGER_ADDRESS));
+ return null;
+ }
+ }
+
+ public void setRecoveryInetAddress(InetAddress recoveryInetAddress) throws IllegalStateException
+ {
+ if (configured)
+ {
+ if(!recoveryInetAddress.getAddress().equals(getRecoveryInetAddress().getAddress())) {
+ throw new IllegalStateException("Cannot set recoveryInetAddress once the MBean has configured");
+ }
+ }
+ else
+ {
+ PropertyManager pm = PropertyManagerFactory.getPropertyManager("com.arjuna.ats.propertymanager", "recoverymanager");
+ pm.setProperty(com.arjuna.ats.arjuna.common.Environment.RECOVERY_MANAGER_ADDRESS, recoveryInetAddress.getHostAddress());
+ isRecoveryManagerBindAddressSet = true;
+ }
+ }
+
+ public int getRecoveryPort()
+ {
+ PropertyManager pm = PropertyManagerFactory.getPropertyManager("com.arjuna.ats.propertymanager", "recoverymanager");
+ return Integer.parseInt(pm.getProperty(com.arjuna.ats.arjuna.common.Environment.RECOVERY_MANAGER_PORT));
+ }
+
+ public void setRecoveryPort(int port) throws IllegalStateException
+ {
+ if (configured)
+ {
+ if(port != getRecoveryPort()) {
+ throw new IllegalStateException("Cannot set recoveryPort once the MBean has configured");
+ }
+ }
+ else
+ {
+ PropertyManager pm = PropertyManagerFactory.getPropertyManager("com.arjuna.ats.propertymanager", "recoverymanager");
+ pm.setProperty(com.arjuna.ats.arjuna.common.Environment.RECOVERY_MANAGER_PORT, ""+port);
+ }
+ }
+
+
+ public int getSocketProcessIdPort()
+ {
+ PropertyManager pm = arjPropertyManager.getPropertyManager();
+ return Integer.parseInt(pm.getProperty(com.arjuna.ats.arjuna.common.Environment.SOCKET_PROCESS_ID_PORT));
+ }
+
+ public void setSocketProcessIdPort(int port) throws IllegalStateException
+ {
+ if (configured)
+ {
+ if(port != getSocketProcessIdPort()) {
+ throw new IllegalStateException("Cannot set socketProcessIdPort once the MBean has configured");
+ }
+ }
+ else
+ {
+ PropertyManager pm = arjPropertyManager.getPropertyManager();
+ pm.setProperty(com.arjuna.ats.arjuna.common.Environment.SOCKET_PROCESS_ID_PORT, ""+port);
+ }
+ }
}
Modified: labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jts/TransactionManagerServiceMBean.java
===================================================================
--- labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jts/TransactionManagerServiceMBean.java 2008-09-04 10:50:12 UTC (rev 22387)
+++ labs/jbosstm/trunk/atsintegration/classes/com/arjuna/ats/jbossatx/jts/TransactionManagerServiceMBean.java 2008-09-04 10:52:27 UTC (rev 22388)
@@ -35,6 +35,7 @@
import javax.transaction.TransactionManager;
import javax.transaction.UserTransaction;
+import java.net.InetAddress;
/**
* The MBean interface for the TransactionManager JBoss service.
@@ -227,5 +228,70 @@
* @return true if the context should always be propagated, false if only propagated to OTS transactional objects.
*/
public boolean getAlwaysPropagateContext() ;
+
+ /**
+ * Gets the address to which the TransactionStatusManager listener will bind.
+ * @return InetAddress the address.
+ */
+ public InetAddress getTransactionStatusManagerInetAddress();
+
+ /**
+ * Sets the address to which the TransactionStatusManager will bind.
+ * @param tsmInetAddress the address to set.
+ * @throws IllegalStateException if the MBean has already started.
+ */
+ public void setTransactionStatusManagerInetAddress(InetAddress tsmInetAddress) throws IllegalStateException;
+
+ /**
+ * Gets the port number to which the TransactionStatusManager will bind.
+ * @return int the port number.
+ */
+ public int getTransactionStatusManagerPort();
+
+ /**
+ * Sets the port number to which the TransactionStatusManager will bind.
+ * @param port the port number to set.
+ * @throws IllegalStateException if the MBean has already started.
+ */
+ public void setTransactionStatusManagerPort(int port) throws IllegalStateException;
+
+ /**
+ * Gets the address to which the RecoveryManager will bind, if it runs in-process with the application server.
+ * @return InetAddress the address.
+ */
+ public InetAddress getRecoveryInetAddress();
+
+ /**
+ * Sets the address to which the RecvoeryManager will bind, if it runs in-process with the application server.
+ * @param recoveryInetAddress the address to set
+ * @throws IllegalStateException if the MBean has already started.
+ */
+ public void setRecoveryInetAddress(InetAddress recoveryInetAddress) throws IllegalStateException;
+
+ /**
+ * Gets the port number to which the RecoveryManager will bind, if it runs in-process with the application server.
+ * @return int the port number.
+ */
+ public int getRecoveryPort();
+
+ /**
+ * Sets the port number to which the RecoveryManager will bind, if it runs in-process with the application server.
+ * @param port
+ * @throws IllegalStateException if the MBean has already started.
+ */
+ public void setRecoveryPort(int port) throws IllegalStateException;
+
+ /**
+ * Gets the port number to which the SocketProcessId service will bind.
+ * @return
+ */
+ public int getSocketProcessIdPort();
+
+ /**
+ * Sets the port number to which the SocketProcessId service will bind.
+ * @param port
+ * @throws IllegalStateException if the MBean has already started.
+ */
+ public void setSocketProcessIdPort(int port) throws IllegalStateException;
}
Modified: labs/jbosstm/trunk/qa/config/jbossjts-properties.xml
===================================================================
--- labs/jbosstm/trunk/qa/config/jbossjts-properties.xml 2008-09-04 10:50:12 UTC (rev 22387)
+++ labs/jbosstm/trunk/qa/config/jbossjts-properties.xml 2008-09-04 10:52:27 UTC (rev 22388)
@@ -278,7 +278,7 @@
<!--
This property controls the port on which the Recovery ORB listens
-->
- <property name="com.arjuna.ats.jts.recoveryManagerPort" value="4711"/>
+ <property name="com.arjuna.ats.jts.recoveryManagerPort" value="4712"/>
</properties>
<properties depends="orbportability,arjuna" name="jts">
<!--
More information about the jboss-svn-commits
mailing list