Is this Possible ?

Hi ,

I have strange doubt.. Please clarify me ..

Let us say there are 2 Prgms.

1)Loading.java ( Servlet )

2)Monitor.java (Pure Java)

Loading.java :

==========

public class Loading extends HttpSerlvet

{

Monitor mon = null;

public void init(ServletConfig SC) throws ServletException

{

super.init(config);

mon = Monitor.get();

}

Monitor.java

==========

public class Monitor implements Runnable

{

private static Monitor mon = new Monitor();

private HashMap hm = new HasMap();

private Monitor()

{

// code to create some thread ...

}

public static Monitor get()

{

return mon;

}

}

What I understand is that only one HashMap instance is created for the entire servlet Life Cycle (ie.) If I call the servlet ( Loading.java ) continously there

will be only one HashMap instance .Is that right ?

If Yes then How do I get the same HashMap instance and its data from some other Program say (Unloading.java) ( can be a servlet or just a Pure java Code ).

Please let me know if this is Possible ?

Thanks in advance

[1229 byte] By [iwishtolearn] at [2007-9-26 3:06:48]
# 1
This article should be able to answer your question: http://developer.java.sun.com/developer/technicalArticles/Programming/singletons/
andy.g at 2007-6-29 11:09:57 > top of Java-index,Core,Core APIs...