You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by johannes lechner <Jo...@consol.de> on 2009/04/14 13:57:10 UTC

Jackrabbit Clustering

Dear Readers,

 

I got a question on clustering Jackrabbit. 

We use version 1.5.3. of Apache Jackrabbit along with the
springmodules-jcr-0.8.

We managed to use an oracle db for content saving, exactly like shown in the
documentation.

Our Problem:

We tried to save content in one session  and read the content with another
session on a second server.

But it seems there are some synchronization problems.

So if one session uses "save" the other session should see this  changes by
calling "session.refresh(Boolean)", or I am wrong?

Is this the intended way to synchronize two sessions across the network?

 

We thought a  "session.refresh(true/false)" should work.

We looked around in springmodules and jackrabbit `s source code and we found
the following code lines.

____________________________________________________________________________
____________

Springmodules -> JcrTemplate:

-----------------------------------------------------------------------

                public Object execute(JcrCallback action, boolean
exposeNativeSession) throws DataAccessException {

                               Session session = getSession();

                               boolean existingTransaction =
SessionFactoryUtils.isSessionThreadBound(session, getSessionFactory());

                               if (existingTransaction) {

                                               logger.debug("Found
thread-bound Session for JcrTemplate");

                               }

 

                               try {

                                               Session sessionToExpose =
(exposeNativeSession ? session : createSessionProxy(session));

                                               Object result =
action.doInJcr(sessionToExpose);

                                               // TODO: does flushing
(session.refresh) should work here?

                                               // flushIfNecessary(session,
existingTransaction);

                                               return result;

                               ...

 

____________________________________________________________________________
_____________

Jackrabbit -> ItemImpl:

------------------------------------------------------------------------

    public synchronized void refresh(boolean keepChanges)

            throws InvalidItemStateException, RepositoryException {

        // check state of this instance

        sanityCheck();

 

        if (keepChanges) {

            /** todo FIXME should reset Item#status field to STATUS_NORMAL

             * of all descendent non-transient instances; maybe also

             * have to reset stale ItemState instances */

            return;

        }

 

        if (isNode()) {

            // check if this is the root node

        .

 

 

Look at the code comments.

As you can see there are open issues, I am not sure if clustering depends on
them.

So what is your current state of clustering, does it work well without sync
problems?

Can you give us any hints?

 

Thank you very much.

 

 


Re: Jackrabbit Clustering

Posted by Marcel Reutegger <ma...@gmx.net>.
Hi,

does the session on the second cluster node eventually see then
change? if yes, than you might be interested in
https://issues.apache.org/jira/browse/JCR-1753, otherwise there's
probably a configuration problem with your setup.

regards
 marcel

On Tue, Apr 14, 2009 at 13:57, johannes lechner
<Jo...@consol.de> wrote:
> Dear Readers,
>
>
>
> I got a question on clustering Jackrabbit.
>
> We use version 1.5.3. of Apache Jackrabbit along with the
> springmodules-jcr-0.8.
>
> We managed to use an oracle db for content saving, exactly like shown in the
> documentation.
>
> Our Problem:
>
> We tried to save content in one session  and read the content with another
>  session on a second server.
>
> But it seems there are some synchronization problems.
>
> So if one session uses “save” the other session should see this  changes by
> calling “session.refresh(Boolean)”, or I am wrong?
>
> Is this the intended way to synchronize two sessions across the network?
>
>
>
> We thought a  “session.refresh(true/false)” should work.
>
> We looked around in springmodules and jackrabbit `s source code and we found
> the following code lines.
>
> ________________________________________________________________________________________
>
> Springmodules -> JcrTemplate:
>
> -----------------------------------------------------------------------
>
>                 public Object execute(JcrCallback action, boolean
> exposeNativeSession) throws DataAccessException {
>
>                                Session session = getSession();
>
>                                boolean existingTransaction =
> SessionFactoryUtils.isSessionThreadBound(session, getSessionFactory());
>
>                                if (existingTransaction) {
>
>                                                logger.debug("Found
> thread-bound Session for JcrTemplate");
>
>                                }
>
>
>
>                                try {
>
>                                                Session sessionToExpose =
> (exposeNativeSession ? session : createSessionProxy(session));
>
>                                                Object result =
> action.doInJcr(sessionToExpose);
>
>                                                // TODO: does flushing
> (session.refresh) should work here?
>
>                                                // flushIfNecessary(session,
> existingTransaction);
>
>                                                return result;
>
>                                ...
>
>
>
> _________________________________________________________________________________________
>
> Jackrabbit -> ItemImpl:
>
> ------------------------------------------------------------------------
>
>     public synchronized void refresh(boolean keepChanges)
>
>             throws InvalidItemStateException, RepositoryException {
>
>         // check state of this instance
>
>         sanityCheck();
>
>
>
>         if (keepChanges) {
>
>             /** todo FIXME should reset Item#status field to STATUS_NORMAL
>
>              * of all descendent non-transient instances; maybe also
>
>              * have to reset stale ItemState instances */
>
>             return;
>
>         }
>
>
>
>         if (isNode()) {
>
>             // check if this is the root node
>
>         …
>
>
>
>
>
> Look at the code comments.
>
> As you can see there are open issues, I am not sure if clustering depends on
> them.
>
> So what is your current state of clustering, does it work well without sync
> problems?
>
> Can you give us any hints?
>
>
>
> Thank you very much.
>
>
>
>