DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=35746>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=35746 Summary: session manager should be immune to system clock time changes (solution provided) Product: Tomcat 5 Version: 5.0.30 Platform: Other OS/Version: other Status: NEW Severity: normal Priority: P2 Component: Catalina AssignedTo: tomcat-dev@jakarta.apache.org ReportedBy: [EMAIL PROTECTED] Hi, The session manager should be able to age session by age, not by comparison to system time stamp. Here is a simple and working time tracker immune to time shifts. It 'knows' it waited some amount of milliseconds. This cannot be hacked on any OS. Given that, the time arrow is maintained and session can be aged normally, even if system time changes on the server, which is more than probable on appliances and embed system. That would prevent http session to expire and logout user prematurely. Note that upon the receiver update, 't2' is always the current time (now) and 't1' is usually the last 't2' is no shift was detected. public void run() { long t1 = -1; while(true) { try { long t2 = System.currentTimeMillis(); //------ time shifting detection -------- long shift = 0; if(t1>0) { //if not first loop long expected = t1+intervalMillis; shift = t2-expected; if(shift > timePositiveShiftTolerance) { vlogger.warn("Time shifted in future by more than positive tolerance: shift="+shift+" ms, tolerance="+timePositiveShiftTolerance); //fireTimeDriftEvent(expected, drift); t1 = t2-intervalMillis; } else if(shift < timeNegativeShiftTolerance) { vlogger.warn("Time shifted in past by more than negative tolerance: shift="+shift+" ms, tolerance="+timeNegativeShiftTolerance); //fireTimeDriftEvent(expected, drift); t1 = t2-intervalMillis; } else { shift = 0; } } /////////////// //someReceiver.update(t1, t2, shift); /////////////// t1 = t2; Thread.sleep(intervalMillis); } catch(IllegalArgumentException e) { vlogger.warn("",e); //no break. } catch(InterruptedException e) { break; } catch(Exception e) { vlogger.error("",e); } } } -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]