File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Performance and the fly likes random access indexed file for java objects' serialization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "random access indexed file for java objects Watch "random access indexed file for java objects New topic

random access indexed file for java objects' serialization

Sudipta Dey

Joined: Aug 09, 2005
Posts: 1
I am implementing a stategy for managing java object in memory thru swapping between memory & disk. I have throught of persistence mechanism for each object using java's object serialization. These objects are stored in an object array. This strategy works fine for small number of objects and give good results.
But in real scenario (the software tool where i am going use this strategy), there can be object count ranging from 50k to 500k. So serializing a each object to a file does not work for me, as the number of files in the disk will be a number where it becomes unmanagable by the OS or JVM.
So I am planning to write all the objects to a indexed file. I will access the Objects randomly from that file whenever needed. These objects differ in sizes and object size can increase or decrease during the run.

Can I get some suggestions how can I implement such kind of thing???

Thanks & Regards,

Thanks & Regards,<br />Sudipta Dey
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
First I'd wonder wether someone already implemented such an algorithm.

I'd also probably consider using a lightweight OO database.

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
You certainly would not be able to re-write a modified object to the same place in the random access file. A google search for "java object database" found lots of hits.
I agree. Here's the link:
subject: random access indexed file for java objects' serialization
It's not a secret anymore!