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:
Michael Bayne
2008-05-27 19:25:38 +00:00
parent 821760366f
commit 919112cf88
80 changed files with 440 additions and 573 deletions
+2 -27
View File
@@ -21,8 +21,7 @@
package com.threerings.presents;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.samskivert.util.Logger;
/**
* Contains a reference to the log object used by the Presents services.
@@ -30,29 +29,5 @@ import java.util.logging.Logger;
public class Log
{
/** We dispatch our log messages through this logger. */
public static Logger log = Logger.getLogger("com.threerings.narya.presents");
/** Convenience function. */
public static void debug (String message)
{
log.fine(message);
}
/** Convenience function. */
public static void info (String message)
{
log.info(message);
}
/** Convenience function. */
public static void warning (String message)
{
log.warning(message);
}
/** Convenience function. */
public static void logStackTrace (Throwable t)
{
log.log(Level.WARNING, t.getMessage(), t);
}
public static Logger log = Logger.getLogger("com.threerings.presents");
}
@@ -51,7 +51,6 @@ import com.threerings.io.ObjectOutputStream;
import com.threerings.io.UnreliableObjectInputStream;
import com.threerings.io.UnreliableObjectOutputStream;
import com.threerings.presents.Log;
import com.threerings.presents.data.AuthCodes;
import com.threerings.presents.dobj.DObjectManager;
import com.threerings.presents.net.AuthRequest;
@@ -65,6 +64,8 @@ import com.threerings.presents.net.Transport;
import com.threerings.presents.net.UpstreamMessage;
import com.threerings.presents.util.DatagramSequencer;
import static com.threerings.presents.Log.log;
/**
* The client performs all network I/O on separate threads (one for reading and one for
* writing). The communicator class encapsulates that functionality.
@@ -193,7 +194,7 @@ public class BlockingCommunicator extends Communicator
*/
protected synchronized void logonSucceeded (AuthResponseData data)
{
Log.debug("Logon succeeded: " + data);
log.debug("Logon succeeded: " + data);
// create our distributed object manager
_omgr = new ClientDObjectMgr(this, _client);
@@ -224,8 +225,7 @@ public class BlockingCommunicator extends Communicator
return;
}
Log.info("Connection failed: " + ioe);
Log.logStackTrace(ioe);
log.info("Connection failed", ioe);
// let the client know that things went south
_client.notifyObservers(Client.CLIENT_CONNECTION_FAILED, ioe);
@@ -245,7 +245,7 @@ public class BlockingCommunicator extends Communicator
return;
}
Log.debug("Connection closed.");
log.debug("Connection closed.");
// now do the whole logoff thing
logoff();
}
@@ -267,7 +267,7 @@ public class BlockingCommunicator extends Communicator
_client.cleanup(_logonError);
}
Log.debug("Reader thread exited.");
log.debug("Reader thread exited.");
}
/**
@@ -277,7 +277,7 @@ public class BlockingCommunicator extends Communicator
{
// clear out our writer reference
_writer = null;
Log.debug("Writer thread exited.");
log.debug("Writer thread exited.");
// let the client observers know that we're logged off
_client.notifyObservers(Client.CLIENT_DID_LOGOFF, null);
@@ -299,12 +299,12 @@ public class BlockingCommunicator extends Communicator
protected void closeChannel ()
{
if (_channel != null) {
Log.debug("Closing socket channel.");
log.debug("Closing socket channel.");
try {
_channel.close();
} catch (IOException ioe) {
Log.warning("Error closing failed socket: " + ioe);
log.warning("Error closing failed socket: " + ioe);
}
_channel = null;
@@ -326,7 +326,7 @@ public class BlockingCommunicator extends Communicator
closeDatagramChannel();
}
Log.debug("Datagram reader thread exited.");
log.debug("Datagram reader thread exited.");
}
/**
@@ -336,7 +336,7 @@ public class BlockingCommunicator extends Communicator
{
// clear out our writer reference
_datagramWriter = null;
Log.debug("Datagram writer thread exited.");
log.debug("Datagram writer thread exited.");
closeDatagramChannel();
}
@@ -350,17 +350,17 @@ public class BlockingCommunicator extends Communicator
try {
_selector.close();
} catch (IOException ioe) {
Log.warning("Error closing selector: " + ioe);
log.warning("Error closing selector: " + ioe);
}
_selector = null;
}
if (_datagramChannel != null) {
Log.debug("Closing datagram socket channel.");
log.debug("Closing datagram socket channel.");
try {
_datagramChannel.close();
} catch (IOException ioe) {
Log.warning("Error closing datagram socket: " + ioe);
log.warning("Error closing datagram socket: " + ioe);
}
_datagramChannel = null;
@@ -377,7 +377,7 @@ public class BlockingCommunicator extends Communicator
throws IOException
{
if (debugLogMessages()) {
Log.info("SEND " + msg);
log.info("SEND " + msg);
}
// first we write the message so that we can measure it's length
@@ -389,11 +389,11 @@ public class BlockingCommunicator extends Communicator
ByteBuffer buffer = _fout.frameAndReturnBuffer();
if (buffer.limit() > 4096) {
String txt = StringUtil.truncate(String.valueOf(msg), 80, "...");
Log.info("Whoa, writin' a big one [msg=" + txt + ", size=" + buffer.limit() + "].");
log.info("Whoa, writin' a big one [msg=" + txt + ", size=" + buffer.limit() + "].");
}
int wrote = _channel.write(buffer);
if (wrote != buffer.limit()) {
Log.warning("Aiya! Couldn't write entire message [msg=" + msg +
log.warning("Aiya! Couldn't write entire message [msg=" + msg +
", size=" + buffer.limit() + ", wrote=" + wrote + "].");
// } else {
// Log.info("Wrote " + wrote + " bytes.");
@@ -425,7 +425,7 @@ public class BlockingCommunicator extends Communicator
ByteBuffer buf = _bout.flip();
int size = buf.remaining();
if (size > Client.MAX_DATAGRAM_SIZE) {
Log.warning("Dropping oversized datagram [size=" + size +
log.warning("Dropping oversized datagram [size=" + size +
", msg=" + msg + "].");
return;
}
@@ -466,7 +466,7 @@ public class BlockingCommunicator extends Communicator
try {
DownstreamMessage msg = (DownstreamMessage)_oin.readObject();
if (debugLogMessages()) {
Log.info("RECEIVE " + msg);
log.info("RECEIVE " + msg);
}
return msg;
@@ -496,7 +496,7 @@ public class BlockingCommunicator extends Communicator
return null; // received out of order
}
if (debugLogMessages()) {
Log.info("DATAGRAM " + msg);
log.info("DATAGRAM " + msg);
}
return msg;
@@ -521,7 +521,7 @@ public class BlockingCommunicator extends Communicator
{
// the default implementation just connects to the first port and does no cycling
int port = _client.getPorts()[0];
Log.info("Connecting [host=" + host + ", port=" + port + "].");
log.info("Connecting [host=" + host + ", port=" + port + "].");
synchronized (BlockingCommunicator.this) {
_channel = SocketChannel.open(new InetSocketAddress(host, port));
}
@@ -554,8 +554,7 @@ public class BlockingCommunicator extends Communicator
logon();
} catch (Exception e) {
Log.debug("Logon failed: " + e);
// Log.logStackTrace(e);
log.debug("Logon failed: " + e);
// once we're shutdown we'll report this error
_logonError = e;
// terminate our communicator thread
@@ -596,10 +595,10 @@ public class BlockingCommunicator extends Communicator
sendMessage(req);
// now wait for the auth response
Log.debug("Waiting for auth response.");
log.debug("Waiting for auth response.");
AuthResponse rsp = (AuthResponse)receiveMessage();
AuthResponseData data = rsp.getData();
Log.debug("Got auth response: " + data);
log.debug("Got auth response: " + data);
// if the auth request failed, we want to let the communicator know by throwing a logon
// exception
@@ -627,7 +626,7 @@ public class BlockingCommunicator extends Communicator
} catch (InterruptedIOException iioe) {
// somebody set up us the bomb! we've been interrupted which means that we're being
// shut down, so we just report it and return from iterate() like a good monkey
Log.debug("Reader thread woken up in time to die.");
log.debug("Reader thread woken up in time to die.");
} catch (EOFException eofe) {
// let the communicator know that our connection was closed
@@ -642,14 +641,13 @@ public class BlockingCommunicator extends Communicator
shutdown();
} catch (Exception e) {
Log.warning("Error processing message [msg=" + msg + ", error=" + e + "].");
log.warning("Error processing message [msg=" + msg + ", error=" + e + "].");
}
}
protected void handleIterateFailure (Exception e)
{
Log.warning("Uncaught exception it reader thread.");
Log.logStackTrace(e);
log.warning("Uncaught exception it reader thread.", e);
}
protected void didShutdown ()
@@ -702,8 +700,7 @@ public class BlockingCommunicator extends Communicator
protected void handleIterateFailure (Exception e)
{
Log.warning("Uncaught exception it writer thread.");
Log.logStackTrace(e);
log.warning("Uncaught exception it writer thread.", e);
}
protected void didShutdown ()
@@ -729,7 +726,7 @@ public class BlockingCommunicator extends Communicator
try {
connect();
} catch (IOException ioe) {
Log.warning("Failed to open datagram channel [error=" + ioe + "].");
log.warning("Failed to open datagram channel [error=" + ioe + "].");
shutdown();
}
}
@@ -749,7 +746,7 @@ public class BlockingCommunicator extends Communicator
try {
_digest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException nsae) {
Log.warning("Missing MD5 algorithm.");
log.warning("Missing MD5 algorithm.");
shutdown();
return;
}
@@ -785,14 +782,14 @@ public class BlockingCommunicator extends Communicator
// check if we managed to establish a connection
if (cport > 0) {
Log.info("Datagram connection established [port=" + cport + "].");
log.info("Datagram connection established [port=" + cport + "].");
// start up the writer thread
_datagramWriter = new DatagramWriter();
_datagramWriter.start();
} else {
Log.info("Failed to establish datagram connection.");
log.info("Failed to establish datagram connection.");
shutdown();
}
}
@@ -835,20 +832,19 @@ public class BlockingCommunicator extends Communicator
} catch (AsynchronousCloseException ace) {
// somebody set up us the bomb! we've been interrupted which means that we're being
// shut down, so we just report it and return from iterate() like a good monkey
Log.debug("Datagram reader thread woken up in time to die.");
log.debug("Datagram reader thread woken up in time to die.");
} catch (IOException ioe) {
Log.warning("Error receiving datagram [error=" + ioe + "].");
log.warning("Error receiving datagram [error=" + ioe + "].");
} catch (Exception e) {
Log.warning("Error processing message [msg=" + msg + ", error=" + e + "].");
log.warning("Error processing message [msg=" + msg + ", error=" + e + "].");
}
}
protected void handleIterateFailure (Exception e)
{
Log.warning("Uncaught exception in datagram reader thread.");
Log.logStackTrace(e);
log.warning("Uncaught exception in datagram reader thread.", e);
}
protected void didShutdown ()
@@ -886,14 +882,13 @@ public class BlockingCommunicator extends Communicator
sendDatagram(msg);
} catch (IOException ioe) {
Log.warning("Error sending datagram [error=" + ioe + "].");
log.warning("Error sending datagram [error=" + ioe + "].");
}
}
protected void handleIterateFailure (Exception e)
{
Log.warning("Uncaught exception in datagram writer thread.");
Log.logStackTrace(e);
log.warning("Uncaught exception in datagram writer thread.", e);
}
protected void didShutdown ()
@@ -32,9 +32,10 @@ import com.samskivert.swing.RuntimeAdjust;
import com.samskivert.util.IntListUtil;
import com.samskivert.util.Interval;
import com.threerings.presents.Log;
import com.threerings.presents.data.AuthCodes;
import static com.threerings.presents.Log.log;
/**
* Customizes the blocking communicator with some things that we only do on users' machines (where
* there's only one client running, not potentially dozens, and where we're not sending high
@@ -78,7 +79,7 @@ public class ClientCommunicator extends BlockingCommunicator
for (int ii = 0; ii < ports.length; ii++) {
int port = ports[(ii+ppidx)%ports.length];
int nextPort = ports[(ii+ppidx+1)%ports.length];
Log.info("Connecting [host=" + host + ", port=" + port + "].");
log.info("Connecting [host=" + host + ", port=" + port + "].");
InetSocketAddress addr = new InetSocketAddress(host, port);
try {
synchronized (this) {
@@ -35,10 +35,11 @@ import com.samskivert.util.StringUtil;
import com.samskivert.util.IntMap;
import com.samskivert.util.Interval;
import com.threerings.presents.Log;
import com.threerings.presents.dobj.*;
import com.threerings.presents.net.*;
import static com.threerings.presents.Log.log;
/**
* The client distributed object manager manages a set of proxy objects which mirror the
* distributed objects maintained on the server. Requests for modifications, etc. are forwarded to
@@ -165,7 +166,7 @@ public class ClientDObjectMgr
} else if (obj instanceof UnsubscribeResponse) {
int oid = ((UnsubscribeResponse)obj).getOid();
if (_dead.remove(oid) == null) {
Log.warning("Received unsub ACK from unknown object [oid=" + oid + "].");
log.warning("Received unsub ACK from unknown object [oid=" + oid + "].");
}
} else if (obj instanceof FailureResponse) {
@@ -221,7 +222,7 @@ public class ClientDObjectMgr
DObject target = _ocache.get(remoteOid);
if (target == null) {
if (!_dead.containsKey(remoteOid)) {
Log.warning("Unable to dispatch event on non-proxied object " + event + ".");
log.warning("Unable to dispatch event on non-proxied object " + event + ".");
}
return;
}
@@ -277,8 +278,7 @@ public class ClientDObjectMgr
}
} catch (Exception e) {
Log.warning("Failure processing event [event=" + event + ", target=" + target + "].");
Log.logStackTrace(e);
log.warning("Failure processing event", "event", event, "target", target, e);
}
}
@@ -298,7 +298,7 @@ public class ClientDObjectMgr
// let the penders know that the object is available
PendingRequest<?> req = _penders.remove(obj.getOid());
if (req == null) {
Log.warning("Got object, but no one cares?! [oid=" + obj.getOid() +
log.warning("Got object, but no one cares?! [oid=" + obj.getOid() +
", obj=" + obj + "].");
return;
}
@@ -321,7 +321,7 @@ public class ClientDObjectMgr
// let the penders know that the object is not available
PendingRequest<?> req = _penders.remove(oid);
if (req == null) {
Log.warning("Failed to get object, but no one cares?! [oid=" + oid + "].");
log.warning("Failed to get object, but no one cares?! [oid=" + oid + "].");
return;
}
@@ -383,7 +383,7 @@ public class ClientDObjectMgr
dobj.removeSubscriber(target);
} else {
Log.info("Requested to remove subscriber from non-proxied object [oid=" + oid +
log.info("Requested to remove subscriber from non-proxied object [oid=" + oid +
", sub=" + target + "].");
}
}
@@ -505,9 +505,9 @@ public class ClientDObjectMgr
/** A debug hook that allows the dumping of all objects in the object table out to the log. */
protected DebugChords.Hook DUMP_OTABLE_HOOK = new DebugChords.Hook() {
public void invoke () {
Log.info("Dumping " + _ocache.size() + " objects:");
log.info("Dumping " + _ocache.size() + " objects:");
for (DObject obj : _ocache.values()) {
Log.info(obj.getClass().getName() + " " + obj);
log.info(obj.getClass().getName() + " " + obj);
}
}
};
@@ -23,10 +23,11 @@ package com.threerings.presents.client;
import java.util.Arrays;
import com.threerings.presents.Log;
import com.threerings.presents.net.PingRequest;
import com.threerings.presents.net.PongResponse;
import static com.threerings.presents.Log.log;
/**
* Used to compute the client/server time delta, attempting to account for
* the network delay experienced when the server sends its current time to
@@ -95,7 +96,7 @@ public class DeltaCalculator
// minus the server's send time (plus network delay): dT = C - S
_deltas[_iter] = recv - (server + nettime);
Log.debug("Calculated delta [delay=" + delay +
log.debug("Calculated delta [delay=" + delay +
", nettime=" + nettime + ", delta=" + _deltas[_iter] +
", rtt=" + (recv-send) + "].");
@@ -22,7 +22,8 @@
package com.threerings.presents.client;
import com.samskivert.util.StringUtil;
import com.threerings.presents.Log;
import static com.threerings.presents.Log.log;
/**
* Provides the basic functionality used to dispatch invocation
@@ -45,7 +46,7 @@ public abstract class InvocationDecoder
*/
public void dispatchNotification (int methodId, Object[] args)
{
Log.warning("Requested to dispatch unknown method " +
log.warning("Requested to dispatch unknown method " +
"[receiver=" + receiver + ", methodId=" + methodId +
", args=" + StringUtil.toString(args) + "].");
}
@@ -27,7 +27,6 @@ import java.util.Iterator;
import com.samskivert.util.HashIntMap;
import com.samskivert.util.StringUtil;
import com.threerings.presents.Log;
import com.threerings.presents.client.InvocationReceiver.Registration;
import com.threerings.presents.data.ClientObject;
@@ -47,6 +46,8 @@ import com.threerings.presents.dobj.Subscriber;
import com.threerings.presents.net.Transport;
import static com.threerings.presents.Log.log;
/**
* Handles the client side management of the invocation services.
*/
@@ -67,7 +68,7 @@ public class InvocationDirector
{
// sanity check
if (_clobj != null) {
Log.warning("Zoiks, client object around during invmgr init!");
log.warning("Zoiks, client object around during invmgr init!");
cleanup();
}
@@ -97,7 +98,7 @@ public class InvocationDirector
public void requestFailed (int oid, ObjectAccessException cause) {
// aiya! we were unable to subscribe to the client object. we're hosed!
Log.warning("Invocation director unable to subscribe to client object " +
log.warning("Invocation director unable to subscribe to client object " +
"[cloid=" + cloid + ", cause=" + cause + "]!");
_client.getClientObjectFailed(cause);
}
@@ -151,7 +152,7 @@ public class InvocationDirector
if (_clobj != null) {
Registration rreg = _clobj.receivers.get(receiverCode);
if (rreg == null) {
Log.warning("Receiver unregistered for which we have no id to code mapping " +
log.warning("Receiver unregistered for which we have no id to code mapping " +
"[code=" + receiverCode + "].");
} else {
Object decoder = _receivers.remove(rreg.receiverId);
@@ -209,7 +210,7 @@ public class InvocationDirector
int invOid, int invCode, int methodId, Object[] args, Transport transport)
{
if (_clobj == null) {
Log.warning("Dropping invocation request on shutdown director [code=" + invCode +
log.warning("Dropping invocation request on shutdown director [code=" + invCode +
", methodId=" + methodId + "].");
return;
}
@@ -273,7 +274,7 @@ public class InvocationDirector
// look up the invocation marshaller registered for that response
ListenerMarshaller listener = _listeners.remove(reqId);
if (listener == null) {
Log.warning("Received invocation response for which we have no registered listener " +
log.warning("Received invocation response for which we have no registered listener " +
"[reqId=" + reqId + ", methId=" + methodId + ", args=" +
StringUtil.toString(args) + "]. It is possible that this listener was " +
"flushed because the response did not arrive within " +
@@ -288,9 +289,8 @@ public class InvocationDirector
try {
listener.dispatchResponse(methodId, args);
} catch (Throwable t) {
Log.warning("Invocation response listener choked [listener=" + listener +
", methId=" + methodId + ", args=" + StringUtil.toString(args) + "].");
Log.logStackTrace(t);
log.warning("Invocation response listener choked [listener=" + listener +
", methId=" + methodId + ", args=" + StringUtil.toString(args) + "].", t);
}
// flush expired listeners periodically
@@ -309,7 +309,7 @@ public class InvocationDirector
// look up the decoder registered for this receiver
InvocationDecoder decoder = _receivers.get(receiverId);
if (decoder == null) {
Log.warning("Received notification for which we have no registered receiver " +
log.warning("Received notification for which we have no registered receiver " +
"[recvId=" + receiverId + ", methodId=" + methodId +
", args=" + StringUtil.toString(args) + "].");
return;
@@ -321,9 +321,8 @@ public class InvocationDirector
try {
decoder.dispatchNotification(methodId, args);
} catch (Throwable t) {
Log.warning("Invocation notification receiver choked [receiver=" + decoder.receiver +
", methId=" + methodId + ", args=" + StringUtil.toString(args) + "].");
Log.logStackTrace(t);
log.warning("Invocation notification receiver choked [receiver=" + decoder.receiver +
", methId=" + methodId + ", args=" + StringUtil.toString(args) + "].", t);
}
}
@@ -362,7 +361,7 @@ public class InvocationDirector
}
public void requestFailed (int oid, ObjectAccessException cause) {
Log.warning("Aiya! Unable to subscribe to changed client object [cloid=" + oid +
log.warning("Aiya! Unable to subscribe to changed client object [cloid=" + oid +
", cause=" + cause + "].");
}
});
@@ -25,8 +25,6 @@ import com.samskivert.util.StringUtil;
import com.threerings.io.Streamable;
import com.threerings.presents.Log;
import com.threerings.presents.client.Client;
import com.threerings.presents.client.InvocationService.ConfirmListener;
import com.threerings.presents.client.InvocationService.ResultListener;
@@ -37,6 +35,8 @@ import com.threerings.presents.dobj.InvocationResponseEvent;
import com.threerings.presents.net.Transport;
import static com.threerings.presents.Log.log;
/**
* Provides a base from which all invocation service marshallers extend. Handles functionality
* common to all marshallers.
@@ -110,7 +110,7 @@ public class InvocationMarshaller
listener.requestFailed((String)args[0]);
} else {
Log.warning("Requested to dispatch unknown invocation response " +
log.warning("Requested to dispatch unknown invocation response " +
"[listener=" + listener + ", methodId=" + methodId +
", args=" + StringUtil.toString(args) + "].");
}
@@ -130,7 +130,7 @@ public class InvocationMarshaller
throws Throwable
{
if (_invId != null && getClass() != ListenerMarshaller.class) {
Log.warning("Invocation listener never responded to: " + _invId);
log.warning("Invocation listener never responded to: " + _invId);
}
super.finalize();
}
@@ -36,9 +36,10 @@ import com.samskivert.util.StringUtil;
import com.threerings.io.Streamable;
import com.threerings.util.TrackedObject;
import com.threerings.presents.Log;
import com.threerings.presents.net.Transport;
import static com.threerings.presents.Log.log;
/**
* The distributed object forms the foundation of the Presents system. All information shared among
* users of the system is done via distributed objects. A distributed object has a set of
@@ -164,8 +165,8 @@ public class DObject
_scount++;
} else {
Log.warning("Refusing subscriber that's already in the list [dobj=" + which() +
", subscriber=" + sub + "]");
log.warning("Refusing subscriber that's already in the list", "dobj", which(),
"subscriber", sub);
Thread.dumpStack();
}
}
@@ -225,7 +226,7 @@ public class DObject
if (els != null) {
_listeners = els;
} else {
Log.warning("Refusing repeat listener registration [dobj=" + which() +
log.warning("Refusing repeat listener registration [dobj=" + which() +
", list=" + listener + "]");
Thread.dumpStack();
}
@@ -357,7 +358,7 @@ public class DObject
// clear the lock from the list
if (ListUtil.clear(_locks, name) == null) {
// complain if we didn't find the lock
Log.info("Unable to clear non-existent lock [lock=" + name + ", dobj=" + this + "].");
log.info("Unable to clear non-existent lock [lock=" + name + ", dobj=" + this + "].");
}
}
@@ -438,9 +439,8 @@ public class DObject
}
} catch (Exception e) {
Log.warning("Listener choked during notification [list=" + listener +
", event=" + event + "].");
Log.logStackTrace(e);
log.warning("Listener choked during notification [list=" + listener +
", event=" + event + "].", e);
}
}
}
@@ -464,9 +464,7 @@ public class DObject
((ProxySubscriber)sub).eventReceived(event);
}
} catch (Exception e) {
Log.warning("Proxy choked during notification [sub=" + sub +
", event=" + event + "].");
Log.logStackTrace(e);
log.warning("Proxy choked during notification", "sub", sub, "event", event, e);
}
}
}
@@ -555,7 +553,7 @@ public class DObject
_omgr.postEvent(event);
} else {
Log.info("Dropping event for non- or no longer managed object [oid=" + getOid() +
log.info("Dropping event for non- or no longer managed object [oid=" + getOid() +
", class=" + getClass().getName() + ", event=" + event + "].");
}
}
@@ -734,7 +732,7 @@ public class DObject
{
// sanity check
if (_tcount != 0) {
Log.warning("Transaction cleared with non-zero nesting count [dobj=" + this + "].");
log.warning("Transaction cleared with non-zero nesting count", "dobj", this);
_tcount = 0;
}
@@ -827,7 +825,7 @@ public class DObject
if (_omgr != null && _omgr.isManager(this)) {
oldEntry = set.removeKey(key);
if (oldEntry == null) {
Log.warning("Requested to remove non-element [set=" + name + ", key=" + key + "].");
log.warning("Requested to remove non-element", "set", name, "key", key);
Thread.dumpStack();
}
}
@@ -34,7 +34,7 @@ import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.Streamable;
import com.threerings.presents.Log;
import static com.threerings.presents.Log.log;
/**
* The distributed set class provides a means by which an unordered set of objects can be
@@ -199,7 +199,7 @@ public class DSet<E extends DSet.Entry>
// the crazy sanity checks
if (_size < 0 ||_size > _entries.length ||
(_size > 0 && _entries[_size-1] == null)) {
Log.warning("DSet in a bad way [size=" + _size +
log.warning("DSet in a bad way [size=" + _size +
", entries=" + StringUtil.toString(_entries) + "].");
Thread.dumpStack();
}
@@ -221,7 +221,7 @@ public class DSet<E extends DSet.Entry>
throw new ConcurrentModificationException();
}
if (_ssize != _size) {
Log.warning("Size changed during iteration [ssize=" + _ssize +
log.warning("Size changed during iteration [ssize=" + _ssize +
", nsize=" + _size +
", entsries=" + StringUtil.toString(_entries) + "].");
Thread.dumpStack();
@@ -273,7 +273,7 @@ public class DSet<E extends DSet.Entry>
// if the element is already in the set, bail now
if (eidx >= 0) {
Log.warning("Refusing to add duplicate entry [entry=" + elem + ", set=" + this + "].");
log.warning("Refusing to add duplicate entry [entry=" + elem + ", set=" + this + "].");
return false;
}
@@ -285,7 +285,7 @@ public class DSet<E extends DSet.Entry>
if (_size >= elength) {
// sanity check
if (elength > 2048) {
Log.warning("Requested to expand to questionably large size [l=" + elength + "].");
log.warning("Requested to expand to questionably large size [l=" + elength + "].");
Thread.dumpStack();
}
@@ -331,7 +331,7 @@ public class DSet<E extends DSet.Entry>
{
// don't fail, but generate a warning if we're passed a null key
if (key == null) {
Log.warning("Requested to remove null key.");
log.warning("Requested to remove null key.");
Thread.dumpStack();
return null;
}
@@ -24,7 +24,6 @@ package com.threerings.presents.dobj;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.logging.Level;
import com.samskivert.util.MethodFinder;
import com.samskivert.util.StringUtil;
@@ -110,7 +109,7 @@ public class DynamicListener
try {
method.invoke(_target, arguments);
} catch (Exception e) {
log.log(Level.WARNING, "Failed to dispatch event callback " +
log.warning("Failed to dispatch event callback " +
name + "(" + StringUtil.toString(arguments) + ").", e);
}
}
@@ -23,7 +23,7 @@ package com.threerings.presents.dobj;
import com.samskivert.util.StringUtil;
import com.threerings.presents.Log;
import static com.threerings.presents.Log.log;
/**
* An entry added event is dispatched when an entry is added to a {@link DSet} attribute of a
@@ -21,7 +21,7 @@
package com.threerings.presents.dobj;
import com.threerings.presents.Log;
import static com.threerings.presents.Log.log;
/**
* An entry removed event is dispatched when an entry is removed from a {@link DSet} attribute of a
@@ -88,7 +88,7 @@ public class EntryRemovedEvent<T extends DSet.Entry> extends NamedEvent
_oldEntry = set.removeKey(_key);
if (_oldEntry == null) {
// complain if there was actually nothing there
Log.warning("No matching entry to remove [key=" + _key + ", set=" + set + "].");
log.warning("No matching entry to remove [key=" + _key + ", set=" + set + "].");
return false;
}
}
@@ -23,10 +23,10 @@ package com.threerings.presents.dobj;
import com.samskivert.util.StringUtil;
import com.threerings.presents.Log;
import com.threerings.presents.net.Transport;
import static com.threerings.presents.Log.log;
/**
* An entry updated event is dispatched when an entry of a {@link DSet} is updated. It can also be
* constructed to request the update of an entry and posted to the dobjmgr.
@@ -107,7 +107,7 @@ public class EntryUpdatedEvent<T extends DSet.Entry> extends NamedEvent
_oldEntry = set.update(_entry);
if (_oldEntry == null) {
// complain if we didn't update anything
Log.warning("No matching entry to update [entry=" + this + ", set=" + set + "].");
log.warning("No matching entry to update [entry=" + this + ", set=" + set + "].");
return false;
}
}
@@ -26,7 +26,7 @@ import java.io.IOException;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.presents.Log;
import static com.threerings.presents.Log.log;
public class PongResponse extends DownstreamMessage
{
@@ -90,7 +90,7 @@ public class PongResponse extends DownstreamMessage
// the time spent between unpacking the ping and packing the pong
// is the processing delay
if (_pingStamp == 0L) {
Log.warning("Pong response written that was not constructed " +
log.warning("Pong response written that was not constructed " +
"with a valid ping stamp [rsp=" + this + "].");
_processDelay = 0;
} else {
@@ -31,7 +31,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import com.samskivert.jdbc.RepositoryUnit;
import com.samskivert.jdbc.WriteOnlyUnit;
@@ -162,7 +161,7 @@ public class PeerManager
try {
execute();
} catch (Throwable t) {
log.log(Level.WARNING, getClass().getName() + " failed.");
log.warning(getClass().getName() + " failed.");
}
}
@@ -335,7 +334,7 @@ public class PeerManager
oout.writeObject(action);
actionBytes = bout.toByteArray();
} catch (Exception e) {
log.log(Level.WARNING, "Failed to serialize node action [action=" + action + "].", e);
log.warning("Failed to serialize node action [action=" + action + "].", e);
return;
}
@@ -603,7 +602,7 @@ public class PeerManager
}
}
public void requestFailed (Exception cause) {
log.log(Level.WARNING, "Lock acquisition failed [lock=" + lock + "].", cause);
log.warning("Lock acquisition failed [lock=" + lock + "].", cause);
operation.fail(null);
}
});
@@ -731,7 +730,7 @@ public class PeerManager
action = (NodeAction)oin.readObject();
action.invoke();
} catch (Exception e) {
log.log(Level.WARNING, "Failed to execute node action [from=" + caller.who() +
log.warning("Failed to execute node action [from=" + caller.who() +
", action=" + action + ", serializedSize=" + serializedAction.length + "].");
}
}
@@ -807,7 +806,7 @@ public class PeerManager
try {
refreshPeer(record);
} catch (Exception e) {
log.log(Level.WARNING, "Failure refreshing peer " + record + ".", e);
log.warning("Failure refreshing peer " + record + ".", e);
}
}
}
@@ -119,7 +119,7 @@ public class PeerNode
// if our client hasn't updated its record since we last tried to logon, then just
// chill
if ((_lastConnectStamp - _record.lastUpdated.getTime()) > STALE_INTERVAL) {
log.fine("Not reconnecting to stale client [record=" + _record +
log.debug("Not reconnecting to stale client [record=" + _record +
", lastTry=" + new Date(_lastConnectStamp) + "].");
return;
}
@@ -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);
}
}
@@ -27,7 +27,7 @@ import java.util.HashMap;
import com.samskivert.util.MethodFinder;
import com.samskivert.util.StringUtil;
import com.threerings.presents.Log;
import static com.threerings.presents.Log.log;
/**
* Class related utility functions.
@@ -80,11 +80,11 @@ public class ClassUtil
} catch (NoSuchMethodException nsme) {
// nothing to do here but fall through and return null
Log.info("No such method [name=" + name + ", tclass=" + tclass.getName() +
log.info("No such method [name=" + name + ", tclass=" + tclass.getName() +
", args=" + StringUtil.toString(args) + ", error=" + nsme + "].");
} catch (SecurityException se) {
Log.warning("Unable to look up method? [tclass=" + tclass.getName() +
log.warning("Unable to look up method? [tclass=" + tclass.getName() +
", mname=" + name + "].");
}
@@ -23,11 +23,12 @@ package com.threerings.presents.util;
import com.samskivert.util.ResultListener;
import com.threerings.presents.Log;
import com.threerings.presents.client.InvocationService;
import com.threerings.presents.data.InvocationCodes;
import com.threerings.presents.server.InvocationException;
import static com.threerings.presents.Log.log;
/**
* Adapts the response from a {@link ResultListener} to a {@link ConfirmListener} wherein the
* result is ignored. If the failure is an instance fo {@link InvocationException} the message will
@@ -56,7 +57,7 @@ public class IgnoreConfirmAdapter<T> implements ResultListener<T>
if (cause instanceof InvocationException) {
_listener.requestFailed(cause.getMessage());
} else {
Log.logStackTrace(cause);
log.warning(cause);
_listener.requestFailed(InvocationCodes.INTERNAL_ERROR);
}
}
@@ -21,8 +21,6 @@
package com.threerings.presents.util;
import java.util.logging.Level;
import com.samskivert.util.Invoker;
import com.threerings.presents.client.InvocationService;
@@ -73,7 +71,7 @@ public abstract class PersistingUnit extends Invoker.Unit
if (error instanceof InvocationException) {
_listener.requestFailed(error.getMessage());
} else {
log.log(Level.WARNING, getFailureMessage(), error);
log.warning(getFailureMessage(), error);
_listener.requestFailed(InvocationCodes.INTERNAL_ERROR);
}
}
@@ -23,11 +23,12 @@ package com.threerings.presents.util;
import com.samskivert.util.ResultListener;
import com.threerings.presents.Log;
import com.threerings.presents.client.InvocationService;
import com.threerings.presents.data.InvocationCodes;
import com.threerings.presents.server.InvocationException;
import static com.threerings.presents.Log.log;
/**
* Adapts the response from a {@link ResultListener} to an InvocationService.ResultListener if the
* failure is an instance of {@link InvocationException} the message will be passed on to the
@@ -55,7 +56,7 @@ public class ResultAdapter<T> implements ResultListener<T>
if (cause instanceof InvocationException) {
_listener.requestFailed(cause.getMessage());
} else {
Log.logStackTrace(cause);
log.warning(cause);
_listener.requestFailed(InvocationCodes.INTERNAL_ERROR);
}
}
@@ -23,12 +23,13 @@ package com.threerings.presents.util;
import com.samskivert.util.StringUtil;
import com.threerings.presents.Log;
import com.threerings.presents.dobj.DObject;
import com.threerings.presents.dobj.DObjectManager;
import com.threerings.presents.dobj.ObjectAccessException;
import com.threerings.presents.dobj.Subscriber;
import static com.threerings.presents.Log.log;
/**
* A class that safely handles the asynchronous subscription to a
* distributed object when it is not know if the subscription will
@@ -73,7 +74,7 @@ public class SafeSubscriber<T extends DObject>
public void subscribe (DObjectManager omgr)
{
if (_active) {
Log.warning("Active safesub asked to resubscribe " + this + ".");
log.warning("Active safesub asked to resubscribe " + this + ".");
Thread.dumpStack();
return;
}
@@ -84,7 +85,7 @@ public class SafeSubscriber<T extends DObject>
// make sure we dont have an object reference (which should be
// logically impossible)
if (_object != null) {
Log.warning("Incroyable! A safesub has an object and was " +
log.warning("Incroyable! A safesub has an object and was " +
"non-active!? " + this + ".");
Thread.dumpStack();
// make do in the face of insanity
@@ -122,7 +123,7 @@ public class SafeSubscriber<T extends DObject>
if (_object == null && !_pending) {
return;
}
Log.warning("Inactive safesub asked to unsubscribe " + this + ".");
log.warning("Inactive safesub asked to unsubscribe " + this + ".");
Thread.dumpStack();
}
@@ -132,7 +133,7 @@ public class SafeSubscriber<T extends DObject>
if (_pending) {
// make sure we don't have an object reference
if (_object != null) {
Log.warning("Incroyable! A safesub has an object and is " +
log.warning("Incroyable! A safesub has an object and is " +
"pending!? " + this + ".");
Thread.dumpStack();
} else {
@@ -144,7 +145,7 @@ public class SafeSubscriber<T extends DObject>
// make sure we have our object
if (_object == null) {
Log.warning("Zut alors! A safesub _was_ active and not " +
log.warning("Zut alors! A safesub _was_ active and not " +
"pending yet has no object!? " + this + ".");
Thread.dumpStack();
// nothing to do since we're apparently already unsubscribed
@@ -161,13 +162,13 @@ public class SafeSubscriber<T extends DObject>
{
// make sure life is not too cruel
if (_object != null) {
Log.warning("Madre de dios! Our object came available but " +
log.warning("Madre de dios! Our object came available but " +
"we've already got one!? " + this);
// go ahead and pitch the old one, God knows what's going on
_object = null;
}
if (!_pending) {
Log.warning("J.C. on a pogo stick! Our object came available " +
log.warning("J.C. on a pogo stick! Our object came available " +
"but we're not pending!? " + this);
// go with our badselves, it's the only way
}
@@ -197,7 +198,7 @@ public class SafeSubscriber<T extends DObject>
{
// do the right thing with our pending state
if (!_pending) {
Log.warning("Criminy creole! Our subscribe failed but we're " +
log.warning("Criminy creole! Our subscribe failed but we're " +
"not pending!? " + this);
// go with our badselves, it's the only way
}