WebSphereUowTransactionManager falls back to UOWManagerFactory lookup by default
This commit is contained in:
parent
ea8f628c9c
commit
3f6e4282d6
|
|
@ -24,6 +24,7 @@ import com.ibm.wsspi.uow.UOWAction;
|
||||||
import com.ibm.wsspi.uow.UOWActionException;
|
import com.ibm.wsspi.uow.UOWActionException;
|
||||||
import com.ibm.wsspi.uow.UOWException;
|
import com.ibm.wsspi.uow.UOWException;
|
||||||
import com.ibm.wsspi.uow.UOWManager;
|
import com.ibm.wsspi.uow.UOWManager;
|
||||||
|
import com.ibm.wsspi.uow.UOWManagerFactory;
|
||||||
|
|
||||||
import org.springframework.transaction.IllegalTransactionStateException;
|
import org.springframework.transaction.IllegalTransactionStateException;
|
||||||
import org.springframework.transaction.InvalidTimeoutException;
|
import org.springframework.transaction.InvalidTimeoutException;
|
||||||
|
|
@ -88,7 +89,7 @@ public class WebSphereUowTransactionManager extends JtaTransactionManager
|
||||||
|
|
||||||
private UOWManager uowManager;
|
private UOWManager uowManager;
|
||||||
|
|
||||||
private String uowManagerName = DEFAULT_UOW_MANAGER_NAME;
|
private String uowManagerName;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -139,15 +140,13 @@ public class WebSphereUowTransactionManager extends JtaTransactionManager
|
||||||
this.uowManager = lookupUowManager(this.uowManagerName);
|
this.uowManager = lookupUowManager(this.uowManagerName);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new IllegalStateException("'uowManager' or 'uowManagerName' is required");
|
this.uowManager = lookupDefaultUowManager();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Look up the WebSphere UOWManager in JNDI via the configured name.
|
* Look up the WebSphere UOWManager in JNDI via the configured name.
|
||||||
* Called by <code>afterPropertiesSet</code> if no direct UOWManager reference was set.
|
|
||||||
* Can be overridden in subclasses to provide a different UOWManager object.
|
|
||||||
* @param uowManagerName the JNDI name of the UOWManager
|
* @param uowManagerName the JNDI name of the UOWManager
|
||||||
* @return the UOWManager object
|
* @return the UOWManager object
|
||||||
* @throws TransactionSystemException if the JNDI lookup failed
|
* @throws TransactionSystemException if the JNDI lookup failed
|
||||||
|
|
@ -167,6 +166,25 @@ public class WebSphereUowTransactionManager extends JtaTransactionManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obtain the WebSphere UOWManager from the default JNDI location
|
||||||
|
* "java:comp/websphere/UOWManager".
|
||||||
|
* @return the UOWManager object
|
||||||
|
* @throws TransactionSystemException if the JNDI lookup failed
|
||||||
|
* @see #setJndiTemplate
|
||||||
|
*/
|
||||||
|
protected UOWManager lookupDefaultUowManager() throws TransactionSystemException {
|
||||||
|
try {
|
||||||
|
logger.debug("Retrieving WebSphere UOWManager from default JNDI location [" + DEFAULT_UOW_MANAGER_NAME + "]");
|
||||||
|
return getJndiTemplate().lookup(DEFAULT_UOW_MANAGER_NAME, UOWManager.class);
|
||||||
|
}
|
||||||
|
catch (NamingException ex) {
|
||||||
|
logger.debug("WebSphere UOWManager is not available at default JNDI location [" +
|
||||||
|
DEFAULT_UOW_MANAGER_NAME + "] - falling back to UOWManagerFactory lookup");
|
||||||
|
return UOWManagerFactory.getUOWManager();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers the synchronizations as interposed JTA Synchronization on the UOWManager.
|
* Registers the synchronizations as interposed JTA Synchronization on the UOWManager.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue