Bug 357615 - EventManager should be serializable
Summary: EventManager should be serializable
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Runtime (show other bugs)
Version: 3.7.1   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: platform-runtime-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 486067
Blocks: 352926
  Show dependency tree
 
Reported: 2011-09-14 06:46 EDT by Rüdiger Herrmann CLA
Modified: 2016-08-24 10:21 EDT (History)
5 users (show)

See Also:


Attachments
Patch to make ListenerList serializable (1.14 KB, patch)
2011-09-19 10:31 EDT, Rüdiger Herrmann CLA
no flags Details | Diff
Patch to make EventManager serializable (42.53 KB, patch)
2011-09-19 10:48 EDT, Rüdiger Herrmann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rüdiger Herrmann CLA 2011-09-14 06:46:13 EDT
Currently, classes derived from EventManager in org.eclipse.core.commands.common cannot be fully serialized because the EventManagers listenerList field is marked as transient.

The RAP project maintains a 'fork' of JFace with with changes to make JFace run in a multi-user web environment. We are in the process of enabling transparent session-failover in RAP. To achieve this, all objects that 'live' in a session must be serializable so that a servlet container can persist the current state of a session. This applies to most classes from JFace, where in turn many of them inherit from EventManager, e.g. BaseLabelProvider.
Therefore I suggest to make the private listenerList field of EventManager non-transient and change the ListenerList from org.eclipse.core.runtime to implement Serializable.
With these changes, the BaseLabelProvider from the JFace/RAP bundle could be changed to implement Serializable and then be used in environments that require session-failover.

I will provide a patch with the necessary changes and tests if it is agreed on that the proposed changes should be made.
Comment 1 Thomas Watson CLA 2011-09-14 10:31:00 EDT
org.eclipse.core.commands is in the Platform->UI git repo.
Comment 2 Paul Webster CLA 2011-09-15 14:48:20 EDT
It would start with ListenerList (core.runtime) being serializable ... but the events that this class stores aren't guaranteed to be seralizable, they're just any old Object, no?

PW
Comment 3 Rüdiger Herrmann CLA 2011-09-16 04:03:10 EDT
(In reply to comment #2)
> It would start with ListenerList (core.runtime) being serializable ... but the
> events that this class stores aren't guaranteed to be seralizable, they're just
> any old Object, no?
Right, the objects that this class stores aren't necessarily serializable. But as ListenerList is mainly used as a utility class instead of directly being exposed, the calling code can ensure that only serializable objects are stored. Like Viewer.addSelectionChangedListener() makes sure that only ISelectionChangedListeners are stored.
Comment 4 Rüdiger Herrmann CLA 2011-09-19 10:31:12 EDT
Created attachment 203597 [details]
Patch to make ListenerList serializable

This change makes org.eclipse.core.runtime.ListenerList in bundle org.eclipse.equinox.common serializable
Comment 5 Rüdiger Herrmann CLA 2011-09-19 10:48:21 EDT
Created attachment 203601 [details]
Patch to make EventManager serializable

The EventManager was made serializable. 
The current compiler setting is to handle serializable classes without a serialVersionUID as an error. To avoid touching all classes that inherit from EventManager, I changed the problem severity to 'ignore' for now. How would you like this case to be handled? Should I declare serialVersionUID for all affected classes?