User: d_jencks
Date: 02/02/21 20:24:55
Modified: src/main/org/jboss/ejb/plugins AbstractInstanceCache.java
AbstractInstancePool.java MetricsInterceptor.java
Log:
Made classes visible across all subpackages in a deployment such as an ear. (bug
520676. Restructured deployment process to involve 3 phases: classloading, create
where components set up their externally visible aspects, and start where components
connect to other components. Renamed Application to EjbModule.
Revision Changes Path
1.28 +2 -2 jboss/src/main/org/jboss/ejb/plugins/AbstractInstanceCache.java
Index: AbstractInstanceCache.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/AbstractInstanceCache.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- AbstractInstanceCache.java 31 Jan 2002 00:06:51 -0000 1.27
+++ AbstractInstanceCache.java 22 Feb 2002 04:24:55 -0000 1.28
@@ -61,7 +61,7 @@
* @author <a href="[EMAIL PROTECTED]">Bill Burke</a>
* @author <a href="[EMAIL PROTECTED]">Marc Fleury</a>
*
- * @version $Revision: 1.27 $
+ * @version $Revision: 1.28 $
*
* <p><b>Revisions:</b>
*
@@ -176,7 +176,7 @@
try
{
message = m_jmsSession.createMessage();
- message.setStringProperty(APPLICATION,
getContainer().getApplication().getName());
+ message.setStringProperty(APPLICATION,
getContainer().getEjbModule().getName());
message.setStringProperty(BEAN,
getContainer().getBeanMetaData().getEjbName());
if (id != null)
{
1.23 +39 -26 jboss/src/main/org/jboss/ejb/plugins/AbstractInstancePool.java
Index: AbstractInstancePool.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/AbstractInstancePool.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- AbstractInstancePool.java 28 Dec 2001 03:47:10 -0000 1.22
+++ AbstractInstancePool.java 22 Feb 2002 04:24:55 -0000 1.23
@@ -8,7 +8,7 @@
import java.rmi.RemoteException;
import java.rmi.ServerException;
-import java.util.Stack;
+import java.util.LinkedList;
import java.util.Iterator;
import java.util.Map;
import java.util.HashMap;
@@ -40,7 +40,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Andreas Schaefer</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Sacha Labourey</a>
*
- * @version $Revision: 1.22 $
+ * @version $Revision: 1.23 $
*
* <p><b>Revisions:</b>
* <p><b>20010704 marcf:</b>
@@ -72,7 +72,7 @@
protected Container container;
- protected Stack pool = new Stack();
+ protected LinkedList pool = new LinkedList();
/** The maximum number of instances allowed in the pool */
protected int maxSize = 30;
@@ -160,7 +160,10 @@
EnterpriseContext ctx = create(container.createBeanClassInstance());
if( log.isTraceEnabled() )
log.trace("Add instance "+this+"#"+ctx);
- this.pool.push(ctx);
+ synchronized (pool)
+ {
+ pool.addFirst(ctx);
+ }
}
/**
@@ -170,21 +173,24 @@
* @return Context /w instance
* @exception RemoteException
*/
- public synchronized EnterpriseContext get()
+ public EnterpriseContext get()
throws Exception
{
if( log.isTraceEnabled() )
- log.trace("Get instance
"+this+"#"+pool.empty()+"#"+getContainer().getBeanClass());
+ log.trace("Get instance
"+this+"#"+pool.isEmpty()+"#"+getContainer().getBeanClass());
EnterpriseContext ctx = null;
-
- if (!pool.empty())
+ synchronized (pool)
{
- mReadyBean.remove();
- ctx = (EnterpriseContext) pool.pop();
+ if (!pool.isEmpty())
+ {
+ mReadyBean.remove();
+ return (EnterpriseContext) pool.removeFirst();
+ }
}
+ //pool is empty
// The Pool feeder should avoid this
- else
+
{
if (useFeeder && poolFeeder.isStarted() && log.isDebugEnabled())
{
@@ -193,9 +199,14 @@
}
try
{
- if (useFeeder && ! poolFeeder.isStarted())
- poolFeeder.start();
- ctx = create(container.createBeanClassInstance());
+ synchronized (this)
+ {
+ if (useFeeder && ! poolFeeder.isStarted())
+ {
+ poolFeeder.start();
+ }
+ }
+ return create(container.createBeanClassInstance());
} catch (InstantiationException e)
{
throw new ServerException("Could not instantiate bean", e);
@@ -204,8 +215,6 @@
throw new ServerException("Could not instantiate bean", e);
}
}
-
- return ctx;
}
/**
@@ -217,7 +226,7 @@
*
* @param ctx
*/
- public synchronized void free(EnterpriseContext ctx)
+ public void free(EnterpriseContext ctx)
{
if( log.isTraceEnabled() )
{
@@ -232,15 +241,16 @@
// If (!reclaim), we do not reuse but create a brand new instance simplifies
the design
try {
mReadyBean.add();
- if( this.reclaim && pool.size() < maxSize )
+ if (this.reclaim)
{
// Add the unused context back into the pool
- try
- {
- pool.push(ctx);
- }
- catch (Exception ignored)
+ synchronized (pool)
{
+ if (pool.size() < maxSize)
+ {
+ pool.addFirst(ctx);
+ return;
+ } // end of if ()
}
}
else
@@ -271,7 +281,10 @@
public int getCurrentSize()
{
- return this.pool.size();
+ synchronized (pool)
+ {
+ return this.pool.size();
+ }
}
// Z implementation ----------------------------------------------
@@ -342,8 +355,8 @@
*/
private void freeAll()
{
- Iterator i = this.pool.iterator();
- while (i.hasNext())
+ LinkedList clone = (LinkedList)pool.clone();
+ for (Iterator i = clone.iterator(); i.hasNext(); )
{
EnterpriseContext ec = (EnterpriseContext)i.next();
// Clear TX so that still TX entity pools get killed as well
1.15 +1 -1 jboss/src/main/org/jboss/ejb/plugins/MetricsInterceptor.java
Index: MetricsInterceptor.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/MetricsInterceptor.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- MetricsInterceptor.java 9 Feb 2002 16:09:23 -0000 1.14
+++ MetricsInterceptor.java 22 Feb 2002 04:24:55 -0000 1.15
@@ -81,7 +81,7 @@
public void setContainer(Container container) {
this.container = container;
- applicationName = container.getApplication().getName();
+ applicationName = container.getEjbModule().getName();
beanName = container.getBeanMetaData().getJndiName();
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development