Hi Dan (Hi Hendrik - nice to "see" you here),
I've posted example code that may help in the thread "Re: [Re: Re: JBoss
and Jackrabbit JCA]" on Aug 17th (12:19).
kind regards,
Markus
Hendrik Beck (camunda) schrieb:
Hi Dan!
-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Daniel Br?uen
Sent: Thursday, August 23, 2007 10:23 PM
To: [email protected]
Subject: Re: Repository Lock Problem in JEE-Environment
Hi!
Marcel May wrote:
Can you use |@PreDestroy annotated method ?
Yes, that's worth a try, at least for stateful session beans
(@PrePassivate, @PostPassivate).
Be aware, that you should not rely on that these methods are really called
in any case. One example would be a server crash, but in general you should
be careful with that. Just ask yourself the question how serious it would be
if your bean dies without having executed the code in here.
How do other folks use Jackrabbit in a JEE Environment, especially in a
session bean? Do you acquire the repository in every single method call
via JNDI, or do you store the repository handle in a member variable of
the bean?
If I get it correctly there can be only one single bean accessing the
repository, since the repository can talk to only one single
application. As a consequence there would be a locking-problem if the
container decides to create another bean to handle requests, which is odd.
I haven't tested it, but the @Resource annotation should work to access
anything that's in JNDI. For example if you hooked your Repository into JNDI
under "java:jcr/local" then you should be able to get the handle like that:
public class MyBean() {
@Resource (name="jcr/local") private Repository repository;
(...)
}
The container now looks up the Repository in JNDI and injects it into the
bean when it's created. This should work with managed beans in EJB3 (i.e. SL
and SF beans), I doubt it's working e.g. for helper classes.
Hope it helps. Best regards
Hendrik
cheers,
Dan
--
Mag. Markus Reis
Austrian Research Centers GmbH - ARC
Research Studios
Studio Digital Memory Engineering
Thurngasse 8/3/20, A-1090 Wien
Mobile: +43 664 825 1106
Tel.: +43-1-585 05 37 - 16
Fax: +43-1-585 37 41
<[EMAIL PROTECTED]>
http://www.arcs.ac.at/
http://www.researchstudio.at/
http://dme.researchstudio.at/
HG Wien – FN 115980i – ATU14703506