User: starksm
Date: 02/03/08 00:12:45
Modified: src/main/org/jboss/ejb/plugins EntityInstanceCache.java
EntityInstanceInterceptor.java
EntityLockInterceptor.java
EntityMultiInstanceInterceptor.java
Log:
Drop the use of CacheKey as its useless and having to wrap the
entity keys in a CacheKey was causing problems with the client interceptors.
Revision Changes Path
1.14 +6 -31 jboss/src/main/org/jboss/ejb/plugins/EntityInstanceCache.java
Index: EntityInstanceCache.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstanceCache.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- EntityInstanceCache.java 3 Mar 2002 18:23:08 -0000 1.13
+++ EntityInstanceCache.java 8 Mar 2002 08:12:45 -0000 1.14
@@ -11,7 +11,6 @@
import java.rmi.NoSuchObjectException;
import org.jboss.ejb.Container;
import org.jboss.ejb.EntityContainer;
-import org.jboss.ejb.CacheKey;
import org.jboss.ejb.EnterpriseContext;
import org.jboss.ejb.EntityEnterpriseContext;
import org.jboss.util.Sync;
@@ -21,7 +20,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Simone Bordet</a>
* @author <a href="[EMAIL PROTECTED]">Bill Burke</a>
- * @version $Revision: 1.13 $
+ * @version $Revision: 1.14 $
*
* <p><b>Revisions:</b>
* <p><b>2001/01/29: billb</b>
@@ -60,48 +59,24 @@
}
// Z implementation ----------------------------------------------
- public Object createCacheKey(Object id) {return new CacheKey(id);}
-
+ public Object createCacheKey(Object id)
+ {
+ return id;
+ }
// Y overrides ---------------------------------------------------
public EnterpriseContext get(Object id)
throws RemoteException, NoSuchObjectException
{
- if (!(id instanceof CacheKey))
- {
- throw new IllegalArgumentException("cache.get for entity beans must
have a CacheKey object as argument instead of " + id);
- }
EnterpriseContext rtn = null;
rtn = super.get(id);
return rtn;
}
public void remove(Object id)
{
- if (!(id instanceof CacheKey))
- {
- throw new IllegalArgumentException("cache.remove for entity
beans must have a CacheKey object as argument instead of " + id);
- }
super.remove(id);
}
- /*
- public synchronized Sync getLock(Object id)
- {
- if (!(id instanceof CacheKey))
- {
- throw new IllegalArgumentException("cache.getLock for entity
beans must have a CacheKey object as argument instead of " + id);
- }
- return super.getLock(id);
- }
- protected synchronized void removeLock(Object id)
- {
- if (!(id instanceof CacheKey))
- {
- throw new IllegalArgumentException("cache.removeLock for
entity beans must have a CacheKey object as argument instead of " + id);
- }
- super.removeLock(id);
- }
- */
protected Object getKey(EnterpriseContext ctx)
{
return ((EntityEnterpriseContext)ctx).getCacheKey();
@@ -109,7 +84,7 @@
protected void setKey(Object id, EnterpriseContext ctx)
{
((EntityEnterpriseContext)ctx).setCacheKey(id);
- ctx.setId(((CacheKey)id).getId());
+ ctx.setId(id);
}
protected Container getContainer() {return m_container;}
1.51 +4 -6
jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java
Index: EntityInstanceInterceptor.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- EntityInstanceInterceptor.java 3 Mar 2002 18:23:08 -0000 1.50
+++ EntityInstanceInterceptor.java 8 Mar 2002 08:12:45 -0000 1.51
@@ -17,9 +17,7 @@
import org.jboss.ejb.InstanceCache;
import org.jboss.ejb.InstancePool;
import org.jboss.invocation.Invocation;
-import org.jboss.ejb.CacheKey;
-import org.jboss.security.SecurityAssociation;
/**
* The instance interceptors role is to acquire a context representing
@@ -42,7 +40,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Scott Stark</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Bill Burke</a>
-* @version $Revision: 1.50 $
+* @version $Revision: 1.51 $
*
* <p><b>Revisions:</b><br>
* <p><b>2001/06/28: marcf</b>
@@ -130,7 +128,7 @@
ctx.setTransaction(mi.getTransaction());
// Set the current security information
- ctx.setPrincipal(SecurityAssociation.getPrincipal());
+ ctx.setPrincipal(mi.getPrincipal());
// Invoke through interceptors
Object rtn = getNext().invokeHome(mi);
@@ -164,7 +162,7 @@
{
// The key
- CacheKey key = (CacheKey) mi.getId();
+ Object key = mi.getId();
// The context
EntityEnterpriseContext ctx = (EntityEnterpriseContext)
container.getInstanceCache().get(key);
@@ -177,7 +175,7 @@
ctx.setTransaction(mi.getTransaction());
// Set the current security information
- ctx.setPrincipal(SecurityAssociation.getPrincipal());
+ ctx.setPrincipal(mi.getPrincipal());
// Set context on the method invocation
mi.setEnterpriseContext(ctx);
1.9 +3 -7 jboss/src/main/org/jboss/ejb/plugins/EntityLockInterceptor.java
Index: EntityLockInterceptor.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityLockInterceptor.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- EntityLockInterceptor.java 19 Dec 2001 05:39:24 -0000 1.8
+++ EntityLockInterceptor.java 8 Mar 2002 08:12:45 -0000 1.9
@@ -13,7 +13,6 @@
import org.jboss.ejb.BeanLockManager;
import org.jboss.ejb.EntityContainer;
import org.jboss.invocation.Invocation;
-import org.jboss.ejb.CacheKey;
/**
* The lock interceptors role is to schedule thread wanting to invoke method on a
target bean
@@ -31,7 +30,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Bill Burke</a>
-* @version $Revision: 1.8 $
+* @version $Revision: 1.9 $
*
* <p><b>Revisions:</b><br>
* <p><b>2001/07/30: marcf</b>
@@ -86,8 +85,8 @@
{
// The key.
- Object key = (CacheKey) mi.getId();
-
+ Object key = mi.getId();
+
// The lock.
BeanLock lock ;
@@ -128,7 +127,4 @@
}
}
}
-
-
-
1.8 +5 -8
jboss/src/main/org/jboss/ejb/plugins/EntityMultiInstanceInterceptor.java
Index: EntityMultiInstanceInterceptor.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntityMultiInstanceInterceptor.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- EntityMultiInstanceInterceptor.java 3 Mar 2002 18:23:08 -0000 1.7
+++ EntityMultiInstanceInterceptor.java 8 Mar 2002 08:12:45 -0000 1.8
@@ -15,9 +15,6 @@
import org.jboss.ejb.EnterpriseContext;
import org.jboss.ejb.InstancePool;
import org.jboss.invocation.Invocation;
-import org.jboss.ejb.CacheKey;
-
-import org.jboss.security.SecurityAssociation;
/**
* The instance interceptors role is to acquire a context representing
@@ -25,7 +22,7 @@
*
*
* @author <a href="mailto:[EMAIL PROTECTED]">Bill Burke</a>
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
*
* <p><b>Revisions:</b><br>
* <p><b>2001/08/08: billb</b>
@@ -73,7 +70,7 @@
ctx.setTransaction(mi.getTransaction());
// Set the current security information
- ctx.setPrincipal(SecurityAssociation.getPrincipal());
+ ctx.setPrincipal(mi.getPrincipal());
// Invoke through interceptors
return getNext().invokeHome(mi);
@@ -84,7 +81,7 @@
{
// The key
- CacheKey key = (CacheKey) mi.getId();
+ Object key = mi.getId();
EntityEnterpriseContext ctx = null;
if (mi.getTransaction() != null)
@@ -95,7 +92,7 @@
{
ctx = (EntityEnterpriseContext)container.getInstancePool().get();
ctx.setCacheKey(key);
- ctx.setId(key.getId());
+ ctx.setId(key);
container.getPersistenceManager().activateEntity(ctx);
}
@@ -107,7 +104,7 @@
ctx.setTransaction(mi.getTransaction());
// Set the current security information
- ctx.setPrincipal(SecurityAssociation.getPrincipal());
+ ctx.setPrincipal(mi.getPrincipal());
// Set context on the method invocation
mi.setEnterpriseContext(ctx);
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development