[plt-scheme] share variable in servlet programs

From: Chongkai Zhu (u0476504 at utah.edu)
Date: Tue Jan 3 17:11:03 EST 2006

Hello Jay McCarthy,

Previous discussion about this problem is at:

http://list.cs.brown.edu/pipermail/plt-scheme/2005-January/007625.html
http://list.cs.brown.edu/pipermail/plt-scheme/2005-January/007626.html
http://list.cs.brown.edu/pipermail/plt-scheme/2005-January/007627.html

For my case, now I only need to share variables between different servlet 
instances. I know that just define the variables in the servlet.ss
file works. But I also need to do some thing on the global-variable 
(such as disconnect to the db) when I shut down the web-server. In v20x, 
I solve this problem by the method in I suggested in 
http://list.cs.brown.edu/pipermail/plt-scheme/2005-January/007627.html.
Now I shift from v20x to v30x, and find that my old solution breaks.
If I define the shared variables in servlet.ss file, I don't know
where to insert code to de-initiate the shared variables when 
shutting down (or refresh) the web-server. 

Besides, I think that sharing between different servlets will also be
interested. Would PLT provide an official method to share variable
between servlets?

Thanks.

Sincerely,
Chongkai Zhu  

======= At 2006-01-02, 21:11:34 Jay McCarthy wrote: =======

>Can you send the proposed code?
>
>In what way do you mean to 'share'? Between different servlets (i.e.
>servlet1.ss and servlet2.ss) or different servlet instances?
>
>In v20x, there was a bug where each servlet did not have a separate
>module namespace and conf/refresh-servlets did not properly reload
>module servlets. I have a feeling that what you're experience may be
>related.
>
>Jay
>
>On 1/2/06, Chongkai Zhu <u0476504 at utah.edu> wrote:
>> Hello plt-scheme,
>>
>> In PLT v20x, sharing variable in servlet programs is easy:
>> I just write a program that defines all the shared variables,
>> and call serve in that program to start the server, then
>> all variables defined in that program become available
>> in all servlets.
>>
>> But when I try the same program in v300, this trick can't
>> work. Could anyone suggest a way to share variables in
>> v300 of servlets? Many thanks.
>>
>> Sincerely,
>> Chongkai Zhu
>>
>
>--
>Jay McCarthy <jay at cs.brown.edu>
>http://jay.makeoutcity.com/



Posted on the users mailing list.