* JobImpl: Deprecate getAddedBy() and addedToQueue()
to reduce LogManager records
This commit is contained in:
@ -39,11 +39,21 @@ public abstract class JobImpl implements Job {
|
|||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* As of 0.8.1, this is a noop, as it just adds classes to the log manager
|
||||||
|
* class list for no good reason. Logging in jobs is almost always
|
||||||
|
* set explicitly rather than by class name.
|
||||||
|
*/
|
||||||
void addedToQueue() {
|
void addedToQueue() {
|
||||||
if (_context.logManager().getLog(getClass()).shouldLog(Log.DEBUG))
|
//if (_context.logManager().getLog(getClass()).shouldLog(Log.DEBUG))
|
||||||
_addedBy = new Exception();
|
// _addedBy = new Exception();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* @return null always
|
||||||
|
*/
|
||||||
public Exception getAddedBy() { return _addedBy; }
|
public Exception getAddedBy() { return _addedBy; }
|
||||||
public long getMadeReadyOn() { return _madeReadyOn; }
|
public long getMadeReadyOn() { return _madeReadyOn; }
|
||||||
public void madeReady() { _madeReadyOn = _context.clock().now(); }
|
public void madeReady() { _madeReadyOn = _context.clock().now(); }
|
||||||
|
@ -142,8 +142,9 @@ public class JobQueue {
|
|||||||
public void addJob(Job job) {
|
public void addJob(Job job) {
|
||||||
if (job == null || !_alive) return;
|
if (job == null || !_alive) return;
|
||||||
|
|
||||||
if (job instanceof JobImpl)
|
// This does nothing
|
||||||
((JobImpl)job).addedToQueue();
|
//if (job instanceof JobImpl)
|
||||||
|
// ((JobImpl)job).addedToQueue();
|
||||||
|
|
||||||
long numReady = 0;
|
long numReady = 0;
|
||||||
boolean alreadyExists = false;
|
boolean alreadyExists = false;
|
||||||
|
@ -590,7 +590,7 @@ public class ClientConnectionRunner {
|
|||||||
+ " for session [" + _sessionId.getSessionId()
|
+ " for session [" + _sessionId.getSessionId()
|
||||||
+ "] (with nonce=2), retrying after ["
|
+ "] (with nonce=2), retrying after ["
|
||||||
+ (_context.clock().now() - _lastTried)
|
+ (_context.clock().now() - _lastTried)
|
||||||
+ "]", getAddedBy());
|
+ "]");
|
||||||
} else {
|
} else {
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("Updating message status for message " + _messageId + " to "
|
_log.debug("Updating message status for message " + _messageId + " to "
|
||||||
|
@ -76,7 +76,7 @@ public class SendMessageDirectJob extends JobImpl {
|
|||||||
if (_expiration < now) {
|
if (_expiration < now) {
|
||||||
if (_log.shouldLog(Log.WARN))
|
if (_log.shouldLog(Log.WARN))
|
||||||
_log.warn("Timed out sending message " + _message + " directly (expiration = "
|
_log.warn("Timed out sending message " + _message + " directly (expiration = "
|
||||||
+ new Date(_expiration) + ") to " + _targetHash.toBase64(), getAddedBy());
|
+ new Date(_expiration) + ") to " + _targetHash.toBase64());
|
||||||
if (_onFail != null)
|
if (_onFail != null)
|
||||||
getContext().jobQueue().addJob(_onFail);
|
getContext().jobQueue().addJob(_onFail);
|
||||||
return;
|
return;
|
||||||
@ -104,7 +104,7 @@ public class SendMessageDirectJob extends JobImpl {
|
|||||||
if (_log.shouldLog(Log.WARN))
|
if (_log.shouldLog(Log.WARN))
|
||||||
_log.warn("Unable to find the router to send to: " + _targetHash
|
_log.warn("Unable to find the router to send to: " + _targetHash
|
||||||
+ " after searching for " + (getContext().clock().now()-_searchOn)
|
+ " after searching for " + (getContext().clock().now()-_searchOn)
|
||||||
+ "ms, message: " + _message, getAddedBy());
|
+ "ms, message: " + _message);
|
||||||
if (_onFail != null)
|
if (_onFail != null)
|
||||||
getContext().jobQueue().addJob(_onFail);
|
getContext().jobQueue().addJob(_onFail);
|
||||||
}
|
}
|
||||||
|
@ -317,7 +317,7 @@ class TestJob extends JobImpl {
|
|||||||
public String getName() { return "Tunnel test timeout"; }
|
public String getName() { return "Tunnel test timeout"; }
|
||||||
public void runJob() {
|
public void runJob() {
|
||||||
if (_log.shouldLog(Log.WARN))
|
if (_log.shouldLog(Log.WARN))
|
||||||
_log.warn("Timeout: found? " + _found, getAddedBy());
|
_log.warn("Timeout: found? " + _found);
|
||||||
if (!_found) {
|
if (!_found) {
|
||||||
// don't clog up the SKM with old one-tag tagsets
|
// don't clog up the SKM with old one-tag tagsets
|
||||||
if (_cfg.isInbound() && !_pool.getSettings().isExploratory()) {
|
if (_cfg.isInbound() && !_pool.getSettings().isExploratory()) {
|
||||||
|
@ -81,7 +81,7 @@ public class SendGarlicJob extends JobImpl {
|
|||||||
long after = getContext().clock().now();
|
long after = getContext().clock().now();
|
||||||
if ( (after - before) > 1000) {
|
if ( (after - before) > 1000) {
|
||||||
if (_log.shouldLog(Log.WARN))
|
if (_log.shouldLog(Log.WARN))
|
||||||
_log.warn("Building the garlic took too long [" + (after-before)+" ms]", getAddedBy());
|
_log.warn("Building the garlic took too long [" + (after-before)+" ms]");
|
||||||
} else {
|
} else {
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("Building the garlic was fast! " + (after - before) + " ms");
|
_log.debug("Building the garlic was fast! " + (after - before) + " ms");
|
||||||
|
Reference in New Issue
Block a user