User: jules_gosnell Date: 02/01/13 13:30:14 Modified: jetty/src/main/org/jboss/jetty/util AbstractTimeOutManager.java NaiveTimeOutManager.java Log: a fixed watchdog ear will now deploy/undeploy happily and tests can be run: [java] [gtest] *** 333 TEST(S) PASSED! *** [java] [gtest] *** 9 TEST(S) FAILED! *** Revision Changes Path 1.2 +9 -3 contrib/jetty/src/main/org/jboss/jetty/util/AbstractTimeOutManager.java Index: AbstractTimeOutManager.java =================================================================== RCS file: /cvsroot/jboss/contrib/jetty/src/main/org/jboss/jetty/util/AbstractTimeOutManager.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- AbstractTimeOutManager.java 2002/01/13 13:26:46 1.1 +++ AbstractTimeOutManager.java 2002/01/13 21:30:14 1.2 @@ -5,7 +5,7 @@ * See terms of license at gnu.org. */ -// $Id: AbstractTimeOutManager.java,v 1.1 2002/01/13 13:26:46 jules_gosnell Exp $ +// $Id: AbstractTimeOutManager.java,v 1.2 2002/01/13 21:30:14 jules_gosnell Exp $ //------------------------------------------------------------------------------ @@ -16,8 +16,8 @@ public interface AbstractTimeOutManager { - public void register(Object object, long now, long timeRemaining); - public void reregister(Object object, long now, long timeRemaining); + public void register(Object object, long now, long maxInactiveInterval); + public void reregister(Object object, long now, long maxInactiveInterval); public void deregister(Object object); public void start(); @@ -27,5 +27,11 @@ TimeOutNotifier { public void timeOut(Object object); + } + + public interface + TimeOutTester + { + public long timeRemaining(Object object, long now, long maxInactiveInterval); } } 1.2 +17 -16 contrib/jetty/src/main/org/jboss/jetty/util/NaiveTimeOutManager.java Index: NaiveTimeOutManager.java =================================================================== RCS file: /cvsroot/jboss/contrib/jetty/src/main/org/jboss/jetty/util/NaiveTimeOutManager.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- NaiveTimeOutManager.java 2002/01/13 13:26:46 1.1 +++ NaiveTimeOutManager.java 2002/01/13 21:30:14 1.2 @@ -5,7 +5,7 @@ * See terms of license at gnu.org. */ -// $Id: NaiveTimeOutManager.java,v 1.1 2002/01/13 13:26:46 jules_gosnell Exp $ +// $Id: NaiveTimeOutManager.java,v 1.2 2002/01/13 21:30:14 jules_gosnell Exp $ //------------------------------------------------------------------------------ @@ -27,32 +27,30 @@ final List _entries=new LinkedList(); final long _interval; final TimeOutNotifier _notifier; + final TimeOutTester _tester; public - NaiveTimeOutManager(long interval, TimeOutNotifier notifier) + NaiveTimeOutManager(long interval, TimeOutNotifier notifier, TimeOutTester tester) { _interval=interval; _notifier=notifier; + _tester=tester; } class Entry { - final long _timeRegistered; - final long _timeRemaining; final Object _object; - - Entry(long timeRegistered, long timeRemaining, Object object) + final long _maxInactiveInterval; + Entry(Object object, long maxInactiveInterval) { - _timeRegistered=timeRegistered; - _timeRemaining=timeRemaining; _object=object; + _maxInactiveInterval=maxInactiveInterval; } long getTimeRemaining(long now) { - long timeSinceRegistered=now-_timeRegistered; - return _timeRemaining-timeSinceRegistered; + return _tester.timeRemaining(_object, now, _maxInactiveInterval); } void @@ -63,12 +61,12 @@ } public synchronized void - register(Object object, long timeRegistered, long timeRemaining) + register(Object object, long timeRegistered, long maxInactiveInterval) { - if (timeRemaining<0) + if (maxInactiveInterval<0) return; // never timeout - Entry entry=new Entry(timeRegistered, timeRemaining, object); + Entry entry=new Entry(object, maxInactiveInterval); synchronized (_entries) { _entries.add(entry); @@ -76,11 +74,11 @@ } public synchronized void - reregister(Object object, long timeRegistered, long timeRemaining) + reregister(Object object, long timeRegistered, long maxInactiveInterval) { // could be optimised - but this is simpler for the moment... deregister(object); - register(object, timeRegistered, timeRemaining); + register(object, timeRegistered, maxInactiveInterval); } public synchronized void @@ -145,6 +143,8 @@ long now=System.currentTimeMillis(); + // System.err.println("Sweeping..."); + Iterator i=copy.iterator(); while (i.hasNext()) { @@ -162,5 +162,6 @@ } } } - } + //System.err.println("Sweeping...done"); + } }
_______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development