Varargified log calls.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5697 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2009-03-26 00:02:19 +00:00
parent 647a25dfdc
commit 688f2580ed
46 changed files with 231 additions and 272 deletions
@@ -380,12 +380,12 @@ 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 +
", size=" + buffer.limit() + ", wrote=" + wrote + "].");
log.warning("Aiya! Couldn't write entire message", "msg", msg,
"size", buffer.limit(), "wrote", wrote);
// } else {
// Log.info("Wrote " + wrote + " bytes.");
}
@@ -416,8 +416,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 +
", msg=" + msg + "].");
log.warning("Dropping oversized datagram", "size", size, "msg", msg);
return;
}
@@ -496,7 +495,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));
}
@@ -709,7 +708,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();
}
}
@@ -765,7 +764,7 @@ 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();
@@ -819,10 +818,10 @@ public class BlockingCommunicator extends Communicator
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);
}
}
@@ -875,7 +874,7 @@ public class BlockingCommunicator extends Communicator
sendDatagram(msg);
} catch (IOException ioe) {
log.warning("Error sending datagram [error=" + ioe + "].");
log.warning("Error sending datagram", "error", ioe);
}
}
@@ -81,7 +81,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) {
@@ -195,7 +195,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) {
@@ -339,8 +339,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() +
", obj=" + obj + "].");
log.warning("Got object, but no one cares?!", "oid", obj.getOid(), "obj", obj);
return;
}
@@ -362,7 +361,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;
}
@@ -424,8 +423,8 @@ public class ClientDObjectMgr
dobj.removeSubscriber(target);
} else {
log.info("Requested to remove subscriber from non-proxied object [oid=" + oid +
", sub=" + target + "].");
log.info("Requested to remove subscriber from non-proxied object", "oid", oid,
"sub", target);
}
}
@@ -96,9 +96,8 @@ 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 +
", nettime=" + nettime + ", delta=" + _deltas[_iter] +
", rtt=" + (recv-send) + "].");
log.debug("Calculated delta", "delay", delay, "nettime", nettime, "delta", _deltas[_iter],
"rtt", (recv-send));
return (++_iter >= CLOCK_SYNC_PING_COUNT);
}
@@ -94,8 +94,8 @@ 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 " +
"[cloid=" + cloid + ", cause=" + cause + "]!");
log.warning("Invocation director unable to subscribe to client object",
"cloid", cloid, "cause", cause + "]!");
_client.getClientObjectFailed(cause);
}
});
@@ -148,8 +148,8 @@ 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 " +
"[code=" + receiverCode + "].");
log.warning("Receiver unregistered for which we have no id to code mapping",
"code", receiverCode);
} else {
// Object decoder = _receivers.remove(rreg.receiverId);
// Log.info("Cleared receiver " + StringUtil.shortClassName(decoder) +
@@ -206,8 +206,8 @@ 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 +
", methodId=" + methodId + "].");
log.warning("Dropping invocation request on shutdown director", "code", invCode,
"methodId", methodId);
return;
}
@@ -270,23 +270,22 @@ 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 " +
"[reqId=" + reqId + ", methId=" + methodId + ", args=" +
StringUtil.toString(args) + "]. It is possible that this listener was " +
"flushed because the response did not arrive within " +
LISTENER_MAX_AGE + " milliseconds.");
log.warning("Received invocation response for which we have no registered listener. " +
"It is possible that this listener was flushed because the response did " +
"not arrive within " + LISTENER_MAX_AGE + " milliseconds.",
"reqId", reqId, "methId", methodId, "args", args);
return;
}
// Log.info("Dispatching invocation response [listener=" + listener +
// ", methId=" + methodId + ", args=" + StringUtil.toString(args) + "].");
// log.info("Dispatching invocation response", "listener", listener,
// "methId", methodId, "args", args);
// dispatch the response
try {
listener.dispatchResponse(methodId, args);
} catch (Throwable t) {
log.warning("Invocation response listener choked [listener=" + listener +
", methId=" + methodId + ", args=" + StringUtil.toString(args) + "].", t);
log.warning("Invocation response listener choked", "listener", listener,
"methId", methodId, "args", args, t);
}
// flush expired listeners periodically
@@ -305,20 +304,19 @@ 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 " +
"[recvId=" + receiverId + ", methodId=" + methodId +
", args=" + StringUtil.toString(args) + "].");
log.warning("Received notification for which we have no registered receiver",
"recvId", receiverId, "methodId", methodId, "args", args);
return;
}
// Log.info("Dispatching invocation notification [receiver=" + decoder.receiver +
// ", methodId=" + methodId + ", args=" + StringUtil.toString(args) + "].");
// log.info("Dispatching invocation notification", "receiver", decoder.receiver,
// "methodId", methodId, "args", args);
try {
decoder.dispatchNotification(methodId, args);
} catch (Throwable t) {
log.warning("Invocation notification receiver choked [receiver=" + decoder.receiver +
", methId=" + methodId + ", args=" + StringUtil.toString(args) + "].", t);
log.warning("Invocation notification receiver choked", "receiver", decoder.receiver,
"methId", methodId, "args", args, t);
}
}
@@ -357,8 +355,8 @@ public class InvocationDirector
}
public void requestFailed (int oid, ObjectAccessException cause) {
log.warning("Aiya! Unable to subscribe to changed client object [cloid=" + oid +
", cause=" + cause + "].");
log.warning("Aiya! Unable to subscribe to changed client object", "cloid", oid,
"cause", cause);
}
});
}