Posted By:
Chris_Adams
Posted On:
Sunday, July 22, 2001 02:07 PM
In my design I have several sets of classes, many of which are controllers, and HAVE NO State. For example I have a class, cFileImpl that contains a method getUserFiles(). That method calls two methods on another controller class, cFileManagerImpl, who calls methods on yet another controller class, cFileSystem that actually interfaces to the data source. A main entity class, eUser, is instantiated from the start as its handle is passed downstream through these controllers so to be updated by the last object call. Each of these controller classes exist in a separately managed packages and instantiate the downstream object with new() before calling their required method. So in the case of getUserFiles() I may instantiate 6 objects, just to fill
More>>
In my design I have several sets of classes, many of which are controllers, and HAVE NO State. For example I have a class, cFileImpl that contains a method getUserFiles(). That method calls two methods on another controller class, cFileManagerImpl, who calls methods on yet another controller class, cFileSystem that actually interfaces to the data source. A main entity class, eUser, is instantiated from the start as its handle is passed downstream through these controllers so to be updated by the last object call.
Each of these controller classes exist in a separately managed packages and instantiate the downstream object with new() before calling their required method. So in the case of getUserFiles() I may instantiate 6 objects, just to fill eUser's file attributes. If 500 users login and make the same call, I could have 3000 objects performing the same thing! Ow.
Worse is there are many other controller classes that perform the same types of operations for groups, users, folders, etc. and the number of controllers are still growing. So I need to find some type of mechanism to manage all this memory as it seems the GC will be constantly busy.
What I'm considering:
1.) Object Pools - I like this idea, but it seems overwhelming to create this structure for every controller class.
2.) Turning all the controllers in Abstract classes with Static synchonized methods, but as I read more about this, I'm getting nervous about the cost of static and deadlock with synchronized.
3.) Just buying a 4GB RAM sever and let it go!!! - not the boss' perferred solution.
<<Less