properly creating and cleaning up application contexts

Tony Sintes <[email protected]>
Newsgroups gmane.comp.java.sisc.user
Message-ID <[email protected]>
I have embedded SISC into my application as a command
layer. Any number of clients may interact with the
application simultaneously using a remote REPL like
interface. So that the clients don’t walk over each
other I create a unique application context for each
client.

URL heapfile = new URL(System.getProperty(HEAP));
SeekableInputStream heap =
AppContext.openHeap(heapfile);
AppContext appContext = new AppContext();
appContext.addHeap(heap);

I then route all client requests back to the
appropriate application context and retrieve an
interpreter to serve the request:

Interpreter r = Context.enter(appContext);

First, I wonder if there’s a better way to do what I
am doing. To me it seems wasteful to read in the heap
for each client. An older sisc-users message mentioned
AssociativeEnvironments but it seems out of date. I’d
imagine that there’s a way to load the heap into a top
level environment and then to set that environment as
the client’s parent environment. Unfortunately, I’m
not sure how to implement this idea.

Second, I need a way to completely remove the client’s
context from memory when the client is done with it.
Currently I remove the application context from my
session map but the memory never gets freed up. Given
that I have removed the only reference to the
application context that I keep what do I need to do
to get SISC to release all of its references so that
the VM can reclaim the memory? Left unchecked this
memory growth will become a problem.

Regards,

Tony Sintes

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.