https://issues.apache.org/bugzilla/show_bug.cgi?id=50991
Konstantin Kolinko <knst.koli...@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED | --- Comment #4 from Konstantin Kolinko <knst.koli...@gmail.com> 2011-03-30 19:21:20 EDT --- Regarding r1086950 two comments: 1. The following is printed in the logs now: 31.03.2011 0:01:57 org.apache.catalina.users.MemoryUserDatabase save SEVERE: User database has been configured to be read only. Changes cannot be saved That is because MemoryUserDatabase#close() method does exist and calls save() unconditionally. 2. In NamingResources#cleanUp(): > resource = ctxt.lookup(name); If it is the first lookup for a ContextResource, or this resource is not a "singleton", this will create an instance of it. -> see (1) below For "javax.sql.DataSource" resources it does not happen, because a lookup() is called elsewhere just after binding them, to register them with JMX -> see (2) but for any others this might be a slight concern. Unrelated note, looking at (2): registering DataSource with JMX makes sense only if it is a singleton. Otherwise we would not be managing the actual object. It is good that it is singleton by default. It would be nice to perform cleanup only for the resources that have been already created (entry.type == NamingEntry.ENTRY), but I do not see how that can be implemented. The NamingEntry class is something internal to org.apache.naming. My proposal is the following: 1. Assume the default value of "close" only for the resources of type "javax.sql.DataSource". That is, for any other resource types assume that the value is unset by default and do not perform lookup of the resource. 2. Regarding (2): add a comment to the singleton attribute that singleton=true is necessary for JMX management of connection pools. 3. Do not call save() in MemoryUserDatabase.close() if it is readonly. ------------------------------------------------ (1): In the sources: ContextResource is represented by ResourceRef object (in NamingContextListener#addResource(ContextResource)) ResourceRef is represented by NamingEntry.REFERENCE (in NamingContext#bind(Name, Object, boolean) NamingContext.bind() creates Lookup is implemented in NamingContext.lookup(Name, boolean) and (entry.type == NamingEntry.REFERENCE) branch is called. ------------------------------------------------ (2): In the sources: In NamingContextListener#addResource(ContextResource): if ("javax.sql.DataSource".equals(ref.getClassName())) { -> lookup ------------------------------------------------ -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org