You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by dj...@apache.org on 2008/03/22 08:44:24 UTC
svn commit: r639959 -
/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityInstanceManager.java
Author: djencks
Date: Sat Mar 22 00:44:21 2008
New Revision: 639959
URL: http://svn.apache.org/viewvc?rev=639959&view=rev
Log:
OPENEJB-783 don't try to commit for a non-existent entity bean
Modified:
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityInstanceManager.java
Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityInstanceManager.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityInstanceManager.java?rev=639959&r1=639958&r2=639959&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityInstanceManager.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityInstanceManager.java Sat Mar 22 00:44:21 2008
@@ -59,7 +59,7 @@
* by using an instance of the inner Key class. The Key class is a compound key composed
* of the tx, deployment, and primary key identifiers.
*/
- protected Hashtable<Object,SyncronizationWrapper> txReadyPool = new Hashtable<Object,SyncronizationWrapper>();
+ protected Hashtable<Object, SynchronizationWrapper> txReadyPool = new Hashtable<Object, SynchronizationWrapper>();
/*
* contains a collection of LinkListStacks indexed by deployment id. Each indexed stack
* represents the method ready pool of for that class.
@@ -80,8 +80,7 @@
poolMap = new HashMap<Object,LinkedListStack>();// put size in later
DeploymentInfo[] deploymentInfos = this.container.deployments();
- for (int i = 0; i < deploymentInfos.length; i++) {
- DeploymentInfo deploymentInfo = deploymentInfos[i];
+ for (DeploymentInfo deploymentInfo : deploymentInfos) {
deploy(deploymentInfo);
}
}
@@ -107,7 +106,7 @@
if (currentTx != null && primaryKey != null) {// primkey is null if create operation is called
CoreDeploymentInfo deploymentInfo = callContext.getDeploymentInfo();
Key key = new Key(currentTx, deploymentInfo.getDeploymentID(), primaryKey);
- SyncronizationWrapper wrapper = txReadyPool.get(key);
+ SynchronizationWrapper wrapper = txReadyPool.get(key);
if (wrapper != null) {// if true, the requested bean instance is already enrolled in a transaction
@@ -153,7 +152,7 @@
* so it needs to be enrolled in the transaction.
*/
EntityBean bean = getPooledInstance(callContext);
- wrapper = new SyncronizationWrapper(callContext.getDeploymentInfo(), primaryKey, bean, false, key);
+ wrapper = new SynchronizationWrapper(callContext.getDeploymentInfo(), primaryKey, bean, false, key);
if (callContext.getCurrentOperation() == Operation.REMOVE) {
/*
@@ -181,10 +180,12 @@
try {
bean.ejbLoad();
} catch (NoSuchEntityException e) {
+ wrapper.disassociate();
throw new InvalidateReferenceException(new NoSuchObjectException("Entity not found: " + primaryKey).initCause(e));
} catch (Exception e) {
logger.error("Exception encountered during ejbLoad():", e);
-
+ //djencks not sure about this dissociate call
+ wrapper.disassociate();
throw new OpenEJBException(e);
} finally {
callContext.setCurrentOperation(orginalOperation);
@@ -307,7 +308,7 @@
if (bean == null) {
return;
}
- Transaction currentTx = null;
+ Transaction currentTx;
try {
currentTx = getTransactionManager().getTransaction();
} catch (javax.transaction.SystemException se) {
@@ -316,7 +317,7 @@
}
if (currentTx != null && primaryKey != null) {// primary key is null for find and home methods
Key key = new Key(currentTx, callContext.getDeploymentInfo().getDeploymentID(), primaryKey);
- SyncronizationWrapper wrapper = txReadyPool.get(key);
+ SynchronizationWrapper wrapper = txReadyPool.get(key);
if (wrapper != null) {
if (callContext.getCurrentOperation() == Operation.REMOVE) {
/*
@@ -347,7 +348,7 @@
tx ready pool
*/
- wrapper = new SyncronizationWrapper(callContext.getDeploymentInfo(), primaryKey, bean, true, key);
+ wrapper = new SynchronizationWrapper(callContext.getDeploymentInfo(), primaryKey, bean, true, key);
try {
currentTx.registerSynchronization(wrapper);
@@ -470,7 +471,7 @@
in the txReadyPool is indicative of an entity bean that has been removed via
ejbRemove() rather than freed because of an error condition as is the case here.
*/
- SyncronizationWrapper wrapper = txReadyPool.remove(key);
+ SynchronizationWrapper wrapper = txReadyPool.remove(key);
if (wrapper != null) {
/*
@@ -538,7 +539,7 @@
* to the method ready pool. Instances of this class are not recycled anymore, because modern VMs
* (JDK1.3 and above) perform better for objects that are short lived.
*/
- protected class SyncronizationWrapper implements Synchronization {
+ protected class SynchronizationWrapper implements Synchronization {
private EntityBean bean;
/*
* <tt>isAvailable<tt> determines if the wrapper is still associated with a bean. If the bean identity is removed (ejbRemove)
@@ -551,7 +552,7 @@
private final CoreDeploymentInfo deploymentInfo;
private final Object primaryKey;
- public SyncronizationWrapper(CoreDeploymentInfo deploymentInfo, Object primaryKey, EntityBean bean, boolean available, Key readyPoolIndex) {
+ public SynchronizationWrapper(CoreDeploymentInfo deploymentInfo, Object primaryKey, EntityBean bean, boolean available, Key readyPoolIndex) {
if (bean == null) throw new IllegalArgumentException("bean is null");
if (readyPoolIndex == null) throw new IllegalArgumentException("key is null");
if (deploymentInfo == null) throw new IllegalArgumentException("deploymentInfo is null");