Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Marker interface Serializable

 
Chetan Sahasrabudhe
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As per api documentation Serializable is a marker interface.
When I check for the methods, it does not have any. but the documentation says --->

Classes that require special handling during the serialization and deserialization process must implement special methods with these exact signatures:


private void writeObject(java.io.ObjectOutputStream out)
throws IOException
private void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException;

<------

How does JVM maintains this contract between the implementing class and the interface ? This concept seems to be out of place from standard interface class and implementation separation concept.

How does JVM implements this concept.

Please help me understand this goofy concepts in Java.

Regards
Chetan
 
M Murthy
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I looked at the spec and referring to page 395, what i understand is that the "implementation" classes of the Handle and HomeHandle interface must provide those methods.
The writeObject/readObject methods of Handle/HomeHandle interface implementation class must call the HandleDelegate methods to perform serialization/deserialization of the handles.
Also,


javax.ejb.spi.HandleDelegate service provider interface is not used by
enterprise beans or J2EE application components directly.


Since these methods are in the implementation class and not used by the enterprise beans or applications directly, they have not been shown in the interface.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic