jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jaco Prinsloo <jacoli...@gmail.com>
Subject Re: Jackrabbit Session inside Stateless Session EJB
Date Thu, 15 Oct 2009 12:26:45 GMT
Thanks, so I assume there isn't any problem with reusing a session (as
subsequent requests to the EJB could be made by different users)?

On Thu, Oct 15, 2009 at 11:28 AM, Guo Du <mrduguo@gmail.com> wrote:

> On Thu, Oct 15, 2009 at 7:41 AM, Jaco Prinsloo <jacolists@gmail.com>
> wrote:
> > Thanks for clarifying.
> > Perhaps I can clarify the difference with two pseudo-ish code examples:
> >
> > (1)
> > @Stateless
> > public class RepositoryEJB {
> >  @Resource private Repository repository;
> >
> >  public String getMimeType(String path) {
> >    Session session = repository.login( .. );
> >    String mimeType =
> > (String)session.getRootNode().getNode(path).getProperties().get( .. );
> >    session.logout();
> >    return mimeType;
> >  }
>
> >1) Every request (method) opens a session, performs the work and then
> closes
> > the session again.
>
> Sorry, I was missed the keywords "method" at first place. Open session
> COULD be expensive operation. I was never thought such a way to
> process request :(
>
> So the second is the right approach. Just make sure you closed the
> session properly at the end.
>
> -Guo
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message