forked from I2P_Developers/i2p.i2p
simple cleanups and final
This commit is contained in:
@@ -59,7 +59,7 @@ import net.i2p.util.Log;
|
||||
*
|
||||
*/
|
||||
public class Blocklist {
|
||||
private Log _log;
|
||||
private final Log _log;
|
||||
private RouterContext _context;
|
||||
private long _blocklist[];
|
||||
private int _blocklistSize;
|
||||
@@ -72,15 +72,11 @@ public class Blocklist {
|
||||
public Blocklist(RouterContext context) {
|
||||
_context = context;
|
||||
_log = context.logManager().getLog(Blocklist.class);
|
||||
_blocklist = null;
|
||||
_blocklistSize = 0;
|
||||
_wrapSave = null;
|
||||
}
|
||||
|
||||
/** only for testing with main() */
|
||||
public Blocklist() {
|
||||
_log = new Log(Blocklist.class);
|
||||
_blocklist = null;
|
||||
_blocklistSize = 0;
|
||||
}
|
||||
|
||||
static final String PROP_BLOCKLIST_ENABLED = "router.blocklist.enable";
|
||||
|
||||
@@ -30,15 +30,17 @@ import net.i2p.util.Log;
|
||||
*
|
||||
*/
|
||||
public class InNetMessagePool implements Service {
|
||||
private Log _log;
|
||||
private RouterContext _context;
|
||||
private HandlerJobBuilder _handlerJobBuilders[];
|
||||
private final Log _log;
|
||||
private final RouterContext _context;
|
||||
private final HandlerJobBuilder _handlerJobBuilders[];
|
||||
|
||||
/** following 5 unused unless DISPATCH_DIRECT == false */
|
||||
private final List _pendingDataMessages;
|
||||
private final List _pendingDataMessagesFrom;
|
||||
private final List _pendingGatewayMessages;
|
||||
private SharedShortCircuitDataJob _shortCircuitDataJob;
|
||||
private SharedShortCircuitGatewayJob _shortCircuitGatewayJob;
|
||||
|
||||
private boolean _alive;
|
||||
private boolean _dispatchThreaded;
|
||||
|
||||
|
||||
@@ -34,22 +34,22 @@ import net.i2p.util.Log;
|
||||
*
|
||||
*/
|
||||
public class JobQueue {
|
||||
private Log _log;
|
||||
private RouterContext _context;
|
||||
private final Log _log;
|
||||
private final RouterContext _context;
|
||||
|
||||
/** Integer (runnerId) to JobQueueRunner for created runners */
|
||||
private final Map<Integer, JobQueueRunner> _queueRunners;
|
||||
/** a counter to identify a job runner */
|
||||
private volatile static int _runnerId = 0;
|
||||
/** list of jobs that are ready to run ASAP */
|
||||
private BlockingQueue<Job> _readyJobs;
|
||||
private final BlockingQueue<Job> _readyJobs;
|
||||
/** list of jobs that are scheduled for running in the future */
|
||||
private List<Job> _timedJobs;
|
||||
private final List<Job> _timedJobs;
|
||||
/** job name to JobStat for that job */
|
||||
private final Map<String, JobStats> _jobStats;
|
||||
/** how many job queue runners can go concurrently */
|
||||
private int _maxRunners = 1;
|
||||
private QueuePumper _pumper;
|
||||
private final QueuePumper _pumper;
|
||||
/** will we allow the # job runners to grow beyond 1? */
|
||||
private boolean _allowParallelOperation;
|
||||
/** have we been killed or are we alive? */
|
||||
|
||||
@@ -4,10 +4,10 @@ import net.i2p.util.Log;
|
||||
|
||||
/** a do run run run a do run run */
|
||||
class JobQueueRunner implements Runnable {
|
||||
private Log _log;
|
||||
private RouterContext _context;
|
||||
private final Log _log;
|
||||
private final RouterContext _context;
|
||||
private boolean _keepRunning;
|
||||
private int _id;
|
||||
private final int _id;
|
||||
private long _numJobs;
|
||||
private Job _currentJob;
|
||||
private Job _lastJob;
|
||||
@@ -19,9 +19,6 @@ class JobQueueRunner implements Runnable {
|
||||
_context = context;
|
||||
_id = id;
|
||||
_keepRunning = true;
|
||||
_numJobs = 0;
|
||||
_currentJob = null;
|
||||
_lastJob = null;
|
||||
_log = _context.logManager().getLog(JobQueueRunner.class);
|
||||
_context.statManager().createRateStat("jobQueue.jobRun", "How long jobs take", "JobQueue", new long[] { 60*60*1000l, 24*60*60*1000l });
|
||||
_context.statManager().createRateStat("jobQueue.jobRunSlow", "How long jobs that take over a second take", "JobQueue", new long[] { 60*60*1000l, 24*60*60*1000l });
|
||||
|
||||
@@ -4,7 +4,7 @@ import net.i2p.data.DataHelper;
|
||||
|
||||
/** glorified struct to contain basic job stats */
|
||||
class JobStats {
|
||||
private String _job;
|
||||
private final String _job;
|
||||
private volatile long _numRuns;
|
||||
private volatile long _totalTime;
|
||||
private volatile long _maxTime;
|
||||
|
||||
@@ -18,7 +18,7 @@ public class JobTiming implements Clock.ClockUpdateListener {
|
||||
private long _start;
|
||||
private long _actualStart;
|
||||
private long _actualEnd;
|
||||
private RouterContext _context;
|
||||
private final RouterContext _context;
|
||||
|
||||
public JobTiming(RouterContext context) {
|
||||
_context = context;
|
||||
|
||||
@@ -12,9 +12,7 @@ import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import net.i2p.data.DataFormatException;
|
||||
@@ -37,14 +35,14 @@ import net.i2p.util.SecureFileOutputStream;
|
||||
*
|
||||
*/
|
||||
public class KeyManager {
|
||||
private Log _log;
|
||||
private RouterContext _context;
|
||||
private final Log _log;
|
||||
private final RouterContext _context;
|
||||
private PrivateKey _privateKey;
|
||||
private PublicKey _publicKey;
|
||||
private SigningPrivateKey _signingPrivateKey;
|
||||
private SigningPublicKey _signingPublicKey;
|
||||
private final Map<Hash, LeaseSetKeys> _leaseSetKeys; // Destination --> LeaseSetKeys
|
||||
private SynchronizeKeysJob _synchronizeJob;
|
||||
private final SynchronizeKeysJob _synchronizeJob;
|
||||
|
||||
public final static String PROP_KEYDIR = "router.keyBackupDir";
|
||||
public final static String DEFAULT_KEYDIR = "keyBackup";
|
||||
@@ -61,10 +59,6 @@ public class KeyManager {
|
||||
_context = context;
|
||||
_log = _context.logManager().getLog(KeyManager.class);
|
||||
_synchronizeJob = new SynchronizeKeysJob();
|
||||
setPrivateKey(null);
|
||||
setPublicKey(null);
|
||||
setSigningPrivateKey(null);
|
||||
setSigningPublicKey(null);
|
||||
_leaseSetKeys = new ConcurrentHashMap();
|
||||
}
|
||||
|
||||
@@ -132,12 +126,6 @@ public class KeyManager {
|
||||
return _leaseSetKeys.get(dest);
|
||||
}
|
||||
|
||||
public Set<LeaseSetKeys> getAllKeys() {
|
||||
HashSet keys = new HashSet();
|
||||
keys.addAll(_leaseSetKeys.values());
|
||||
return keys;
|
||||
}
|
||||
|
||||
private class SynchronizeKeysJob extends JobImpl {
|
||||
public SynchronizeKeysJob() {
|
||||
super(KeyManager.this._context);
|
||||
|
||||
@@ -13,14 +13,13 @@ import net.i2p.util.Log;
|
||||
*
|
||||
*/
|
||||
public class MessageValidator {
|
||||
private Log _log;
|
||||
private RouterContext _context;
|
||||
private final Log _log;
|
||||
private final RouterContext _context;
|
||||
private DecayingBloomFilter _filter;
|
||||
|
||||
|
||||
public MessageValidator(RouterContext context) {
|
||||
_log = context.logManager().getLog(MessageValidator.class);
|
||||
_filter = null;
|
||||
_context = context;
|
||||
context.statManager().createRateStat("router.duplicateMessageId", "Note that a duplicate messageId was received", "Router",
|
||||
new long[] { 10*60*1000l, 60*60*1000l, 3*60*60*1000l, 24*60*60*1000l });
|
||||
|
||||
@@ -12,12 +12,12 @@ import net.i2p.util.Log;
|
||||
*
|
||||
*/
|
||||
class RouterThrottleImpl implements RouterThrottle {
|
||||
private RouterContext _context;
|
||||
private Log _log;
|
||||
private final RouterContext _context;
|
||||
private final Log _log;
|
||||
private String _tunnelStatus;
|
||||
|
||||
/**
|
||||
* arbitrary hard limit of 10 seconds - if its taking this long to get
|
||||
* arbitrary hard limit - if it's taking this long to get
|
||||
* to a job, we're congested.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -12,8 +12,8 @@ import net.i2p.util.Log;
|
||||
*
|
||||
*/
|
||||
class RouterWatchdog implements Runnable {
|
||||
private Log _log;
|
||||
private RouterContext _context;
|
||||
private final Log _log;
|
||||
private final RouterContext _context;
|
||||
private int _consecutiveErrors;
|
||||
|
||||
private static final long MAX_JOB_RUN_LAG = 60*1000;
|
||||
|
||||
@@ -10,13 +10,13 @@ package net.i2p.router;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.data.Hash;
|
||||
@@ -31,9 +31,9 @@ import net.i2p.util.Log;
|
||||
* shitlist.
|
||||
*/
|
||||
public class Shitlist {
|
||||
private Log _log;
|
||||
private RouterContext _context;
|
||||
private Map<Hash, Entry> _entries;
|
||||
private final Log _log;
|
||||
private final RouterContext _context;
|
||||
private final Map<Hash, Entry> _entries;
|
||||
|
||||
public static class Entry {
|
||||
/** when it should expire, per the i2p clock */
|
||||
|
||||
Reference in New Issue
Block a user