Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8409213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:50:39+00:00 2026-06-09T23:50:39+00:00

I need to serialize a Java Process (to persistent storage such as a disk)

  • 0

I need to serialize a Java Process (to persistent storage such as a disk) followed by killing it.

Then at a later time De-serialize it and re-resurrect it at a later date.

Constraints:

  1. I already have a set of process that I want to add this feature to.
  2. I am therefore looking for a solution that is minimally invasive.
  3. The processes have code that will re-establish connections to resources such as sockets, DBs etc.
  4. What I need to do is persist the thread statuses, variables, objects, etc.

NOTE:

  1. I have decent knowledge of the issues surrounding the serializing of an Object Graph.
  2. Many years ago I’d conceptually figured out how to do this using AspectJ but I can’t find my notes
  3. This question pertains to Java Process only — so the solution would work on say a JVM running on OSX, Linux, or Windows
  4. The process in question would be refactor-able to achieve this functionality.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T23:50:42+00:00Added an answer on June 9, 2026 at 11:50 pm

    Classes like Thread, Socket and other java.io classes do not implement Serializable for a purpose. Having said that, the best thing I can recommend to you as a refactoring hint is to make your applications provide a clean way of saving and restoring state when triggered. As you cannot recreate the state of threads or network connections as such, depending on the problem domain you might be able to write your classes in a way which makes them transaction-safe plus you can record running transactions on shutdown and make sure that they are rescheduled/restarted after wake-up/deserialisation.

    (Disclaimer: Even after you have edited your question it is so unspecific that I can only offer an educated guess and general hints in the following.)

    First and foremost you are dealing with a design question here. AOP will probably be helpful in implementing this concern (it is clearly cross-cutting) after you have solved your design issues. E.g. you could have an aspect add an interface like Interruptable to the classes in question and connect it to functionality implementing the desired behaviour, e.g. ObjectState interrupt() and void continue(ObjectState) (all class, interface and method names are pure invention). So while you will not be able to freeze your applications in the rather magic way you seem to describe, with some hard work you might be able to save the application state in a way which at least helps you re-start it in a way which restores logical state (not technical one like socket connections, thread IDs) so the application can continue with whatever it has been doing before you froze it.

    E.g. a download manager can continue downloading a file because it has previously recorded its logical state: download source, temporary file name and number of bytes already written. So even though a new network connection needs to be established to continue the download, the “transaction” does not need to restart from scratch. I assume that is what you want.

    Writing down this monologue, it seems to me that part of the functionality I was describeing should probably exist in existing application servers or containers (I am not an expert there).

    So when you have finally worked out a way for all relevant application classes to persist their logical state, come back and ask another question about how to best do what you want using AspectJ or so. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to serialize a java object which might change later on, like some
I have a simple Java class that I need to serialize to be stored
I need to serialize ArrayList<String> arr=new ArrayList<String>(); on server and then send this array
I need to serialize a java Float to be read by an application written
I need to serialize an XML java object to a XML file using the
I need to serialize a list of GeoPoints then read them back in. I
I need to serialize a .NET DateTime value in a protocol buffers message. My
I need to serialize a Lucene.net Document instance. When I try the following public
I have a business class which I need to serialize to xml. It has
I have a DOM Document created from scratch and I need to serialize it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.