Permalink
Browse files

Cleaning up logging. Checking to make sure clients either read or write.

  • Loading branch information...
Anand Kesari
Anand Kesari committed Jan 27, 2011
1 parent cc2e6af commit 65a0cb2a3be2f5af96f5bf02f7ba91c50c15158b
@@ -129,7 +129,6 @@ public IOChannel createIOChannel(Socket socket) throws IOException {
// send an event into the cluster via adapter.
private void injectEvent(EventWrapper e) {
for (EventHandler handler : handlers) {
- logger.info("injecting event");
handler.processEvent(e);
}
}
@@ -160,7 +159,6 @@ public int getQueueSize() {
@Override
public void queueWork(EventWrapper e) {
- logger.info("queueing work: " + e);
queue.offer(e);
}
@@ -239,8 +237,6 @@ public void run() {
EventWrapper event = queue.take();
byte[] b = bytesFromEventWrapper(event);
- logger.info("dequeued: " + event);
-
// Responses need special handling.
if (event.getEvent() instanceof Response) {
dispatchResponse(event, b);
@@ -263,7 +259,6 @@ private void dispatchToAllClients(byte[] b) {
for (ClientConnection c : clients.values()) {
if (c.good() && c.clientReadMode.takePublic()) {
try {
- logger.debug("sending to client " + c.uuid);
c.io.send(b);
} catch (IOException e) {
@@ -295,7 +290,6 @@ private void dispatchResponse(EventWrapper event, byte[] b) {
if (c != null && c.good() && c.clientReadMode.takePrivate()) {
try {
- logger.debug("sending response to client " + c.uuid);
c.io.send(b);
} catch (IOException e) {
@@ -105,9 +105,9 @@ private ClientConnection clientConnect(byte[] v, ByteArrayIOChannel io,
logger.error("error creating response during connect.", e);
return null;
}
-
+
io.send(message.getBytes());
-
+
return conn;
}
@@ -149,6 +149,15 @@ private ClientConnection clientConnectCreate(byte[] v,
logger.info(u + " read=" + rmode + " write=" + wmode);
+ if (rmode == ClientStub.ClientReadMode.None
+ && wmode == ClientStub.ClientWriteMode.Disabled) {
+ // client cannot disable read AND write...
+ logger.error("client neither reads nor writes.");
+ reason.add("read and write disabled");
+
+ return null;
+ }
+
return clientStub.new ClientConnection(sock, u, rmode, wmode);
} catch (JSONException e) {
@@ -17,6 +17,10 @@
<level value="info"/>
<appender-ref ref="R"/>
</logger>
+ <logger name="adapter" additivity="false">
+ <level value="info"/>
+ <appender-ref ref="R"/>
+ </logger>
<logger name="monitor">
<level value="info"/>
<appender-ref ref="S"/>

0 comments on commit 65a0cb2

Please sign in to comment.