From: Bryan Duxbury Date: Mon, 11 Oct 2010 22:13:23 +0000 (+0000) Subject: spacing cleanup X-Git-Tag: 0.6.0~80 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=21cd3180ef915ec8f1a2fa33520bcb529e5a1c41;p=common%2Fthrift.git spacing cleanup git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1021535 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/java/src/org/apache/thrift/async/TAsyncClientManager.java b/lib/java/src/org/apache/thrift/async/TAsyncClientManager.java index 05ab452b..b28c3125 100644 --- a/lib/java/src/org/apache/thrift/async/TAsyncClientManager.java +++ b/lib/java/src/org/apache/thrift/async/TAsyncClientManager.java @@ -38,7 +38,7 @@ import org.slf4j.LoggerFactory; */ public class TAsyncClientManager { private static final Logger LOGGER = LoggerFactory.getLogger(TAsyncClientManager.class.getName()); - + private final SelectThread selectThread; private final ConcurrentLinkedQueue pendingCalls = new ConcurrentLinkedQueue(); @@ -50,7 +50,7 @@ public class TAsyncClientManager { public void call(TAsyncMethodCall method) throws TException { if (!isRunning()) { throw new TException("SelectThread is not running"); - } + } method.prepareMethodCall(); pendingCalls.add(method); selectThread.getSelector().wakeup(); @@ -59,11 +59,11 @@ public class TAsyncClientManager { public void stop() { selectThread.finish(); } - + public boolean isRunning() { return selectThread.isAlive(); } - + private class SelectThread extends Thread { private final Selector selector; private volatile boolean running; @@ -73,7 +73,7 @@ public class TAsyncClientManager { this.selector = SelectorProvider.provider().openSelector(); this.running = true; this.setName("TAsyncClientManager#SelectorThread " + this.getId()); - + // We don't want to hold up the JVM when shutting down setDaemon(true); } @@ -126,8 +126,9 @@ public class TAsyncClientManager { SelectionKey key = keys.next(); keys.remove(); if (!key.isValid()) { - // this can happen if the method call experienced an error and the key was cancelled - // this can also happen if we timeout a method, which results in a channel close + // this can happen if the method call experienced an error and the + // key was cancelled. can also happen if we timeout a method, which + // results in a channel close. // just skip continue; } @@ -166,7 +167,7 @@ public class TAsyncClientManager { // Catch registration errors. method will catch transition errors and cleanup. try { methodCall.start(selector); - + // If timeout specified and first transition went smoothly, add to timeout watch set TAsyncClient client = methodCall.getClient(); if (client.hasTimeout() && !client.hasError()) { @@ -179,8 +180,8 @@ public class TAsyncClientManager { } } } - - // Comparator used in TreeSet + + /** Comparator used in TreeSet */ private static class TAsyncMethodCallTimeoutComparator implements Comparator { @Override public int compare(TAsyncMethodCall left, TAsyncMethodCall right) { @@ -189,7 +190,6 @@ public class TAsyncClientManager { } else { return (int)(left.getTimeoutTimestamp() - right.getTimeoutTimestamp()); } - } + } } - }