remove static log refs

This commit is contained in:
zzz
2011-07-09 14:57:41 +00:00
parent 5402bd0dc2
commit fdd0d6ceb1
3 changed files with 19 additions and 19 deletions

View File

@@ -42,7 +42,7 @@ import net.i2p.util.SimpleByteCache;
* @author zzz
*/
public class SDSCache<V extends SimpleDataStructure> {
private static final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(SDSCache.class);
//private static final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(SDSCache.class);
private static final Class[] conArg = new Class[] { byte[].class };
private static final double MIN_FACTOR = 0.25;
@@ -79,9 +79,9 @@ public class SDSCache<V extends SimpleDataStructure> {
throw new RuntimeException("SDSCache init error", e);
}
_statName = "SDSCache." + rvClass.getSimpleName();
if (_log.shouldLog(Log.DEBUG))
_log.debug("New SDSCache for " + rvClass + " data size: " + len +
" max: " + size + " max mem: " + (len * size));
//if (_log.shouldLog(Log.DEBUG))
// _log.debug("New SDSCache for " + rvClass + " data size: " + len +
// " max: " + size + " max mem: " + (len * size));
I2PAppContext.getGlobalContext().statManager().createRateStat(_statName, "Hit rate", "Router", new long[] { 10*60*1000 });
I2PAppContext.getGlobalContext().addShutdownTask(new Shutdown());
}

View File

@@ -57,7 +57,7 @@ import net.i2p.data.ByteArray;
*/
public final class ByteCache {
private static final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(ByteCache.class);
//private static final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(ByteCache.class);
private static final Map<Integer, ByteCache> _caches = new ConcurrentHashMap(16);
/**
@@ -105,7 +105,7 @@ public final class ByteCache {
public static void clearAll() {
for (ByteCache bc : _caches.values())
bc.clear();
_log.warn("WARNING: Low memory, clearing byte caches");
//_log.warn("WARNING: Low memory, clearing byte caches");
}
/** list of available and available entries */
@@ -199,8 +199,8 @@ public final class ByteCache {
int toRemove = _available.size() / 2;
for (int i = 0; i < toRemove; i++)
_available.poll();
if ( (toRemove > 0) && (_log.shouldLog(Log.DEBUG)) )
_log.debug("Removing " + toRemove + " cached entries of size " + _entrySize);
//if ( (toRemove > 0) && (_log.shouldLog(Log.DEBUG)) )
// _log.debug("Removing " + toRemove + " cached entries of size " + _entrySize);
}
}
}

View File

@@ -33,7 +33,7 @@ public class InternalServerSocket extends ServerSocket {
private BlockingQueue<InternalSocket> _acceptQueue;
private Integer _port;
private boolean _running;
private static Log _log = I2PAppContext.getGlobalContext().logManager().getLog(InternalServerSocket.class);
//private static Log _log = I2PAppContext.getGlobalContext().logManager().getLog(InternalServerSocket.class);
public InternalServerSocket(int port) throws IOException {
if (port <= 0)
@@ -44,14 +44,14 @@ public class InternalServerSocket extends ServerSocket {
throw new IOException("Internal port in use: " + port);
_running = true;
_acceptQueue = new LinkedBlockingQueue();
if (_log.shouldLog(Log.DEBUG))
_log.debug("Registered " + _port);
//if (_log.shouldLog(Log.DEBUG))
// _log.debug("Registered " + _port);
}
@Override
public void close() {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Closing " + _port);
//if (_log.shouldLog(Log.DEBUG))
// _log.debug("Closing " + _port);
_running = false;
_sockets.remove(_port);
_acceptQueue.clear();
@@ -65,8 +65,8 @@ public class InternalServerSocket extends ServerSocket {
public Socket accept() throws IOException {
InternalSocket serverSock = null;
while (_running) {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Accepting " + _port);
//if (_log.shouldLog(Log.DEBUG))
// _log.debug("Accepting " + _port);
try {
serverSock = _acceptQueue.take();
} catch (InterruptedException ie) {
@@ -74,8 +74,8 @@ public class InternalServerSocket extends ServerSocket {
}
if (serverSock.getInputStream() == null) // poison
throw new IOException("closed");
if (_log.shouldLog(Log.DEBUG))
_log.debug("Accepted " + _port);
//if (_log.shouldLog(Log.DEBUG))
// _log.debug("Accepted " + _port);
break;
}
return serverSock;
@@ -123,8 +123,8 @@ public class InternalServerSocket extends ServerSocket {
private void queueConnection(InternalSocket sock) throws IOException {
if (!_running)
throw new IOException("Server closed for port: " + _port);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Queueing " + _port);
//if (_log.shouldLog(Log.DEBUG))
// _log.debug("Queueing " + _port);
try {
_acceptQueue.put(sock);
} catch (InterruptedException ie) {}