[jboss-cvs] JBossAS SVN: r110908 - in projects/jboss-jca/trunk: core/src/main/java/org/jboss/jca/core/spi/recovery and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Mar 14 16:59:12 EDT 2011
Author: jesper.pedersen
Date: 2011-03-14 16:59:11 -0400 (Mon, 14 Mar 2011)
New Revision: 110908
Added:
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/recovery/package.html
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/recovery/package.html
Modified:
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/recovery/DefaultRecoveryPlugin.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/recovery/XAResourceRecoveryImpl.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/recovery/RecoveryPlugin.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java
Log:
[JBJCA-509] Clean up of SPI and default plugin
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/recovery/DefaultRecoveryPlugin.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/recovery/DefaultRecoveryPlugin.java 2011-03-14 13:17:02 UTC (rev 110907)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/recovery/DefaultRecoveryPlugin.java 2011-03-14 20:59:11 UTC (rev 110908)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -25,72 +25,87 @@
import java.lang.reflect.Method;
+import javax.resource.ResourceException;
+
import org.jboss.logging.Logger;
+/**
+ * Default implementation of a recovery plugin.
+ *
+ * @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
+ * @author <a href="jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
public class DefaultRecoveryPlugin implements RecoveryPlugin
{
-
/** Log instance */
private static Logger log = Logger.getLogger(DefaultRecoveryPlugin.class);
+ /**
+ * Constructor
+ */
+ public DefaultRecoveryPlugin()
+ {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
@Override
- public boolean isValid(Object c)
+ public boolean isValid(Object c) throws ResourceException
{
- try
+ if (c != null)
{
- if (c instanceof javax.resource.cci.Connection)
+ try
{
- return false;
-
- }
- else
- {
- Method method = null;
-
- method = c.getClass().getMethod("isValid", new Class[]{int.class});
+ Method method = c.getClass().getMethod("isValid", new Class[] {int.class});
method.setAccessible(true);
- Boolean b = (Boolean) method.invoke(c, new Object[]{new Integer(5)});
+ Boolean b = (Boolean)method.invoke(c, new Object[] {new Integer(5)});
return b.booleanValue();
}
+ catch (Throwable t)
+ {
+ log.debugf("No isValid(int) method defined on connection interface (%s)", c.getClass().getName());
+ }
}
- catch (Throwable t)
- {
- log.warn("Error during recovery connection isValid", t);
- return false;
- }
-
+ return false;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
- public boolean close(Object c)
+ public void close(Object c) throws ResourceException
{
- try
+ if (c != null)
{
if (c instanceof javax.resource.cci.Connection)
{
- javax.resource.cci.Connection cci = (javax.resource.cci.Connection) c;
- cci.close();
+ try
+ {
+ javax.resource.cci.Connection cci = (javax.resource.cci.Connection)c;
+ cci.close();
+ }
+ catch (ResourceException re)
+ {
+ log.warn("Error during connection close", re);
+ throw new ResourceException("Error during connection close", re);
+ }
}
else
{
- Method method = c.getClass().getMethod("close", (Class<?>) null);
- method.setAccessible(true);
- method.invoke(c, (Object) null);
+ try
+ {
+ Method method = c.getClass().getMethod("close", (Class<?>)null);
+ method.setAccessible(true);
+ method.invoke(c, (Object)null);
+ }
+ catch (Throwable t)
+ {
+ log.debug("Error during connection close()", t);
+ throw new ResourceException("Error during connection close()", t);
+ }
}
}
- catch (Throwable t)
- {
- log.warn(
- "No close() method defined on connection interface. Destroying managed connection to clean-up",
- t);
-
- if (log.isDebugEnabled())
- log.debug("Forcing recreate of managed connection");
-
- return false;
-
- }
- return true;
}
}
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/recovery/XAResourceRecoveryImpl.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/recovery/XAResourceRecoveryImpl.java 2011-03-14 13:17:02 UTC (rev 110907)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/recovery/XAResourceRecoveryImpl.java 2011-03-14 20:59:11 UTC (rev 110908)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -21,13 +21,13 @@
*/
package org.jboss.jca.core.recovery;
-
import org.jboss.jca.core.connectionmanager.xa.XAResourceWrapperImpl;
import org.jboss.jca.core.spi.recovery.RecoveryPlugin;
import java.security.AccessController;
import java.security.Principal;
import java.security.PrivilegedAction;
+import java.util.Set;
import javax.resource.ResourceException;
import javax.resource.spi.ManagedConnection;
@@ -46,14 +46,15 @@
import org.jboss.tm.XAResourceRecoveryRegistry;
/**
+ * An XAResourceRecovery implementation.
*
- * A XAResourceRecoveryImpl.
- *
* @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
- *
+ * @author <a href="jesper.pedersen at jboss.org">Jesper Pedersen</a>
*/
public class XAResourceRecoveryImpl implements XAResourceRecovery
{
+ /** Log instance */
+ private static Logger log = Logger.getLogger(XAResourceRecoveryImpl.class);
private final ManagedConnectionFactory mcf;
@@ -63,8 +64,6 @@
private final Boolean wrapXAResource;
- private String jndiName;
-
private final String recoverUserName;
private final String recoverPassword;
@@ -73,13 +72,12 @@
private final SubjectFactory subjectFactory;
- private ManagedConnection recoverMC;
-
private final RecoveryPlugin plugin;
- /** Log instance */
- private static Logger log = Logger.getLogger(XAResourceRecoveryImpl.class);
+ private ManagedConnection recoverMC;
+ private String jndiName;
+
/**
* Create a new XAResourceRecoveryImpl.
*
@@ -93,11 +91,18 @@
* @param subjectFactory subjectFactory
* @param plugin recovery plugin
*/
- public XAResourceRecoveryImpl(ManagedConnectionFactory mcf, Boolean padXid, Boolean isSameRMOverrideValue,
- Boolean wrapXAResource, String recoverUserName,
- String recoverPassword, String recoverSecurityDomain, SubjectFactory subjectFactory, RecoveryPlugin plugin)
+ public XAResourceRecoveryImpl(ManagedConnectionFactory mcf,
+ Boolean padXid, Boolean isSameRMOverrideValue, Boolean wrapXAResource,
+ String recoverUserName, String recoverPassword, String recoverSecurityDomain,
+ SubjectFactory subjectFactory,
+ RecoveryPlugin plugin)
{
- super();
+ if (mcf == null)
+ throw new IllegalArgumentException("MCF is null");
+
+ if (plugin == null)
+ throw new IllegalArgumentException("Plugin is null");
+
this.mcf = mcf;
this.padXid = padXid;
this.isSameRMOverrideValue = isSameRMOverrideValue;
@@ -107,7 +112,18 @@
this.recoverSecurityDomain = recoverSecurityDomain;
this.subjectFactory = subjectFactory;
this.plugin = plugin;
+ this.recoverMC = null;
+ this.jndiName = null;
+ }
+ /**
+ * Set the jndiName.
+ *
+ * @param jndiName The jndiName to set.
+ */
+ public void setJndiName(String jndiName)
+ {
+ this.jndiName = jndiName;
}
/**
@@ -126,7 +142,6 @@
@Override
public XAResource[] getXAResources()
{
-
try
{
Subject subject = getSubject();
@@ -163,62 +178,51 @@
xaResource = mc.getXAResource();
}
}
-
- String eisProductName = null;
- String eisProductVersion = null;
-
- try
+
+ if (wrapXAResource)
{
- if (mc.getMetaData() != null)
+ String eisProductName = null;
+ String eisProductVersion = null;
+
+ try
{
- eisProductName = mc.getMetaData().getEISProductName();
- eisProductVersion = mc.getMetaData().getEISProductVersion();
+ if (mc.getMetaData() != null)
+ {
+ eisProductName = mc.getMetaData().getEISProductName();
+ eisProductVersion = mc.getMetaData().getEISProductVersion();
+ }
}
- }
- catch (ResourceException re)
- {
- // Ignore
- }
+ catch (ResourceException re)
+ {
+ // Ignore
+ }
- if (eisProductName == null)
- eisProductName = getJndiName();
+ if (eisProductName == null)
+ eisProductName = jndiName;
- if (eisProductVersion == null)
- eisProductVersion = getJndiName();
+ if (eisProductVersion == null)
+ eisProductVersion = jndiName;
- try
- {
- if (wrapXAResource)
- {
-
- xaResource = new XAResourceWrapperImpl(xaResource,
- padXid,
- isSameRMOverrideValue,
- eisProductName,
- eisProductVersion,
- jndiName);
- }
+ xaResource = new XAResourceWrapperImpl(xaResource,
+ padXid,
+ isSameRMOverrideValue,
+ eisProductName,
+ eisProductVersion,
+ jndiName);
}
- catch (Throwable t)
- {
- // Ignore
- }
- if (log.isDebugEnabled())
- log.debug("Recovery XAResource=" + xaResource + " for " + jndiName);
+ log.debugf("Recovery XAResource=%s for %s", xaResource, jndiName);
return new XAResource[]{xaResource};
}
else
{
- if (log.isDebugEnabled())
- log.debug("Subject for recovery was null");
+ log.debugf("Subject for recovery was null");
}
}
catch (ResourceException re)
{
- if (log.isDebugEnabled())
- log.debug("Error during recovery", re);
+ log.debugf("Error during recovery", re);
}
return new XAResource[0];
@@ -244,6 +248,8 @@
{
if (recoverUserName != null && recoverPassword != null)
{
+ log.debugf("Recovery user name=%s", recoverUserName);
+
// User name and password use-case
Subject subject = new Subject();
@@ -259,8 +265,7 @@
// PublicCredentials
// None
- if (log.isDebugEnabled())
- log.debug("Recovery Subject=" + subject);
+ log.debugf("Recovery Subject=%s", subject);
return subject;
}
@@ -287,25 +292,32 @@
// Select the domain
String domain = recoverSecurityDomain;
- if (domain != null)
+ if (domain != null && subjectFactory != null)
{
// Use the unauthenticated subject to get the real recovery subject instance
Subject subject = subjectFactory.createSubject(domain);
+
+ Set<PasswordCredential> pcs = subject.getPrivateCredentials(PasswordCredential.class);
+ if (pcs != null && pcs.size() > 0)
+ {
+ for (PasswordCredential pc : pcs)
+ {
+ pc.setManagedConnectionFactory(mcf);
+ }
+ }
- if (log.isDebugEnabled())
- log.debug("Recovery Subject=" + subject);
+ log.debugf("Recovery Subject=%s", subject);
return subject;
}
else
{
- if (log.isDebugEnabled())
- log.debug("RecoverySecurityDomain was empty");
+ log.debugf("RecoverySecurityDomain was empty");
}
}
catch (Throwable t)
{
- log.debug("Exception during getSubject()" + t.getMessage(), t);
+ log.debugf("Exception during getSubject() - %s", t.getMessage(), t);
}
return null;
@@ -315,17 +327,29 @@
}
/**
+ * Register instance for recovery
*
- * registeer this impl to passed XAResourceRecoveryRegistry
- *
- * @param registry the registry
- * @param cfJndiName the connection factory jndi name
+ * @param registry The recovery registry
*/
- public void registerXaRecovery(XAResourceRecoveryRegistry registry, String cfJndiName)
+ public void registerXaRecovery(XAResourceRecoveryRegistry registry)
{
- this.jndiName = cfJndiName;
+ if (registry == null)
+ throw new IllegalArgumentException("Registry is null");
+
registry.addXAResourceRecovery(this);
+ }
+ /**
+ * Deregister instance for recovery
+ *
+ * @param registry The recovery registry
+ */
+ public void deregisterXaRecovery(XAResourceRecoveryRegistry registry)
+ {
+ if (registry == null)
+ throw new IllegalArgumentException("Registry is null");
+
+ registry.removeXAResourceRecovery(this);
}
/**
@@ -336,20 +360,22 @@
*/
private ManagedConnection open(Subject s) throws ResourceException
{
+ log.debugf("Open managed connection (%s)", s);
+
if (recoverMC == null)
- {
recoverMC = mcf.createManagedConnection(s, null);
- }
return recoverMC;
}
/**
- * Close a managed connection
- * @param mc The managed connection
- */
+ * Close a managed connection
+ * @param mc The managed connection
+ */
private void close(ManagedConnection mc)
{
+ log.debugf("Closing managed connection for recovery (%s)", mc);
+
if (mc != null)
{
try
@@ -358,8 +384,7 @@
}
catch (ResourceException ire)
{
- if (log.isDebugEnabled())
- log.debug("Error during recovery cleanup", ire);
+ log.debugf("Error during recovery cleanup", ire);
}
}
@@ -371,12 +396,14 @@
}
catch (ResourceException ire)
{
- if (log.isDebugEnabled())
- log.debug("Error during recovery destroy", ire);
+ log.debugf("Error during recovery destroy", ire);
}
}
mc = null;
+
+ // The managed connection for recovery is now gone
+ recoverMC = null;
}
/**
@@ -388,8 +415,7 @@
*/
private Object openConnection(ManagedConnection mc, Subject s) throws ResourceException
{
- if (log.isDebugEnabled())
- log.debug("Creating connection for recovery check");
+ log.debugf("Open connection (%s, %s)", mc, s);
return mc.getConnection(s, null);
}
@@ -401,133 +427,35 @@
*/
private boolean closeConnection(Object c)
{
+ log.debugf("Closing connection for recovery check (%s)", c);
+
+ boolean forceClose = false;
+
if (c != null)
{
- if (plugin.isValid(c))
+ try
{
- return !plugin.close(c);
+ forceClose = !plugin.isValid(c);
}
+ catch (ResourceException re)
+ {
+ log.debugf("Error during recovery plugin isValid()", re);
+ forceClose = true;
+ }
+
+ try
+ {
+ plugin.close(c);
+ }
+ catch (ResourceException re)
+ {
+ log.debugf("Error during recovery plugin close()", re);
+ forceClose = true;
+ }
}
- return false;
- }
- /**
- * Get the recoverMC.
- *
- * @return the recoverMC.
- */
- public final ManagedConnection getRecoverMC()
- {
- return recoverMC;
- }
+ log.debugf("Force close=%s", forceClose);
- /**
- * Set the recoverMC.
- *
- * @param recoverMC The recoverMC to set.
- */
- public final void setRecoverMC(ManagedConnection recoverMC)
- {
- this.recoverMC = recoverMC;
+ return forceClose;
}
-
- /**
- * Get the mcf.
- *
- * @return the mcf.
- */
- public final ManagedConnectionFactory getMcf()
- {
- return mcf;
- }
-
- /**
- * Get the padXid.
- *
- * @return the padXid.
- */
- public final Boolean isPadXid()
- {
- return padXid;
- }
-
- /**
- * Get the isSameRMOverrideValue.
- *
- * @return the isSameRMOverrideValue.
- */
- public final Boolean isSameRMOverrideValue()
- {
- return isSameRMOverrideValue;
- }
-
- /**
- * Get the wrapXAResource.
- *
- * @return the wrapXAResource.
- */
- public final Boolean isWrapXAResource()
- {
- return wrapXAResource;
- }
-
- /**
- * Get the jndiName.
- *
- * @return the jndiName.
- */
- public final String getJndiName()
- {
- return jndiName;
- }
-
- /**
- * Get the recoverUserName.
- *
- * @return the recoverUserName.
- */
- public final String getRecoverUserName()
- {
- return recoverUserName;
- }
-
- /**
- * Get the recoverPassword.
- *
- * @return the recoverPassword.
- */
- public final String getRecoverPassword()
- {
- return recoverPassword;
- }
-
- /**
- * Get the recoverSecurityDomain.
- *
- * @return the recoverSecurityDomain.
- */
- public final String getRecoverSecurityDomain()
- {
- return recoverSecurityDomain;
- }
-
- /**
- * Get the subjectFactory.
- *
- * @return the subjectFactory.
- */
- public final SubjectFactory getSubjectFactory()
- {
- return subjectFactory;
- }
-
- /**
- * Set the jndiName.
- *
- * @param jndiName The jndiName to set.
- */
- public final void setJndiName(String jndiName)
- {
- this.jndiName = jndiName;
- }
}
Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/recovery/package.html
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/recovery/package.html (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/recovery/package.html 2011-03-14 20:59:11 UTC (rev 110908)
@@ -0,0 +1,3 @@
+<body>
+This packages contains the classes for the recovery infrastructure.
+</body>
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/recovery/RecoveryPlugin.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/recovery/RecoveryPlugin.java 2011-03-14 13:17:02 UTC (rev 110907)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/recovery/RecoveryPlugin.java 2011-03-14 20:59:11 UTC (rev 110908)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -21,34 +21,43 @@
*/
package org.jboss.jca.core.spi.recovery;
+import javax.resource.ResourceException;
+
/**
+ * Defines the contract for an XA recovery plugin.
*
- * A RecoveryPlugin.
+ * An implementation of this SPI can provide feedback to the JCA container
+ * if the physinal connection is still valid to use for getting recovery information
+ * from.
*
+ * An implementation of this SPI must have a default constructor and will have
+ * its Java bean properties set after initialization.
+ *
* @author <a href="stefano.maestri at jboss.com">Stefano Maestri</a>
- *
+ * @author <a href="jesper.pedersen at jboss.org">Jesper Pedersen</a>
*/
public interface RecoveryPlugin
{
-
/**
+ * Check if the passed connection object instance is still valid, and hence
+ * the underlying physical connection
*
- * Verify if connection is valid
- *
- * @param c the connection object
- * @return true if it's valid, false in case it is not valid or an exception occurred during verification
+ * @param c The connection instance
+ * @return <code>True</code> if the connection is still valid, otherwise <code>false</code>
+ * @exception ResourceException Thrown in case of an error
*/
- public boolean isValid(Object c);
+ public boolean isValid(Object c) throws ResourceException;
/**
+ * Perform a close operation on the passed connection object instance - like
+ * a CCI Connection instance.
*
- * Invoke close on c instance
+ * Any error during this operation should result in an exception, which
+ * will force a close of the physical connection to the Enterprise Information System
*
- * @param c the connection object instance
- * @return true if close completed without problem.
- * false in case of failed close or exceptions during close process
+ * @param c The connection instance
+ * @exception ResourceException Thrown in case of an error
+ * @see javax.resource.cci.Connection
*/
- public boolean close(Object c);
-
+ public void close(Object c) throws ResourceException;
}
-
Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/recovery/package.html
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/recovery/package.html (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/spi/recovery/package.html 2011-03-14 20:59:11 UTC (rev 110908)
@@ -0,0 +1,3 @@
+<body>
+This package contains the XA recovery extension.
+</body>
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java 2011-03-14 13:17:02 UTC (rev 110907)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java 2011-03-14 20:59:11 UTC (rev 110908)
@@ -42,6 +42,7 @@
import org.jboss.jca.core.connectionmanager.pool.api.Pool;
import org.jboss.jca.core.connectionmanager.pool.api.PoolFactory;
import org.jboss.jca.core.connectionmanager.pool.api.PoolStrategy;
+import org.jboss.jca.core.recovery.DefaultRecoveryPlugin;
import org.jboss.jca.core.recovery.XAResourceRecoveryImpl;
import org.jboss.jca.core.spi.mdr.MetadataRepository;
import org.jboss.jca.core.spi.recovery.RecoveryPlugin;
@@ -545,36 +546,31 @@
}
RecoveryPlugin plugin = null;
+
if (recoveryMD != null && recoveryMD.getPlugin() != null)
{
List<ConfigProperty> configProperties = null;
- if (recoveryMD
- .getPlugin()
- .getConfigPropertiesMap() != null)
+ if (recoveryMD.getPlugin().getConfigPropertiesMap() != null)
{
- configProperties = new ArrayList<ConfigProperty>(recoveryMD.getPlugin()
- .getConfigPropertiesMap().size());
- for (Entry<String, String> property : recoveryMD.getPlugin()
- .getConfigPropertiesMap().entrySet())
+ configProperties = new ArrayList<ConfigProperty>(recoveryMD.getPlugin().getConfigPropertiesMap().size());
+ for (Entry<String, String> property : recoveryMD.getPlugin().getConfigPropertiesMap().entrySet())
{
- ConfigProperty c = new ConfigPropertyImpl(
- null,
- new XsdString(property
- .getKey(),
- null),
- new XsdString("String",
- null),
- new XsdString(
- property
- .getValue(),
- null), null);
+ ConfigProperty c = new ConfigPropertyImpl(null,
+ new XsdString(property.getKey(), null),
+ new XsdString("String", null),
+ new XsdString(property.getValue(), null),
+ null);
configProperties.add(c);
}
- plugin = (RecoveryPlugin) initAndInject(recoveryMD
- .getPlugin().getClassName(), configProperties, cl);
+ plugin = (RecoveryPlugin) initAndInject(recoveryMD.getPlugin().getClassName(), configProperties, cl);
}
}
+ else
+ {
+ plugin = new DefaultRecoveryPlugin();
+ }
+
resourceRecovery = new XAResourceRecoveryImpl(mcf,
padXid,
isSameRMOverride,
@@ -582,16 +578,17 @@
recoverUser,
recoverPassword,
recoverSecurityDomain,
- null,
+ getSubjectFactory(recoverSecurityDomain),
plugin);
}
if (getXAResourceRecoveryRegistry() != null && resourceRecovery != null)
{
- resourceRecovery.registerXaRecovery(getXAResourceRecoveryRegistry(),
- cm.getJndiName());
+ resourceRecovery.setJndiName(cm.getJndiName());
+ resourceRecovery.registerXaRecovery(getXAResourceRecoveryRegistry());
}
+
// ConnectionFactory
return mcf.createConnectionFactory(cm);
}
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java 2011-03-14 13:17:02 UTC (rev 110907)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java 2011-03-14 20:59:11 UTC (rev 110908)
@@ -50,6 +50,7 @@
import org.jboss.jca.core.connectionmanager.pool.api.Pool;
import org.jboss.jca.core.connectionmanager.pool.api.PoolFactory;
import org.jboss.jca.core.connectionmanager.pool.api.PoolStrategy;
+import org.jboss.jca.core.recovery.DefaultRecoveryPlugin;
import org.jboss.jca.core.recovery.XAResourceRecoveryImpl;
import org.jboss.jca.core.spi.recovery.RecoveryPlugin;
import org.jboss.jca.validator.Failure;
@@ -150,6 +151,24 @@
}
/**
+ * Get the xAResourceRecoveryRegistry.
+ * @return The value
+ */
+ public XAResourceRecoveryRegistry getXAResourceRecoveryRegistry()
+ {
+ return xaResourceRecoveryRegistry;
+ }
+
+ /**
+ * Set the XAResourcRecoveryRegistry.
+ * @param value The value
+ */
+ public void setXAResourceRecoveryRegistry(XAResourceRecoveryRegistry value)
+ {
+ xaResourceRecoveryRegistry = value;
+ }
+
+ /**
* validate archive
*
* @param url url url of the archive
@@ -1347,7 +1366,7 @@
{
cm = cmf.createNonTransactional(tsl, pool,
getSubjectFactory(securityDomain),
- securityDomain,
+ securityDomain,
allocationRetry, allocationRetryWaitMillis);
}
else
@@ -1457,6 +1476,11 @@
.getPlugin().getClassName(), configProperties, cl);
}
}
+ else
+ {
+ plugin = new DefaultRecoveryPlugin();
+ }
+
resourceRecovery = new XAResourceRecoveryImpl(mcf,
padXid,
isSameRMOverride,
@@ -1561,11 +1585,13 @@
pool.setName(poolName);
}
+
if (getXAResourceRecoveryRegistry() != null && resourceRecovery != null)
{
- resourceRecovery.registerXaRecovery(getXAResourceRecoveryRegistry(),
- cm.getJndiName());
+ resourceRecovery.setJndiName(cm.getJndiName());
+ resourceRecovery.registerXaRecovery(getXAResourceRecoveryRegistry());
}
+
if (activateDeployment)
{
org.jboss.jca.core.api.management.ManagedConnectionFactory mgtMcf =
@@ -1881,25 +1907,4 @@
*/
protected abstract Object initAndInject(String value, List<? extends ConfigProperty> cpm, ClassLoader cl)
throws DeployException;
-
- /**
- * Get the xAResourceRecoveryRegistry.
- *
- * @return the xAResourceRecoveryRegistry.
- */
- public final org.jboss.tm.XAResourceRecoveryRegistry getXAResourceRecoveryRegistry()
- {
- return xaResourceRecoveryRegistry;
- }
-
- /**
- * Set the xAResourceRecoveryRegistry.
- *
- * @param xAResourceRecoveryRegistry The xAResourceRecoveryRegistry to set.
- */
- public final void setXAResourceRecoveryRegistry(XAResourceRecoveryRegistry xAResourceRecoveryRegistry)
- {
- xaResourceRecoveryRegistry = xAResourceRecoveryRegistry;
- }
-
}
More information about the jboss-cvs-commits
mailing list