User: starksm
Date: 02/03/12 19:24:23
Modified: src/main/org/jboss/proxy/ejb ProxyFactory.java
Log:
Move the lookup of the invokers and binding of the homes to the
start method to ensure that invokers on which we depend have been started
Revision Changes Path
1.13 +51 -46 jboss/src/main/org/jboss/proxy/ejb/ProxyFactory.java
Index: ProxyFactory.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/proxy/ejb/ProxyFactory.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ProxyFactory.java 11 Mar 2002 06:31:11 -0000 1.12
+++ ProxyFactory.java 13 Mar 2002 03:24:23 -0000 1.13
@@ -61,7 +61,8 @@
* @todo eliminate this class, at least in its present form.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
- * @version $Revision: 1.12 $
+ * @author <a href="mailto:[EMAIL PROTECTED]">Scott Stark/a>
+ * @version $Revision: 1.13 $
*
* <p><b>Revisions:</b><br>
* <p><b>2001/12/30: billb</b>
@@ -81,7 +82,7 @@
protected static final String LIST_ENTITY_INTERCEPTOR = "list-entity";
// Metadata for the proxies
- public EJBMetaData ejbMetaData ;
+ public EJBMetaData ejbMetaData;
protected static Logger log = Logger.getLogger(ProxyFactory.class);
protected EJBHome home;
@@ -137,8 +138,7 @@
boolean session,
boolean statelessSession,
HomeHandle homeHandle)
- */
-
+ */
boolean isSession = !(container.getBeanMetaData() instanceof EntityMetaData);
Class pkClass = null;
if (!isSession)
@@ -173,10 +173,21 @@
log.debug("Proxy Factory for "+jndiName+" initialized");
initInterceptorClasses();
+ }
+
+ /** Become fully available. At this point our invokers should be started
+ and we can bind the homes into JNDI.
+ */
+ public void start() throws Exception
+ {
setupInvokers();
bindProxy();
}
-
+
+ /** Lookup the invokers in the object registry. This typically cannot
+ be done until our start method as the invokers may need to be started
+ themselves.
+ */
protected void setupInvokers() throws Exception
{
ObjectName oname;
@@ -191,9 +202,9 @@
if (beanInvoker == null)
throw new RuntimeException("beanInvoker is null: " + oname);
}
- public void start() {}
-
+ /** Load the client interceptor classes
+ */
protected void initInterceptorClasses()
{
ConfigurationMetaData configMetaData =
container.getBeanMetaData().getContainerConfiguration();
@@ -209,8 +220,8 @@
}
/**
- * The <code>loadInterceptorClasses</code> load an interceptor classes from
configuration
- *
+ * The <code>loadInterceptorClasses</code> load an interceptor classes from
+ * configuration
* @exception Exception if an error occurs
*/
protected void loadInterceptorClasses(ArrayList classes, Element interceptors)
@@ -234,8 +245,8 @@
log.error("failed to load client interceptor chain", ex);
}
}
- /**
- * The <code>loadInterceptorChain</code> create instances of interceptor chain
+ /** The <code>loadInterceptorChain</code> create instances of interceptor
+ * classes previously loaded in loadInterceptorClasses
*
* @exception Exception if an error occurs
*/
@@ -265,16 +276,17 @@
log.error("failed to load client interceptor chain", ex);
}
}
- /**
- * The <code>bindProxy</code> method creates the home proxy and the bean proxy,
- * and binds them into jndi.
+
+ /** The <code>bindProxy</code> method creates the home proxy and binds
+ * the home into jndi. It also creates the InvocationContext and client
+ * container and interceptor chain.
*
* @exception Exception if an error occurs
*/
- public void bindProxy() throws Exception
+ protected void bindProxy() throws Exception
{
- try {
-
+ try
+ {
// Create a stack from the description (in the future) for now we hardcode
it
InvocationContext context = new InvocationContext();
@@ -289,15 +301,14 @@
loadInterceptorChain(homeInterceptorClasses, client);
// Create the EJBHome
- this.home =
- (EJBHome)Proxy.newProxyInstance(
+ this.home = (EJBHome) Proxy.newProxyInstance(
// Class loader pointing to the right classes from deployment
((ContainerInvokerContainer)container).getHomeClass().getClassLoader(),
// The classes we want to implement home and handle
new Class[] { ((ContainerInvokerContainer)container).getHomeClass(),
Class.forName("javax.ejb.Handle")},
// The home proxy as invocation handler
client);
-
+
// Create stateless session object
// Same instance is used for all objects
if (!(container.getBeanMetaData() instanceof EntityMetaData) &&
@@ -334,22 +345,21 @@
container.getBeanMetaData().getJndiName(),
// The Home
getEJBHome());
-
-
-
+
if (log.isDebugEnabled())
log.debug("Bound "+container.getBeanMetaData().getEjbName() + " to " +
container.getBeanMetaData().getJndiName());
- } catch (Exception e)
+ }
+ catch (Exception e)
{
throw new ServerException("Could not bind home", e);
}
}
-
+
public void stop()
{
}
-
+
public void destroy()
{
try
@@ -363,7 +373,7 @@
// ignore.
}
}
-
+
// Container invoker implementation -------------------------------------
public EJBMetaData getEJBMetaData()
@@ -376,12 +386,16 @@
return home;
}
+ /** Return the EJBObject proxy for stateless sessions.
+ */
public Object getStatelessSessionEJBObject()
{
return statelessObject;
}
+ /** Create an EJBObject proxy for a stateful session given its session id.
+ */
public Object getStatefulSessionEJBObject(Object id)
{
// Create a stack from the description (in the future) for now we hardcode it
@@ -405,10 +419,11 @@
client);
}
-
+
+ /** Create an EJBObject proxy for an entity given its primary key.
+ */
public Object getEntityEJBObject(Object id)
{
-
// Create a stack from the description (in the future) for now we hardcode it
InvocationContext context = new InvocationContext();
@@ -428,29 +443,21 @@
new Class[] { ((ContainerInvokerContainer)container).getRemoteClass() },
// Proxy as invocation handler
client);
- /*
- // marcf fixme: for the jrmp stuff include this creation on the client side
- return (EJBObject)Proxy.newProxyInstance(
- // Classloaders
- ((ContainerInvokerContainer)container).getRemoteClass().getClassLoader(),
- // Interfaces
- new Class[] { ((ContainerInvokerContainer)container).getRemoteClass() },
- // Proxy as invocation handler
- new EntityProxy(objectName, jndiName, id,beanInvoker));
- */
}
+ /** Create a Collection EJBObject proxies for an entity given its primary keys.
+ */
public Collection getEntityCollection(Collection ids)
{
ArrayList list = new ArrayList(ids.size());
Iterator idEnum = ids.iterator();
- if ((ids instanceof FinderResults) && ((FinderResults)
ids).isReadAheadOnLoadUsed()) {
+ if ((ids instanceof FinderResults) && ((FinderResults)
ids).isReadAheadOnLoadUsed())
+ {
long listId = ((FinderResults) ids).getListId();
for (int i = 0; idEnum.hasNext(); i++)
- {
-
+ {
// Create a stack from the description (in the future) for now we
hardcode it
InvocationContext context = new InvocationContext();
@@ -470,12 +477,10 @@
client));
}
}
-
-
- else {
+ else
+ {
while(idEnum.hasNext())
{
-
// Create a stack from the description (in the future) for now we
hardcode it
InvocationContext context = new InvocationContext();
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development