Bug 412186 - [Distributed EventAdmin] Add API for custom Serialization per event topic
Summary: [Distributed EventAdmin] Add API for custom Serialization per event topic
Status: REOPENED
Alias: None
Product: ECF
Classification: RT
Component: ecf.remoteservices (show other bugs)
Version: 3.6.1   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Markus Kuppe CLA
QA Contact:
URL:
Whiteboard:
Keywords: api, noteworthy
Depends on:
Blocks:
 
Reported: 2013-07-03 06:17 EDT by Markus Kuppe CLA
Modified: 2013-10-13 16:42 EDT (History)
1 user (show)

See Also:


Attachments
mylyn/context/zip (25.55 KB, application/octet-stream)
2013-07-05 06:59 EDT, Markus Kuppe CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Kuppe CLA 2013-07-03 06:17:20 EDT
Bug #412180 makes clear that not all consumers/users of OSGi EventAdmin follow the OSGi EventAdmin spec guideline and only send primitives as event data. Thus, for event data not implementing serializable, we should use "SmartSerialization" (see http://git.eclipse.org/c/ecf/org.eclipse.ecf.git/tree/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/util/SmartObjectOutputStream.java).

(Also see bug #385740)
Comment 1 Scott Lewis CLA 2013-07-03 20:23:39 EDT
(In reply to comment #0)
> Bug #412180 makes clear that not all consumers/users of OSGi EventAdmin
> follow the OSGi EventAdmin spec guideline and only send primitives as event
> data. Thus, for event data not implementing serializable, we should use
> "SmartSerialization" (see
> http://git.eclipse.org/c/ecf/org.eclipse.ecf.git/tree/protocols/bundles/ch.
> ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/util/
> SmartObjectOutputStream.java).
> 
> (Also see bug #385740)

Although I don't particularly mind the idea of using the 'Smart Serialization' to enhance regular 'ol object serialization...this doesn't in general solve the problem...as even the r_osgi smart serialization can/will fail in what could be considered 'common' use cases by some.

I expect that...similar to remote service params and return values...that each remote eventadmin provider will have to constrain what can/cannot be serialized.
Comment 2 Markus Kuppe CLA 2013-07-04 02:14:07 EDT
(In reply to comment #1)
> Although I don't particularly mind the idea of using the 'Smart
> Serialization' to enhance regular 'ol object serialization...this doesn't in
> general solve the problem...as even the r_osgi smart serialization can/will
> fail in what could be considered 'common' use cases by some.
> 
> I expect that...similar to remote service params and return values...that
> each remote eventadmin provider will have to constrain what can/cannot be
> serialized.

I totally agree that SmartSerialization won't be a silver bullet. Besides simply failing in some use-cases, it will probably severely degrade performance in others where the application logic sends massive amounts of data via the event bus.

Thus, this enhancement should allow to turn SmartSerialization completely off (via a system property).
Comment 3 Markus Kuppe CLA 2013-07-04 03:04:02 EDT
Also see bug #412261 ([Distributed EventAdmin] Allow to only log serialization failures)
Comment 4 Markus Kuppe CLA 2013-07-05 06:58:59 EDT
Fix with commit 5c3c256bf85388a923d3a556497f2162224ae6b2 [1] in master.

[1] http://git.eclipse.org/c/ecf/org.eclipse.ecf.git/commit/?id=5c3c256bf85388a923d3a556497f2162224ae6b2
Comment 5 Markus Kuppe CLA 2013-07-05 06:59:03 EDT
Created attachment 233123 [details]
mylyn/context/zip
Comment 6 Markus Kuppe CLA 2013-07-05 07:04:20 EDT
The fix adds an API to hook in custom serializers (see the eventadmin example). 

The default impl uses standard Java serialization and simply fails for non-serializable/externalizable objects (this is consistent behavior with the previous impl).

A more powerful serialization can either reuse r-OSGi "SmartSerialization" or e.g. use Kryo [1].

[1] http://code.google.com/p/kryo/
Comment 7 Markus Kuppe CLA 2013-09-21 03:22:01 EDT
(In reply to Markus Kuppe from comment #2)
> I totally agree that SmartSerialization won't be a silver bullet. Besides
> simply failing in some use-cases, it will probably severely degrade
> performance in others where the application logic sends massive amounts of
> data via the event bus.

James Sutherland blogged a performance comparison that includes Kryo [1].

[1] http://java-persistence-performance.blogspot.com/2013/08/optimizing-java-serialization-java-vs.html
Comment 8 Markus Kuppe CLA 2013-10-13 16:42:24 EDT
See bug #419327 WRT r-OSGi (slightly related)