*/
package org.apache.thrift;
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.net.InetSocketAddress;
*
*/
public class TNonblockingMultiFetchClient {
- private static final Logger LOG = Logger.getLogger(
- TNonblockingMultiFetchClient.class);
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(
+ TNonblockingMultiFetchClient.class.getName()
+ );
// if the size of the response msg exceeds this limit (in byte), we will
// not read the msg
} catch(InterruptedException ie) {
// attempt to cancel execution of the task.
task.cancel(true);
- LOG.error("interrupted during fetch: "+ie.toString());
+ LOGGER.error("interrupted during fetch: "+ie.toString());
} catch(ExecutionException ee) {
// attempt to cancel execution of the task.
task.cancel(true);
- LOG.error("exception during fetch: "+ee.toString());
+ LOGGER.error("exception during fetch: "+ee.toString());
} catch(TimeoutException te) {
// attempt to cancel execution of the task.
task.cancel(true);
- LOG.error("timeout for fetch: "+te.toString());
+ LOGGER.error("timeout for fetch: "+te.toString());
}
executor.shutdownNow();
try {
selector = Selector.open();
} catch (IOException e) {
- LOG.error("selector opens error: "+e.toString());
+ LOGGER.error("selector opens error: "+e.toString());
return;
}
stats.incNumConnectErrorServers();
String err = String.format("set up socket to server %s error: %s",
server.toString(), e.toString());
- LOG.error(err);
+ LOGGER.error(err);
// free resource
if (s != null) {
try {s.close();} catch (Exception ex) {}
try{
selector.select();
} catch (Exception e) {
- LOG.error("selector selects error: "+e.toString());
+ LOGGER.error("selector selects error: "+e.toString());
continue;
}
String err = String.format("socket %d connects to server %s " +
"error: %s",
index, servers.get(index).toString(), e.toString());
- LOG.error(err);
+ LOGGER.error(err);
}
}
String err = String.format("socket %d writes to server %s " +
"error: %s",
index, servers.get(index).toString(), e.toString());
- LOG.error(err);
+ LOGGER.error(err);
}
}
}
String err = String.format("Read an invalid frame size %d"
+ " from %s. Does the server use TFramedTransport? ",
frameSize[index], servers.get(index).toString());
- LOG.error(err);
+ LOGGER.error(err);
sChannel.close();
continue;
}
+ " total buffer size would exceed limit %d",
frameSize[index], servers.get(index).toString(),
maxRecvBufBytesPerServer);
- LOG.error(err);
+ LOGGER.error(err);
sChannel.close();
continue;
}
String err = String.format("socket %d reads from server %s " +
"error: %s",
index, servers.get(index).toString(), e.toString());
- LOG.error(err);
+ LOGGER.error(err);
}
}
}
selector.close();
}
} catch (IOException e) {
- LOG.error("free resource error: "+e.toString());
+ LOGGER.error("free resource error: "+e.toString());
}
}
}