This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Java in General and the fly likes Is it ok to create large numbers of javabeans and objects? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Is it ok to create large numbers of javabeans and objects?" Watch "Is it ok to create large numbers of javabeans and objects?" New topic
Author

Is it ok to create large numbers of javabeans and objects?

Simon Harvey
Ranch Hand

Joined: Jan 26, 2003
Posts: 79
Hi everyone,
I am just wondering about how javabeans (and objects I really) are typically used. Lets say, as a hypothetical scenario I have a computer program that deals with lots of logged in users. Would it be appropriate to hold loads of user javabean objects in some form of collection?
Basically what I am wondering is whether you are supposed to use classes and javabeans to create large numbers of objects held in memory. How many simple objects can a modern computer handle easily.
I'm just wondeirng if there is a different model. Maybe you're not really supposed to use a bugger load of objects or java beans. But then how else do you store representations in memory?
A big ol fankoo to anyone who cares to share any advice.
Kindest Regards
Simon Harvey
Pavel Halas
Ranch Hand

Joined: Jul 05, 2003
Posts: 35
At first. Everything is Object in Java.
Collections are used to store data in memory. But if you have LOTS of users to be logged, there are two cases:
  • users aren't online at the same time
    So there's no need for storing all of them in memory (in the collection). Use disk space.
  • lots of users are online at the same time
    They want to work. If they could not work, they would not be there. So if the system is ready for serving so many users, it will be ready for logging them. Use super hardware, eventualy (surely) some kind of extra optimalization.

  • [ July 13, 2003: Message edited by: Marilyn de Queiroz ]
    Simon Harvey
    Ranch Hand

    Joined: Jan 26, 2003
    Posts: 79
    Thank you Pavel.
    I'm going to take it from your answer that I shouldnt worry to much about making javabeans and storing them (although of course I wouldnt store something in RAM unless I needed to)
    If thats ok then thanks for your answer, if not then perhaps someone could post back quickly.
    Many thanks pavel
    Simon
    Stan James
    (instanceof Sidekick)
    Ranch Hand

    Joined: Jan 29, 2003
    Posts: 8791
    I work with a Java client application that caches gobs of data to avoid time-consuming trips to the server. I'm sure we cache thousands of objects. You just have to keep an eye on your memory usage and make sure you can share the computer with whatever else is going on at the same time.


    A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
     
    GeeCON Prague 2014
     
    subject: Is it ok to create large numbers of javabeans and objects?