java - how to serialize multi-threaded program -


i have many threads performing different operations on object , when 50% of task finished want serialize everything(might want shut down machine ).

when come want start point had left. how can achieve?

this saving state of objects of game while playing. save state of object , retrieve back. here storing process's count/state.

for example:

i having thread creating salary excel sheet 50 thousand employee.

other thread creating appraisal letters same 50 thousand employee.

another thread writing "happy new year" e-mail 50 thousand employee.

so imagine multiple operations.

now want shut down in between 50% of task finishes. 25-30 thousand employee salary excel-sheet have been written , appraisal letters done 25-30 thousand , on. when come next day want start process had left.

this resume.

i'm not sure if might help, can achieve if threads communicate via in-memory queues.

to serialize whole application, need disable consumption of queues, , when threads idle you'll reach "safe-point" can serialize whole state. you'll need keep track of threads spawn, know if in idle.

you might able technology (maybe java agent?) freezes jvm , allows dump whole state, don't know if exists.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -