[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] SharedObject API Problem: Serialization Problem when adding TransactionSharedObject

Hi Jan,

On 9/4/2010 5:46 PM, Jan Novacek wrote:

I'm working with the SharedObject API  and ran into a Problem.
I understand how to use the API when implementing a class which extends from BaseSharedObject
and implemented an shared object as described in the wiki.
It is all fine and works right as it should! by the way: Nice work guys :)


Then, I derived my class from TransactionSharedObject and set it up according to
an example I found here http://www.eclipse.org/ecf/NewAndNoteworthy_0.5.2.html (at the bottom).
I can not see any differences except that a timeout is set in the Primary and that the
EventProcessor is added in initialize() in TransactionSharedObject.

Anyway, when I am trying to add the shared object, I get an exception:
"org.eclipse.ecf.core.sharedobject.SharedObjectAddAbortException: SharedObjectCommitEvent could not be sent"
Setting a breakpoint in TwoPhaseCommitEventProcessor.sendCommit() revealed that Serialization failed:
"java.io.NotSerializableException: shared object messageSharedObjectCommitEvent[StringID[SharedObjID];null] not serializable"

I do not understand this, because the shared object class implements Serializable and serialization obviously worked before.
I have also removed all attributes from this class to test the basic mechanism, but still no luck.

Have I done something wrong in using TransactionSharedObject?

No, this was a regression caused by changing the class hierarchy for SharedObjectCommitEvent sometime after 0.5.2 (I can't remember exactly when at the moment).

I created this bug to track this problem:  https://bugs.eclipse.org/bugs/show_bug.cgi?id=324531

The fix was simple...to make SharedObjectCommitEvent class Serializable. I also added test code to org.eclipse.ecf.tests.sharedobject test bundle to reproduce this error in the existing code (which I did), and then test the fix (also done).  I've released the fix to ECF HEAD (3.4) and Release_3_3 (3.3.1) streams.

Thanks for the report.