* JobQueue:

- Add warning to setStartAfter() as queue is no longer
      continuously sorted
    - Fix StartExplorerJob not calling requeue()
    - More pumper cleanups
This commit is contained in:
zzz
2011-09-16 14:47:40 +00:00
parent 217cb1f66d
commit a7f8560acf
5 changed files with 26 additions and 20 deletions

View File

@@ -1,3 +1,19 @@
2011-09-16 zzz
* Console: Home page flag spacing
* EepGet: Add some new command line options
* JobQueue:
- Add warning to setStartAfter() as queue is no longer
continuously sorted
- Fix StartExplorerJob not calling requeue()
- More pumper cleanups
* Reseed:
- Add HTTP proxy authorization support
- Stub out SSL proxy support
- Disable i2pbote reseed
* Router: Fix router changing client-side tunnel options,
causing original tunnel quantity to not be restored
(ticket #513)
2011-09-14 zzz
* Console: Verify valid host/IP before saving on net config form
* i2psnark:

View File

@@ -459,7 +459,6 @@ public class JobQueue {
while (_alive) {
long now = _context.clock().now();
long timeToWait = -1;
List<Job> toAdd = null;
try {
synchronized (_jobLock) {
for (Iterator<Job> iter = _timedJobs.iterator(); iter.hasNext(); ) {
@@ -470,8 +469,7 @@ public class JobQueue {
if (j instanceof JobImpl)
((JobImpl)j).madeReady();
if (toAdd == null) toAdd = new ArrayList(4);
toAdd.add(j);
_readyJobs.offer(j);
iter.remove();
} else {
//if ( (timeToWait <= 0) || (timeLeft < timeToWait) )
@@ -486,21 +484,8 @@ public class JobQueue {
break;
}
}
if (toAdd != null) {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Not waiting - we have " + toAdd.size() + " newly ready jobs");
// rather than addAll, which allocs a byte array rv before adding,
// we iterate, since toAdd is usually going to only be 1 or 2 entries
// and since readyJobs will often have the space, we can avoid the
// extra alloc. (no, i'm not just being insane - i'm updating this based
// on some profiling data ;)
for (int i = 0; i < toAdd.size(); i++)
_readyJobs.offer(toAdd.get(i));
_jobLock.notifyAll();
} else {
if (timeToWait < 0)
timeToWait = 30*1000;
timeToWait = 1000;
else if (timeToWait < 10)
timeToWait = 10;
else if (timeToWait > 10*1000)
@@ -508,7 +493,6 @@ public class JobQueue {
//if (_log.shouldLog(Log.DEBUG))
// _log.debug("Waiting " + timeToWait + " before rechecking the timed queue");
_jobLock.wait(timeToWait);
}
} // synchronize (_jobLock)
} catch (InterruptedException ie) {}
} // while (_alive)
@@ -631,6 +615,7 @@ public class JobQueue {
private static class JobComparator implements Comparator<Job> {
public int compare(Job l, Job r) {
// equals first, Jobs generally don't override so this should be fast
// And this MUST be first so we can remove a job even if its timing has changed.
if (l.equals(r))
return 0;
// This is for _timedJobs, which always have a JobTiming.

View File

@@ -31,6 +31,11 @@ public class JobTiming implements Clock.ClockUpdateListener {
*
*/
public long getStartAfter() { return _start; }
/**
* WARNING - this does not force a resort of the job queue any more...
* ALWAYS call JobImpl.requeue() instead if job is already queued.
*/
public void setStartAfter(long startTime) {
_start = startTime;
// sure, this current job object may not already be on the queue, so

View File

@@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 18;
public final static long BUILD = 19;
/** for example "-test" */
public final static String EXTRA = "";

View File

@@ -80,7 +80,7 @@ class StartExplorersJob extends JobImpl {
long delay = getNextRunDelay();
if (_log.shouldLog(Log.DEBUG))
_log.debug("Updating exploration schedule with a delay of " + delay);
getTiming().setStartAfter(getContext().clock().now() + delay);
requeue(delay);
}
/**