• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Does deserializing an object in another JVM call the static initializer?

 
Ranch Hand
Posts: 226
Eclipse IDE Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everybody,

Does deserializing an object in another JVM call the static initializer?
It does not within the same JVM as the class is already loaded while serializing it, however what about in another jvm? Would the static initializer get called?

Thanks in advance.

 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Objects don't have static initializers. Classes have static initializers. And those static initializers are called when the class is loaded.

And there's no reason why a JVM, when deciding whether to load a class, would pay any attention to any other JVMs which happen to be running elsewhere. If it needs the class then it's going to load the class.

As you can see this has very little to do with serialization of objects.
reply
    Bookmark Topic Watch Topic
  • New Topic