https://bz.apache.org/bugzilla/show_bug.cgi?id=58590
Bug ID: 58590 Summary: org.apache.catalina.realm.MemoryRealm can use backgroundProcess() to reload tomcat-users.xml when it changes Product: Tomcat 9 Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P2 Component: Catalina Assignee: dev@tomcat.apache.org Reporter: apa...@leocap.com Based on a derived class that I created and tested successfully with Tomcat 8, I suggest the following lines be added to MemoryRealm in order to give it this capability: private Date _lastUpdate = null; private File _usersFile = null; public MemoryRealm() { _lastUpdate = new Date(); _usersFile = new File( getPathname() ); } /** * The default 10 second value for the Engine's backgroundProcessorDelay XML attribute * will cause this method to be called that often. */ @Override public void backgroundProcess() { try { // only reload if file has changed since we last loaded it if( _lastUpdate.getTime() < _usersFile.lastModified() ) { _lastUpdate = new Date(); log.info( "reloading " + getPathname() ); stop(); principals.clear(); start(); // trigger a repopulation (from tomcat-users.xml) } } catch( Exception ex ) { log.error( "Failed to re-initialise realm: ", ex ); } } -- 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