Skip to content

Commit

Permalink
Fix logging in serverCore
Browse files Browse the repository at this point in the history
Prevent NPE:
I 2009/02/20 15:15:56 PLASMA check for Session_77.37.19.225:38812#0: 86515 ms alive, stopping thread
I 2009/02/20 15:15:56 PLASMA Closing main socket of thread 'Session_77.37.19.225:38812#0'
E 2009/02/20 15:15:56 SERVER receive interrupted - exception 2 = Socket closed
Exception in thread "Session_77.37.19.225:38812#0" java.lang.NullPointerException
        at de.anomic.server.serverCore$Session.run(serverCore.java:623)



git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5624 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
hermens committed Feb 20, 2009
1 parent 4f9dae2 commit d30456e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions source/de/anomic/server/serverCore.java
Expand Up @@ -152,7 +152,7 @@ public final void terminateOldSessions(long minage) {
(currentThread.isAlive()) &&
(((Session) currentThread).getTime() > minage)
) {
log.logInfo("check for " + currentThread.getName() + ": " + ((Session) currentThread).getTime() + " ms alive, stopping thread");
this.log.logInfo("check for " + currentThread.getName() + ": " + ((Session) currentThread).getTime() + " ms alive, stopping thread");
// trying to stop session
((Session)currentThread).setStopped(true);
try { Thread.sleep(100); } catch (final InterruptedException ex) {}
Expand Down Expand Up @@ -321,7 +321,7 @@ public boolean job() throws Exception {
// prepare for new connection
// idleThreadCheck();
this.switchboard.handleBusyState(this.busySessions.size());
if (log.isFinest()) this.log.logFinest("* waiting for connections, " + this.busySessions.size() + " sessions running");
if (this.log.isFinest()) this.log.logFinest("* waiting for connections, " + this.busySessions.size() + " sessions running");

announceThreadBlockApply();

Expand All @@ -333,7 +333,7 @@ public boolean job() throws Exception {
if(this.busySessions.size() >= this.maxBusySessions)
{
// immediatly close connection if too much sessions are still running
if (log.isFinest()) this.log.logFinest("* connections exceeding limit, closing new incoming connection from "+ controlSocket.getRemoteSocketAddress());
if (this.log.isFinest()) this.log.logFinest("* connections exceeding limit, closing new incoming connection from "+ controlSocket.getRemoteSocketAddress());
controlSocket.close();
return false;
}
Expand Down Expand Up @@ -620,7 +620,7 @@ public void run() {
System.err.println("ERROR: (internal) " + e);
} finally {
try {
if (this.controlSocket.isClosed()) return;
if ((this.controlSocket == null) || this.controlSocket.isClosed()) return;

// flush data
this.out.flush();
Expand All @@ -644,7 +644,7 @@ public void run() {
if (busySessions != null)
{
busySessions.remove(this);
if(log.isFinest()) log.logFinest("* removed session "+ this.controlSocket.getRemoteSocketAddress() + " " + this.request);
if(serverCore.this.log.isFinest()) serverCore.this.log.logFinest("* removed session "+ this.controlSocket.getRemoteSocketAddress() + " " + this.request);
}
this.controlSocket = null;
}
Expand All @@ -654,7 +654,7 @@ public void run() {
protected void finalize() {
if (busySessions != null && busySessions.contains(this)) {
busySessions.remove(this);
if(log.isFinest()) log.logFinest("* removed session "+ this.controlSocket.getRemoteSocketAddress() + this.request);
if(serverCore.this.log.isFinest()) serverCore.this.log.logFinest("* removed session "+ this.controlSocket.getRemoteSocketAddress() + this.request);
}
this.close();
}
Expand All @@ -673,7 +673,7 @@ private void listen() {
"#" + this.commandCounter);

this.request = new String(requestBytes);
//log.logDebug("* session " + handle + " received command '" + request + "'. time = " + (System.currentTimeMillis() - handle));
//this.log.logDebug("* session " + handle + " received command '" + request + "'. time = " + (System.currentTimeMillis() - handle));
log(false, this.request);
try {
// if we can not determine the proper command string we try to call function emptyRequest
Expand Down Expand Up @@ -737,7 +737,7 @@ private void listen() {
//long commandStart = System.currentTimeMillis();
Object result = ((Method)commandMethod).invoke(this.commandObj, stringParameter);
//announceMoreExecTime(commandStart - System.currentTimeMillis()); // shall be negative!
//log.logDebug("* session " + handle + " completed command '" + request + "'. time = " + (System.currentTimeMillis() - handle));
//this.log.logDebug("* session " + handle + " completed command '" + request + "'. time = " + (System.currentTimeMillis() - handle));
this.out.flush();
if (result != null) {
if (result instanceof Boolean) {
Expand Down

0 comments on commit d30456e

Please sign in to comment.