Switch to new samskivert logging API.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5134 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -21,8 +21,6 @@
|
||||
|
||||
package com.threerings.presents.server;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.samskivert.io.PersistenceException;
|
||||
|
||||
import com.samskivert.util.Invoker;
|
||||
@@ -69,7 +67,7 @@ public abstract class Authenticator
|
||||
try {
|
||||
processAuthentication(conn, rsp);
|
||||
} catch (Exception e) { // Persistence or Runtime
|
||||
log.log(Level.WARNING, "Error authenticating user [areq=" + req + "].", e);
|
||||
log.warning("Error authenticating user [areq=" + req + "].", e);
|
||||
rdata.code = AuthCodes.SERVER_ERROR;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.samskivert.util.Interval;
|
||||
import com.samskivert.util.ObserverList;
|
||||
@@ -119,7 +118,7 @@ public class ClientManager
|
||||
try {
|
||||
pc.shutdown();
|
||||
} catch (Exception e) {
|
||||
log.log(Level.WARNING, "Client choked in shutdown() [client=" +
|
||||
log.warning("Client choked in shutdown() [client=" +
|
||||
StringUtil.safeToString(pc) + "].", e);
|
||||
}
|
||||
}
|
||||
@@ -298,7 +297,7 @@ public class ClientManager
|
||||
return;
|
||||
}
|
||||
|
||||
log.fine("Destroying client " + clobj.who() + ".");
|
||||
log.debug("Destroying client " + clobj.who() + ".");
|
||||
|
||||
// we're all clear to go; remove the mapping
|
||||
_objmap.remove(username);
|
||||
@@ -402,7 +401,7 @@ public class ClientManager
|
||||
// remove the client from the connection map
|
||||
PresentsClient client = _conmap.remove(conn);
|
||||
if (client != null) {
|
||||
log.fine("Unmapped client [client=" + client + ", conn=" + conn + "].");
|
||||
log.debug("Unmapped client [client=" + client + ", conn=" + conn + "].");
|
||||
// let the client know the connection went away
|
||||
client.wasUnmapped();
|
||||
|
||||
@@ -497,7 +496,7 @@ public class ClientManager
|
||||
", dtime=" + (now-client.getNetworkStamp()) + "ms].");
|
||||
client.endSession();
|
||||
} catch (Exception e) {
|
||||
log.log(Level.WARNING, "Choke while flushing client [victim=" + client + "].", e);
|
||||
log.warning("Choke while flushing client [victim=" + client + "].", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -515,7 +514,7 @@ public class ClientManager
|
||||
_clop.apply(clobj);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.log(Level.WARNING, "Client op failed [username=" + username +
|
||||
log.warning("Client op failed [username=" + username +
|
||||
", clop=" + _clop + "].", e);
|
||||
|
||||
} finally {
|
||||
|
||||
@@ -26,12 +26,13 @@ import java.util.ArrayList;
|
||||
import com.samskivert.util.Invoker;
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.presents.Log;
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.data.PermissionPolicy;
|
||||
import com.threerings.presents.dobj.DObject;
|
||||
import com.threerings.presents.dobj.ObjectAccessException;
|
||||
|
||||
import static com.threerings.presents.Log.log;
|
||||
|
||||
/**
|
||||
* Used to resolve client data when a user starts a session (or when some other entity needs access
|
||||
* to a client object). Implementations will want to extend this class and override {@link
|
||||
@@ -121,8 +122,7 @@ public class ClientResolver extends Invoker.Unit
|
||||
_clobj.reference();
|
||||
crl.clientResolved(_username, _clobj);
|
||||
} catch (Exception e) {
|
||||
Log.warning("Client resolution listener choked in clientResolved() " + crl);
|
||||
Log.logStackTrace(e);
|
||||
log.warning("Client resolution listener choked in clientResolved() " + crl, e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,9 +172,8 @@ public class ClientResolver extends Invoker.Unit
|
||||
try {
|
||||
crl.resolutionFailed(_username, cause);
|
||||
} catch (Exception e) {
|
||||
Log.warning("Client resolution listener choked in resolutionFailed() [crl=" + crl +
|
||||
", username=" + _username + ", cause=" + cause + "].");
|
||||
Log.logStackTrace(e);
|
||||
log.warning("Client resolution listener choked in resolutionFailed() [crl=" + crl +
|
||||
", username=" + _username + ", cause=" + cause + "].", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,10 +23,11 @@ package com.threerings.presents.server;
|
||||
|
||||
import com.samskivert.util.StringUtil;
|
||||
|
||||
import com.threerings.presents.Log;
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
|
||||
import static com.threerings.presents.Log.log;
|
||||
|
||||
/**
|
||||
* Provides the base class via which invocation service requests are
|
||||
* dispatched.
|
||||
@@ -49,7 +50,7 @@ public abstract class InvocationDispatcher
|
||||
ClientObject source, int methodId, Object[] args)
|
||||
throws InvocationException
|
||||
{
|
||||
Log.warning("Requested to dispatch unknown method " +
|
||||
log.warning("Requested to dispatch unknown method " +
|
||||
"[provider=" + provider +
|
||||
", sourceOid=" + source.getOid() +
|
||||
", methodId=" + methodId +
|
||||
|
||||
@@ -30,7 +30,6 @@ import com.samskivert.util.StringUtil;
|
||||
import com.threerings.io.Streamable;
|
||||
import com.threerings.util.StreamableArrayList;
|
||||
|
||||
import com.threerings.presents.Log;
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.data.InvocationMarshaller.ListenerMarshaller;
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
@@ -44,6 +43,8 @@ import com.threerings.presents.dobj.RootDObjectManager;
|
||||
|
||||
import com.threerings.presents.net.Transport;
|
||||
|
||||
import static com.threerings.presents.Log.log;
|
||||
|
||||
/**
|
||||
* The invocation services provide client to server invocations (service requests) and server to
|
||||
* client invocations (responses and notifications). Via this mechanism, the client can make
|
||||
@@ -154,13 +155,13 @@ public class InvocationManager
|
||||
public void clearDispatcher (InvocationMarshaller marsh)
|
||||
{
|
||||
if (marsh == null) {
|
||||
Log.warning("Refusing to unregister null marshaller.");
|
||||
log.warning("Refusing to unregister null marshaller.");
|
||||
Thread.dumpStack();
|
||||
return;
|
||||
}
|
||||
|
||||
if (_dispatchers.remove(marsh.getInvocationCode()) == null) {
|
||||
Log.warning("Requested to remove unregistered marshaller? " +
|
||||
log.warning("Requested to remove unregistered marshaller? " +
|
||||
"[marsh=" + marsh + "].");
|
||||
Thread.dumpStack();
|
||||
}
|
||||
@@ -218,7 +219,7 @@ public class InvocationManager
|
||||
// make sure the client is still around
|
||||
ClientObject source = (ClientObject)_omgr.getObject(clientOid);
|
||||
if (source == null) {
|
||||
Log.info("Client no longer around for invocation " +
|
||||
log.info("Client no longer around for invocation " +
|
||||
"request [clientOid=" + clientOid +
|
||||
", code=" + invCode + ", methId=" + methodId +
|
||||
", args=" + StringUtil.toString(args) + "].");
|
||||
@@ -228,7 +229,7 @@ public class InvocationManager
|
||||
// look up the dispatcher
|
||||
InvocationDispatcher disp = _dispatchers.get(invCode);
|
||||
if (disp == null) {
|
||||
Log.info("Received invocation request but dispatcher " +
|
||||
log.info("Received invocation request but dispatcher " +
|
||||
"registration was already cleared [code=" + invCode +
|
||||
", methId=" + methodId +
|
||||
", args=" + StringUtil.toString(args) + ", marsh=" +
|
||||
@@ -271,7 +272,7 @@ public class InvocationManager
|
||||
rlist.requestFailed(ie.getMessage());
|
||||
|
||||
} else {
|
||||
Log.warning("Service request failed but we've got no " +
|
||||
log.warning("Service request failed but we've got no " +
|
||||
"listener to inform of the failure " +
|
||||
"[caller=" + source.who() + ", code=" + invCode +
|
||||
", dispatcher=" + disp + ", methodId=" + methodId +
|
||||
@@ -280,10 +281,9 @@ public class InvocationManager
|
||||
}
|
||||
|
||||
} catch (Throwable t) {
|
||||
Log.warning("Dispatcher choked [disp=" + disp +
|
||||
log.warning("Dispatcher choked [disp=" + disp +
|
||||
", caller=" + source.who() + ", methId=" + methodId +
|
||||
", args=" + StringUtil.toString(args) + "].");
|
||||
Log.logStackTrace(t);
|
||||
", args=" + StringUtil.toString(args) + "].", t);
|
||||
|
||||
// avoid logging an error when the listener notices that it's
|
||||
// been ignored.
|
||||
|
||||
@@ -23,13 +23,14 @@ package com.threerings.presents.server;
|
||||
|
||||
import com.samskivert.util.StringUtil;
|
||||
|
||||
import com.threerings.presents.Log;
|
||||
import com.threerings.presents.client.InvocationReceiver.Registration;
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.dobj.InvocationNotificationEvent;
|
||||
|
||||
import com.threerings.presents.net.Transport;
|
||||
|
||||
import static com.threerings.presents.Log.log;
|
||||
|
||||
/**
|
||||
* Provides basic functionality used by all invocation sender classes.
|
||||
*/
|
||||
@@ -56,7 +57,7 @@ public abstract class InvocationSender
|
||||
// specific client
|
||||
Registration rreg = target.receivers.get(receiverCode);
|
||||
if (rreg == null) {
|
||||
Log.warning("Unable to locate receiver for invocation service notification " +
|
||||
log.warning("Unable to locate receiver for invocation service notification " +
|
||||
"[clobj=" + target.who() + ", code=" + receiverCode +
|
||||
", methId=" + methodId + ", args=" + StringUtil.toString(args) + "].");
|
||||
Thread.dumpStack();
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.util.HashMap;
|
||||
import java.util.TimeZone;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.samskivert.util.HashIntMap;
|
||||
import com.samskivert.util.ResultListener;
|
||||
@@ -247,7 +246,7 @@ public class PresentsClient
|
||||
}
|
||||
|
||||
public void resolutionFailed (Name username, Exception reason) {
|
||||
log.log(Level.WARNING, "Unable to resolve new client object [oldname=" + _username +
|
||||
log.warning("Unable to resolve new client object [oldname=" + _username +
|
||||
", newname=" + username + ", reason=" + reason + "].", reason);
|
||||
|
||||
// let our listener know we're hosed
|
||||
@@ -308,7 +307,7 @@ public class PresentsClient
|
||||
try {
|
||||
sessionDidEnd();
|
||||
} catch (Exception e) {
|
||||
log.log(Level.WARNING, "Choked in sessionDidEnd " + this + ".", e);
|
||||
log.warning("Choked in sessionDidEnd " + this + ".", e);
|
||||
}
|
||||
|
||||
// release (and destroy) our client object
|
||||
@@ -364,7 +363,7 @@ public class PresentsClient
|
||||
public void resolutionFailed (Name username, Exception reason)
|
||||
{
|
||||
// urk; nothing to do but complain and get the f**k out of dodge
|
||||
log.log(Level.WARNING, "Unable to resolve client [username=" + username + "].", reason);
|
||||
log.warning("Unable to resolve client [username=" + username + "].", reason);
|
||||
|
||||
// end the session now to prevent danglage
|
||||
endSession();
|
||||
@@ -990,7 +989,7 @@ public class PresentsClient
|
||||
{
|
||||
public void dispatch (final PresentsClient client, UpstreamMessage msg)
|
||||
{
|
||||
log.fine("Client requested logoff " + client + ".");
|
||||
log.debug("Client requested logoff " + client + ".");
|
||||
client.safeEndSession();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.samskivert.util.AuditLogger;
|
||||
import com.samskivert.util.HashIntMap;
|
||||
@@ -331,8 +330,7 @@ public class PresentsDObjectMgr
|
||||
handleFatalError(unit, e);
|
||||
|
||||
} catch (Throwable t) {
|
||||
log.log(Level.WARNING,
|
||||
"Execution unit failed [unit=" + StringUtil.safeToString(unit) + "].", t);
|
||||
log.warning("Execution unit failed", "unit", unit, t);
|
||||
}
|
||||
|
||||
// compute the elapsed time in microseconds
|
||||
@@ -340,9 +338,8 @@ public class PresentsDObjectMgr
|
||||
|
||||
// report excessively long units
|
||||
if (elapsed > 500000 && !(unit instanceof LongRunnable)) {
|
||||
log.warning("Long dobj unit [u=" + StringUtil.safeToString(unit) +
|
||||
" (" + StringUtil.shortClassName(unit) + ")" +
|
||||
", time=" + (elapsed/1000) + "ms].");
|
||||
log.warning("Long dobj unit " + StringUtil.shortClassName(unit), "unit", unit,
|
||||
"time", (elapsed/1000) + "ms");
|
||||
}
|
||||
|
||||
// periodically sample and record the time spent processing a unit
|
||||
@@ -380,7 +377,7 @@ public class PresentsDObjectMgr
|
||||
// look up the target object
|
||||
DObject target = _objects.get(event.getTargetOid());
|
||||
if (target == null) {
|
||||
log.fine("Compound event target no longer exists [event=" + event + "].");
|
||||
log.debug("Compound event target no longer exists [event=" + event + "].");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -411,7 +408,7 @@ public class PresentsDObjectMgr
|
||||
// look up the target object
|
||||
DObject target = _objects.get(event.getTargetOid());
|
||||
if (target == null) {
|
||||
log.fine("Event target no longer exists [event=" + event + "].");
|
||||
log.debug("Event target no longer exists [event=" + event + "].");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -462,7 +459,7 @@ public class PresentsDObjectMgr
|
||||
handleFatalError(event, e);
|
||||
|
||||
} catch (Throwable t) {
|
||||
log.log(Level.WARNING, "Failure processing event [event=" + event +
|
||||
log.warning("Failure processing event [event=" + event +
|
||||
", target=" + target + "].", t);
|
||||
}
|
||||
|
||||
@@ -481,7 +478,7 @@ public class PresentsDObjectMgr
|
||||
if (_fatalThrottle.throttleOp()) {
|
||||
throw error;
|
||||
}
|
||||
log.log(Level.WARNING, "Fatal error caused by '" + causer + "': " + error, error);
|
||||
log.warning("Fatal error caused by '" + causer + "': " + error, error);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -772,7 +769,7 @@ public class PresentsDObjectMgr
|
||||
try {
|
||||
sub.objectAvailable(obj);
|
||||
} catch (Exception e) {
|
||||
log.log(Level.WARNING, "Subscriber choked during object available " +
|
||||
log.warning("Subscriber choked during object available " +
|
||||
"[obj=" + StringUtil.safeToString(obj) + ", sub=" + sub + "].", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.Iterator;
|
||||
import com.samskivert.util.Invoker;
|
||||
import com.samskivert.util.StringUtil;
|
||||
|
||||
import com.threerings.presents.Log;
|
||||
import static com.threerings.presents.Log.log;
|
||||
|
||||
/**
|
||||
* Extends the generic {@link Invoker} and integrates it a bit more into
|
||||
@@ -172,7 +172,7 @@ public class PresentsInvoker extends Invoker
|
||||
// otherwise end it, and complain if we're ending it
|
||||
// because of passes
|
||||
if (_passCount >= MAX_PASSES) {
|
||||
Log.warning("Shutdown Unit passed 50 times without " +
|
||||
log.warning("Shutdown Unit passed 50 times without " +
|
||||
"finishing, shutting down harshly.");
|
||||
}
|
||||
doShutdown();
|
||||
@@ -185,7 +185,7 @@ public class PresentsInvoker extends Invoker
|
||||
protected boolean checkLoops ()
|
||||
{
|
||||
if (_loopCount > MAX_LOOPS) {
|
||||
Log.warning("Shutdown Unit looped on one thread 10000 times " +
|
||||
log.warning("Shutdown Unit looped on one thread 10000 times " +
|
||||
"without finishing, shutting down harshly.");
|
||||
doShutdown();
|
||||
return true;
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
package com.threerings.presents.server;
|
||||
|
||||
import com.threerings.presents.Log;
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.dobj.AccessController;
|
||||
import com.threerings.presents.dobj.DEvent;
|
||||
@@ -31,6 +30,8 @@ import com.threerings.presents.dobj.MessageEvent;
|
||||
import com.threerings.presents.dobj.NamedEvent;
|
||||
import com.threerings.presents.dobj.Subscriber;
|
||||
|
||||
import static com.threerings.presents.Log.log;
|
||||
|
||||
/**
|
||||
* Defines the various object access controllers used by the Presents server.
|
||||
*/
|
||||
@@ -76,7 +77,7 @@ public class PresentsObjectAccess
|
||||
if (sub instanceof PresentsClient) {
|
||||
allowed = ((PresentsClient)sub).getClientObject() == object;
|
||||
if (!allowed) {
|
||||
Log.warning("Refusing ClientObject subscription request " +
|
||||
log.warning("Refusing ClientObject subscription request " +
|
||||
"[obj=" + ((ClientObject)object).who() + ", sub=" + sub + "].");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
package com.threerings.presents.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.samskivert.util.Interval;
|
||||
import com.samskivert.util.ObserverList;
|
||||
@@ -123,7 +122,7 @@ public class PresentsServer
|
||||
Runnable trun = (Runnable)tmclass.newInstance();
|
||||
trun.run();
|
||||
} catch (Exception e) {
|
||||
log.log(Level.WARNING, "Unable to invoke test module '" + testmod + "'.", e);
|
||||
log.warning("Unable to invoke test module '" + testmod + "'.", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +131,7 @@ public class PresentsServer
|
||||
server.run();
|
||||
|
||||
} catch (Exception e) {
|
||||
log.log(Level.WARNING, "Unable to initialize server.", e);
|
||||
log.warning("Unable to initialize server.", e);
|
||||
System.exit(-1);
|
||||
}
|
||||
}
|
||||
@@ -305,7 +304,7 @@ public class PresentsServer
|
||||
try {
|
||||
rptr.appendReport(report, now, sinceLast, reset);
|
||||
} catch (Throwable t) {
|
||||
log.log(Level.WARNING, "Reporter choked [rptr=" + rptr + "].", t);
|
||||
log.warning("Reporter choked [rptr=" + rptr + "].", t);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
|
||||
package com.threerings.presents.server;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.samskivert.io.PersistenceException;
|
||||
|
||||
import com.samskivert.util.Invoker;
|
||||
@@ -75,7 +73,7 @@ public class Rejector extends PresentsServer
|
||||
server.init();
|
||||
server.run();
|
||||
} catch (Exception e) {
|
||||
log.log(Level.WARNING, "Unable to initialize server.", e);
|
||||
log.warning("Unable to initialize server.", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ package com.threerings.presents.server;
|
||||
import java.util.HashMap;
|
||||
import com.samskivert.util.ResultListener;
|
||||
|
||||
import com.threerings.presents.Log;
|
||||
import com.threerings.presents.client.TimeBaseService.GotTimeBaseListener;
|
||||
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
@@ -33,6 +32,8 @@ import com.threerings.presents.data.TimeBaseObject;
|
||||
|
||||
import com.threerings.presents.dobj.RootDObjectManager;
|
||||
|
||||
import static com.threerings.presents.Log.log;
|
||||
|
||||
/**
|
||||
* Provides the server-side of the time base services. The time base services provide a means by
|
||||
* which delta times can be sent over the network which are expanded based on a shared base time
|
||||
|
||||
@@ -27,11 +27,12 @@ import java.nio.channels.SocketChannel;
|
||||
|
||||
import com.samskivert.util.StringUtil;
|
||||
|
||||
import com.threerings.presents.Log;
|
||||
import com.threerings.presents.net.AuthRequest;
|
||||
import com.threerings.presents.net.AuthResponse;
|
||||
import com.threerings.presents.net.UpstreamMessage;
|
||||
|
||||
import static com.threerings.presents.Log.log;
|
||||
|
||||
/**
|
||||
* The authing connection manages the client connection until
|
||||
* authentication has completed (for better or for worse).
|
||||
@@ -66,7 +67,7 @@ public class AuthingConnection extends Connection
|
||||
_cmgr.getAuthenticator().authenticateConnection(this);
|
||||
|
||||
} catch (ClassCastException cce) {
|
||||
Log.warning("Received non-authreq message during " +
|
||||
log.warning("Received non-authreq message during " +
|
||||
"authentication process [conn=" + this +
|
||||
", msg=" + msg + "].");
|
||||
}
|
||||
|
||||
@@ -44,12 +44,13 @@ import com.threerings.io.ObjectOutputStream;
|
||||
import com.threerings.io.UnreliableObjectInputStream;
|
||||
import com.threerings.io.UnreliableObjectOutputStream;
|
||||
|
||||
import com.threerings.presents.Log;
|
||||
import com.threerings.presents.net.DownstreamMessage;
|
||||
import com.threerings.presents.net.PingRequest;
|
||||
import com.threerings.presents.net.UpstreamMessage;
|
||||
import com.threerings.presents.util.DatagramSequencer;
|
||||
|
||||
import static com.threerings.presents.Log.log;
|
||||
|
||||
/**
|
||||
* The base connection class implements the net event handler interface and processes raw incoming
|
||||
* network data into a stream of parsed <code>UpstreamMessage</code> objects. It also provides the
|
||||
@@ -166,7 +167,7 @@ public abstract class Connection implements NetEventHandler
|
||||
{
|
||||
// we shouldn't be closed twice
|
||||
if (isClosed()) {
|
||||
Log.warning("Attempted to re-close connection " + this + ".");
|
||||
log.warning("Attempted to re-close connection " + this + ".");
|
||||
Thread.dumpStack();
|
||||
return;
|
||||
}
|
||||
@@ -186,7 +187,7 @@ public abstract class Connection implements NetEventHandler
|
||||
{
|
||||
// if we're already closed, then something is seriously funny
|
||||
if (isClosed()) {
|
||||
Log.warning("Failure reported on closed connection " + this + ".");
|
||||
log.warning("Failure reported on closed connection " + this + ".");
|
||||
Thread.dumpStack();
|
||||
return;
|
||||
}
|
||||
@@ -264,11 +265,11 @@ public abstract class Connection implements NetEventHandler
|
||||
return;
|
||||
}
|
||||
|
||||
Log.debug("Closing channel " + this + ".");
|
||||
log.debug("Closing channel " + this + ".");
|
||||
try {
|
||||
_channel.close();
|
||||
} catch (IOException ioe) {
|
||||
Log.warning("Error closing connection [conn=" + this + ", error=" + ioe + "].");
|
||||
log.warning("Error closing connection [conn=" + this + ", error=" + ioe + "].");
|
||||
}
|
||||
|
||||
// clear out our references to prevent repeat closings
|
||||
@@ -314,7 +315,7 @@ public abstract class Connection implements NetEventHandler
|
||||
close();
|
||||
|
||||
} catch (ClassNotFoundException cnfe) {
|
||||
Log.warning("Error reading message from socket [channel=" +
|
||||
log.warning("Error reading message from socket [channel=" +
|
||||
StringUtil.safeToString(_channel) + ", error=" + cnfe + "].");
|
||||
// deal with the failure
|
||||
String errmsg = "Unable to decode incoming message.";
|
||||
@@ -324,7 +325,7 @@ public abstract class Connection implements NetEventHandler
|
||||
// don't log a warning for the ever-popular "the client dropped the connection" failure
|
||||
String msg = ioe.getMessage();
|
||||
if (msg == null || msg.indexOf("reset by peer") == -1) {
|
||||
Log.warning("Error reading message from socket [channel=" +
|
||||
log.warning("Error reading message from socket [channel=" +
|
||||
StringUtil.safeToString(_channel) + ", error=" + ioe + "].");
|
||||
}
|
||||
// deal with the failure
|
||||
@@ -344,7 +345,7 @@ public abstract class Connection implements NetEventHandler
|
||||
try {
|
||||
_digest = MessageDigest.getInstance("MD5");
|
||||
} catch (NoSuchAlgorithmException nsae) {
|
||||
Log.warning("Missing MD5 algorithm.");
|
||||
log.warning("Missing MD5 algorithm.");
|
||||
return;
|
||||
}
|
||||
ByteBufferInputStream bin = new ByteBufferInputStream(buf);
|
||||
@@ -360,7 +361,7 @@ public abstract class Connection implements NetEventHandler
|
||||
buf.position(4);
|
||||
for (int ii = 0; ii < 8; ii++) {
|
||||
if (hash[ii] != buf.get()) {
|
||||
Log.warning("Datagram failed hash check [connectionId=" + _connectionId +
|
||||
log.warning("Datagram failed hash check [connectionId=" + _connectionId +
|
||||
", source=" + source + "].");
|
||||
return;
|
||||
}
|
||||
@@ -379,10 +380,10 @@ public abstract class Connection implements NetEventHandler
|
||||
_handler.handleMessage(msg);
|
||||
|
||||
} catch (ClassNotFoundException cnfe) {
|
||||
Log.warning("Error reading datagram [error=" + cnfe + "].");
|
||||
log.warning("Error reading datagram [error=" + cnfe + "].");
|
||||
|
||||
} catch (IOException ioe) {
|
||||
Log.warning("Error reading datagram [error=" + ioe + "].");
|
||||
log.warning("Error reading datagram [error=" + ioe + "].");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -396,7 +397,7 @@ public abstract class Connection implements NetEventHandler
|
||||
if (isClosed()) {
|
||||
return true;
|
||||
}
|
||||
Log.info("Disconnecting non-communicative client [conn=" + this +
|
||||
log.info("Disconnecting non-communicative client [conn=" + this +
|
||||
", idle=" + idleMillis + "ms].");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.samskivert.util.*;
|
||||
|
||||
@@ -286,7 +285,7 @@ public class ConnectionManager extends LoopingThread
|
||||
log.info("Server listening on " + isa + ".");
|
||||
|
||||
} catch (IOException ioe) {
|
||||
log.log(Level.WARNING, "Failure listening to socket on port '" +
|
||||
log.warning("Failure listening to socket on port '" +
|
||||
_ports[ii] + "'.", ioe);
|
||||
_failure = ioe;
|
||||
}
|
||||
@@ -339,7 +338,7 @@ public class ConnectionManager extends LoopingThread
|
||||
log.info("Server accepting datagrams on " + isa + ".");
|
||||
|
||||
} catch (IOException ioe) {
|
||||
log.log(Level.WARNING, "Failure opening datagram channel on port '" +
|
||||
log.warning("Failure opening datagram channel on port '" +
|
||||
port + "'.", ioe);
|
||||
}
|
||||
}
|
||||
@@ -459,14 +458,14 @@ public class ConnectionManager extends LoopingThread
|
||||
conn.getAuthRequest(), conn.getAuthResponse());
|
||||
|
||||
} catch (IOException ioe) {
|
||||
log.log(Level.WARNING, "Failure upgrading authing connection to running.", ioe);
|
||||
log.warning("Failure upgrading authing connection to running.", ioe);
|
||||
}
|
||||
}
|
||||
|
||||
Set<SelectionKey> ready = null;
|
||||
try {
|
||||
// check for incoming network events
|
||||
// log.fine("Selecting from " + StringUtil.toString(_selector.keys()) + " (" +
|
||||
// log.debug("Selecting from " + StringUtil.toString(_selector.keys()) + " (" +
|
||||
// SELECT_LOOP_TIME + ").");
|
||||
int ecount = _selector.select(SELECT_LOOP_TIME);
|
||||
ready = _selector.selectedKeys();
|
||||
@@ -482,7 +481,7 @@ public class ConnectionManager extends LoopingThread
|
||||
} catch (IOException ioe) {
|
||||
if ("Invalid argument".equals(ioe.getMessage())) {
|
||||
// what is this, anyway?
|
||||
log.log(Level.WARNING, "Failure select()ing.", ioe);
|
||||
log.warning("Failure select()ing.", ioe);
|
||||
} else {
|
||||
log.warning("Failure select()ing [ioe=" + ioe + "].");
|
||||
}
|
||||
@@ -492,7 +491,7 @@ public class ConnectionManager extends LoopingThread
|
||||
// this block of code deals with a bug in the _selector that we observed on 2005-05-02,
|
||||
// instead of looping indefinitely after things go pear-shaped, shut us down in an
|
||||
// orderly fashion
|
||||
log.log(Level.WARNING, "Failure select()ing.", re);
|
||||
log.warning("Failure select()ing.", re);
|
||||
if (_runtimeExceptionCount++ >= 20) {
|
||||
log.warning("Too many errors, bailing.");
|
||||
shutdown();
|
||||
@@ -532,7 +531,7 @@ public class ConnectionManager extends LoopingThread
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.log(Level.WARNING, "Error processing network data: " + handler + ".", e);
|
||||
log.warning("Error processing network data: " + handler + ".", e);
|
||||
|
||||
// if you freak out here, you go straight in the can
|
||||
if (handler != null && handler instanceof Connection) {
|
||||
@@ -681,7 +680,7 @@ public class ConnectionManager extends LoopingThread
|
||||
try {
|
||||
return _datagramChannel.send(_databuf, target) > 0;
|
||||
} catch (IOException ioe) {
|
||||
log.log(Level.WARNING, "Failed to send datagram.", ioe);
|
||||
log.warning("Failed to send datagram.", ioe);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -699,7 +698,7 @@ public class ConnectionManager extends LoopingThread
|
||||
protected void handleIterateFailure (Exception e)
|
||||
{
|
||||
// log the exception
|
||||
log.log(Level.WARNING, "ConnectionManager.iterate() uncaught exception.", e);
|
||||
log.warning("ConnectionManager.iterate() uncaught exception.", e);
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
@@ -712,7 +711,7 @@ public class ConnectionManager extends LoopingThread
|
||||
try {
|
||||
_ssocket.socket().close();
|
||||
} catch (IOException ioe) {
|
||||
log.log(Level.WARNING, "Failed to close listening socket.", ioe);
|
||||
log.warning("Failed to close listening socket.", ioe);
|
||||
}
|
||||
|
||||
// and the datagram socket, if any
|
||||
@@ -752,7 +751,7 @@ public class ConnectionManager extends LoopingThread
|
||||
return;
|
||||
}
|
||||
|
||||
// log.fine("Accepted connection " + channel + ".");
|
||||
// log.debug("Accepted connection " + channel + ".");
|
||||
|
||||
// create a new authing connection object to manage the authentication of this client
|
||||
// connection and register it with our selection set
|
||||
@@ -767,7 +766,7 @@ public class ConnectionManager extends LoopingThread
|
||||
|
||||
} catch (IOException ioe) {
|
||||
// no need to complain this happens in the normal course of events
|
||||
// log.log(Level.WARNING, "Failure accepting new connection.", ioe);
|
||||
// log.warning("Failure accepting new connection.", ioe);
|
||||
}
|
||||
|
||||
// make sure we don't leak a socket if something went awry
|
||||
@@ -792,7 +791,7 @@ public class ConnectionManager extends LoopingThread
|
||||
try {
|
||||
source = (InetSocketAddress)listener.receive(_databuf);
|
||||
} catch (IOException ioe) {
|
||||
log.log(Level.WARNING, "Failure receiving datagram.", ioe);
|
||||
log.warning("Failure receiving datagram.", ioe);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -873,7 +872,7 @@ public class ConnectionManager extends LoopingThread
|
||||
_outq.append(new Tuple<Connection,byte[]>(conn, data));
|
||||
|
||||
} catch (Exception e) {
|
||||
log.log(Level.WARNING, "Failure flattening message [conn=" + conn +
|
||||
log.warning("Failure flattening message [conn=" + conn +
|
||||
", msg=" + msg + "].", e);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user