Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
JSP - A mailing list about Java Server Pages specification and reference
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
- Home and component interface references in clu

- Home and component interface references in clu

2007-07-12       - By Alenaal

 Back
Hi all,

I have a questions about home or component interface references in clustered
JBoss, about how they are saved, replicated and managed. They always say "try
it" so I wrote a small example to illustrate my point. Basically my question is
about how and why home, component and local home references work in clustered
JBoss. I would very much appreciate an expert opinion. Below is my example.
Many thanks to you all in advance.


I run JBoss 4.0.5 as a cluster  (I put apache with mod_jk) on two boxes, say
box1, box2 which makes two nodes: node1, node2 respectively and I use farming
to deploy my ejbs. So I put myEjb.jar into farm on node1 and it get distributed
to node2
I enabled a NON-sticky approach (just a test to illustrate my question and be
able later on to go to another server that does not support sticky) so requests
go a box1/box2/box1.... in a round-robin manner.
The call is like this JSP -> servlet -> SFSB. I am testing this Stateful
Session Bean (let's call it AddressManagerHome). It is a facade for two other
stateful beans (it is just a test to illustrate my question). Servlet gets
reference to component interface of the bean and stores it into the request.

For this particular test my SFSB has 3 instance variables (here they are just
to make things clear)

protected AddressHome addressHome = null; (reference to home interface)
protected Address address = null;  (reference to component interface)
protected WorkAddressLocalHome workAddressHome = null; (reference to local
home interface)

they are all initialized in ejbCreate of the bean. So I create bean in the
servlet like this
public class AddressManagerServlet extends HttpServlet {
....
   AddressManagerHome home = (AddressManagerHome) ServiceLocator.getInstance()
.getRemoteHome(.....);
   AddressManager bean = home.create();
   bean.testAll()
....

where testAll() does 3 things:
1. for home reference (addressHome) it creates component interface and calls
method :  
       Address bean = addressHome.create();  
       bean.test();
2. for component reference (address) it just calls method :  
   address.test();
3. for local home interface it creates home component reference and calls
method :
       WorkAddressLocal bean = workAddressHome.create();    
       bean.test();    


Now, the 1st request goes to node1 and everything works fine. Then 2nd request
(same session, I use encodeURL) goes to node2 and everything is fine again. WHY?
???
I understand why case N1 is fine, we just have reference to remote home so no
problem there but why in case N2 it is fine? If we created ejbObject on node1
and then call it from node2? How is node2 even aware of address bean being
created earlier in node1?? Shouldn't it say I have no idea, create reference to
component interface again?

And why is case N3 is fine? It is a reference to local to home. Which is by
definition local to VM ! So if WorkAddressLocalHome  is created in node1 then
node2 should have no idea what it is.  So how does exactly clustering in JBoss
work?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic
&p=4063782#4063782

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode
=reply&p=4063782
__ ____ ____ ____ ____ ____ ____ ____ ____ ____
jboss-user mailing list
jboss-user@(protected)
https://lists.jboss.org/mailman/listinfo/jboss-user

©2008 junlu.com - Jax Systems, LLC, U.S.A.