forked from I2P_Developers/i2p.i2p
* Shutdown:
- More job queue cleanups - RouterInfo readin job checks for quick shutdown - Note that we should improve profile read job
This commit is contained in:
@ -280,14 +280,22 @@ public class JobQueue {
|
||||
|
||||
void shutdown() {
|
||||
_alive = false;
|
||||
_timedJobs.clear();
|
||||
_readyJobs.clear();
|
||||
synchronized (_jobLock) {
|
||||
_timedJobs.clear();
|
||||
_readyJobs.clear();
|
||||
_jobLock.notifyAll();
|
||||
}
|
||||
// The JobQueueRunners are NOT daemons,
|
||||
// so they must be stopped.
|
||||
Job poison = new PoisonJob();
|
||||
for (int i = 0; i < _queueRunners.size(); i++)
|
||||
for (JobQueueRunner runner : _queueRunners.values()) {
|
||||
runner.stopRunning();
|
||||
_readyJobs.offer(poison);
|
||||
|
||||
// TODO interrupt thread for each runner
|
||||
}
|
||||
_queueRunners.clear();
|
||||
_jobStats.clear();
|
||||
_runnerId = 0;
|
||||
|
||||
/********
|
||||
if (_log.shouldLog(Log.WARN)) {
|
||||
|
@ -359,6 +359,9 @@ class PersistentDataStore extends TransientDataStore {
|
||||
if (routerInfoFiles.length > 5)
|
||||
_alreadyWarned = false;
|
||||
for (int i = 0; i < routerInfoFiles.length; i++) {
|
||||
// drop out if the router gets killed right after startup
|
||||
if (!_context.router().isAlive())
|
||||
break;
|
||||
Hash key = getRouterInfoHash(routerInfoFiles[i].getName());
|
||||
if ( (key != null) && (!isKnown(key)) ) {
|
||||
// Run it inline so we don't clog up the job queue, esp. at startup
|
||||
|
@ -117,6 +117,7 @@ class PeerManager {
|
||||
}
|
||||
|
||||
void loadProfiles() {
|
||||
// TODO do this in a Thread or a Job to not slow down the constructor
|
||||
Set<PeerProfile> profiles = _persistenceHelper.readProfiles();
|
||||
for (Iterator<PeerProfile> iter = profiles.iterator(); iter.hasNext();) {
|
||||
PeerProfile prof = iter.next();
|
||||
|
Reference in New Issue
Block a user