You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by Robert Leftwich <ro...@leftwich.info> on 2002/08/17 23:20:17 UTC

[newbie] Rollback and content

I am doing some playing around with Slide and have a problem with using
rollback. The setup is using 2002-08-17 nightly src, built with JDK 1.4.0_01
on W2000, using HSQL DB setup as per the domain.sample file. The problem is
that if I start a transaction, add some content then rollback and check to
see if the content is still there - it is. The code snippet I am using is as
follows:

                 // make sure content is not already there
                 try {
                     revisionDescriptors = content.retrieve(slideToken, 
content2URI);
                     if (null != revisionDescriptors) {
                         System.out.println("ERROR: Content before rollback 
test");
                     }
                 } catch (ObjectNotFoundException e) {
                     // expected
                 } catch (Throwable e) {
                     e.printStackTrace();
                 }

                 // start test
                 token.begin();
                 contentSubject = new SubjectNode();
                 structure.create(slideToken, contentSubject, content2URI);

                 content.create(slideToken, content2URI, true);

                 revisionDescriptors = null;
                 revisionDescriptor = null;

                 revisionDescriptors = content.retrieve(slideToken, 
content2URI);

                 nodeRevContent = new NodeRevisionContent();

                 revisionDescriptor = new NodeRevisionDescriptor(-1);

                 revisionDescriptor.setProperty("revision", "1");
                 nodeRevContent.setContent(contentText.toCharArray());
                 content.create(slideToken, content2URI, revisionDescriptor,
                                nodeRevContent);

                 revisionDescriptors = content.retrieve(slideToken, 
content2URI);
                 if (null == revisionDescriptors) {
                     System.out.println("ERROR: no content after commit");
                 }

                 try {
                     token.rollback();
                 } catch (SystemException ex) {
                     ex.printStackTrace();
                 }

                 try {
                     revisionDescriptors = content.retrieve(slideToken, 
content2URI);
                     if (null != revisionDescriptors) {
                         System.out.println("ERROR: Content after rollback");
                     }
                 } catch (Throwable e) {
                     e.printStackTrace();
                 }

The problem is that the last content.retrieve always returns a not-null. Am
I missing something here or is rollback broken?

Robert


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [newbie] Rollback and content

Posted by Robert Leftwich <ro...@leftwich.info>.
More info - the problem is that the structure (i.e. ObjectNode) is not 
removed from the cache in the StandardStore when rollback is called, so 
structure.retrieve() will always return it. This seems to me to be a fairly 
serious problem - is there a plan to address the sync'ing of caches with 
transactions at all ?

Robert


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [newbie] Rollback and content

Posted by Robert Leftwich <ro...@leftwich.info>.
Adding to my own question:

At 07:20 AM 18/08/2002, I wrote:
>I am doing some playing around with Slide and have a problem with using
>rollback. The setup is using 2002-08-17 nightly src, built with JDK 1.4.0_01
>on W2000, using HSQL DB setup as per the domain.sample file. The problem is
>that if I start a transaction, add some content then rollback and check to
>see if the content is still there - it is.

Further playing reveals that the problem seems to be with the structure
implementation, because after a rollback, the structure that was created
during the transaction still exists (or at least is returned via
structure.retrieve(slideToken, contentURI);). Note that the structure does
not exist in the HSQL database after the test program runs, only appearing
after a rollback during execution. This in turn means that a
NodeRevisionDescriptor is automatically created when retrieve is called.
The code snippet testing this is shown below:

                 ......
                 try {
                     token.rollback();

                 } catch (SystemException ex) {
                     ex.printStackTrace();
                 }

                 try {
                     ObjectNode subjectNode = 
structure.retrieve(slideToken, content2URI);
                     if (null != subjectNode) {
                         System.out.println("ERROR: structure exists after 
a rollback");
                     }
                 } catch (Throwable e) {
                     e.printStackTrace();
                 }

                 ....

Is this expected behavior? If so can someone explain the rationale behind
it, if not does this bug need to added to a bug list somewhere?.

Robert


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>