Java Application Object ... where is it stored?

I am thinking of using a Java application object to implement a simple cache, to store a few config variables and a few xml with frequently used information ...

I would like to know where the application data is physically stored (system file, in memory, db), how it can be configured, and if there is some kind of limitation like space, concurrency, etc ...

Also, any other scalability issue (both in size and concurrency) would be appreciated ...

And if anyone can point me somewhere to find more information, I would be very happy ...

Many thanks

0


a source to share


1 answer


Objects are stored on the heap. Heap splitting can be controlled through the virtual machine configuration file.

Constructor calls are more complex than regular subroutines or function calls. This is useful for understanding the exact steps a computer goes through to make a constructor call:

  • First, the computer receives a block of unused memory on the heap, large enough to hold an object of the specified type.
  • It initializes the object instance variables. If the declaration of an instance variable specifies an initial value, then the value is calculated and stored in the instance variable. Otherwise, the initial default is used.
  • The actual parameters in the constructor, if any, are evaluated and values ​​are assigned to the formal parameters of the constructor.
  • The instructions in the constructor body are executed, if any.
  • An object reference is returned as the value of the constructor call.

The end result of this is that you are referring to the newly constructed object. You can use this reference to an instance of variables in this object or to call its instance methods.

http://www.faqs.org/docs/javap/c5/s2.html



Following are some VM configuration options

http://www.caucho.com/resin-3.0/performance/jvm-tuning.xtp

I once wrote a cache for xml objects (call them something). It is enough to match a map with a string key (file name) and an object reference (parsed XML file). In addition to this, the cache was single (synchronized). Ditto for JasperReports compiled caching (I got a noticeable speed error here because reports that are no longer compiled every time)

+3


a source







All Articles