tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Caldarale, Charles R" <Chuck.Caldar...@unisys.com>
Subject RE: Application state in ServletContext
Date Mon, 29 Oct 2007 12:45:24 GMT
> From: lightbulb432 [mailto:veerukrishnan@hotmail.com] 
> Subject: Application state in ServletContext
> 
> The code cannot directly touch the ServletContext class,
> but may do so through an interface (shown below).
> 
> public class ApplicationState {
>   private static Map<String,Object> stateValues;
>   public static Object getStateValue(String key) {
>     return stateValues.get(key);
>     // return servletContext.getAttribute(key);
>   }
> }

The above is not an 'interface' - it's a real class with a real
implementation.  Also, contrary to your preceding statement, it does not
access the ServletContext, since that line is commented out.  Due to the
inconsistencies in your message, I don't think your questions can be
answered.

You should be concerned about synchronization, since Map (which actually
is an interface) is not synchronized, although certain implementations
of it are (e.g., Hashtable).

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message