Re: can java tell which environment it is running in?

luca <[email protected]> Wed, 19 Jan 2005 19:54:41 +0100
Newsgroups gmane.comp.java.advanced-servlets
Message-ID <[email protected]>


Nic Ferrier wrote:

> 
> Stack Traces would be the only way unless you provide some application
> logic for it.

not sure what you mean here.

> For example, use a Java property or a singleton to establish what the
> current environment is.

it is very interesting that you say this, because the problem that
I am trying to work around is about singletones.
I have one holy singleton that I would like to see alive
throughtout the life of my web application, but it gets
garbage collected anyway :(

Luca

PS: here is the code in case someone wonders

public class ObjectsManager {

      private static Object lock = new Object();
      private static Wurfl wurflInstance = null;
      private static CapabilityMatrix capabilityMatrixInstance = null;
      private static UAManager UAManagerInstance = null;
      private static ListManager ListManagerInstance = null;


      public static Wurfl getWurflInstance(String parameter, String patch) {
	synchronized (lock) {
	    if (wurflInstance==null)
              	wurflInstance = new Wurfl (parameter,patch);
	    return wurflInstance;
	}
      }

   :

}



Before posting a question, try to find your answer here: 
<http://www.egroups.com/links/advanced-servlets>
Announcements should go to: [email protected]
To Post a message, send it to: [email protected]
To Unsubscribe, send a blank message to: [email protected] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/advanced-servlets/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/