You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by da...@apache.org on 2016/11/16 19:41:46 UTC
[4/6] kudu git commit: [java] Add checkstyle coverage to Java build
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/KuduScanToken.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/KuduScanToken.java b/java/kudu-client/src/main/java/org/apache/kudu/client/KuduScanToken.java
index 9f603ad..4d225cc 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/KuduScanToken.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/KuduScanToken.java
@@ -17,12 +17,17 @@
package org.apache.kudu.client;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.protobuf.CodedInputStream;
import com.google.protobuf.CodedOutputStream;
import com.google.protobuf.ZeroCopyLiteralByteString;
+
import org.apache.kudu.ColumnSchema;
import org.apache.kudu.Common;
import org.apache.kudu.annotations.InterfaceAudience;
@@ -30,10 +35,6 @@ import org.apache.kudu.annotations.InterfaceStability;
import org.apache.kudu.client.Client.ScanTokenPB;
import org.apache.kudu.util.Pair;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* A scan token describes a partial scan of a Kudu table limited to a single
* contiguous physical location. Using the {@link KuduScanTokenBuilder}, clients can
@@ -100,7 +101,8 @@ public class KuduScanToken implements Comparable<KuduScanToken> {
* @param client a Kudu client for the cluster
* @return a scanner for the serialized scan token
*/
- public static KuduScanner deserializeIntoScanner(byte[] buf, KuduClient client) throws IOException {
+ public static KuduScanner deserializeIntoScanner(byte[] buf, KuduClient client)
+ throws IOException {
return pbIntoScanner(ScanTokenPB.parseFrom(CodedInputStream.newInstance(buf)), client);
}
@@ -134,8 +136,10 @@ public class KuduScanToken implements Comparable<KuduScanToken> {
helper.addValue(KeyEncoder.formatPartitionKeyRange(table.getSchema(),
table.getPartitionSchema(),
- token.getLowerBoundPartitionKey().toByteArray(),
- token.getUpperBoundPartitionKey().toByteArray()));
+ token.getLowerBoundPartitionKey()
+ .toByteArray(),
+ token.getUpperBoundPartitionKey()
+ .toByteArray()));
return helper.toString();
}
@@ -349,4 +353,4 @@ public class KuduScanToken implements Comparable<KuduScanToken> {
}
}
}
- }
+}
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/KuduScanner.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/KuduScanner.java b/java/kudu-client/src/main/java/org/apache/kudu/client/KuduScanner.java
index 182b676..05fc8b9 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/KuduScanner.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/KuduScanner.java
@@ -14,9 +14,8 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.kudu.client;
-import com.stumbleupon.async.Deferred;
+package org.apache.kudu.client;
import org.apache.kudu.Schema;
import org.apache.kudu.annotations.InterfaceAudience;
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/KuduSession.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/KuduSession.java b/java/kudu-client/src/main/java/org/apache/kudu/client/KuduSession.java
index 3915979..0c226ee 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/KuduSession.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/KuduSession.java
@@ -14,18 +14,18 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.kudu.client;
-import com.stumbleupon.async.DeferredGroupException;
-import com.stumbleupon.async.TimeoutException;
-import org.apache.kudu.annotations.*;
+package org.apache.kudu.client;
-import com.stumbleupon.async.Deferred;
import java.util.List;
+import com.stumbleupon.async.Deferred;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.kudu.annotations.InterfaceAudience;
+import org.apache.kudu.annotations.InterfaceStability;
+
/**
* Synchronous version of {@link AsyncKuduSession}.
* Offers the same API but with blocking methods.<p>
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/KuduTable.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/KuduTable.java b/java/kudu-client/src/main/java/org/apache/kudu/client/KuduTable.java
index d8f40f1..0bc9a35 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/KuduTable.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/KuduTable.java
@@ -14,15 +14,16 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
-import org.apache.kudu.Schema;
-import org.apache.kudu.annotations.InterfaceAudience;
-import org.apache.kudu.annotations.InterfaceStability;
+import java.util.List;
import com.stumbleupon.async.Deferred;
-import java.util.List;
+import org.apache.kudu.Schema;
+import org.apache.kudu.annotations.InterfaceAudience;
+import org.apache.kudu.annotations.InterfaceStability;
/**
* A KuduTable represents a table on a particular cluster. It holds the current
@@ -137,20 +138,6 @@ public class KuduTable {
}
/**
- * Get all the tablets for this table. This may query the master multiple times if there
- * are a lot of tablets.
- * @param deadline deadline in milliseconds for this method to finish
- * @return a list containing the metadata and locations for each of the tablets in the
- * table
- * @throws Exception
- * @deprecated use the {@link KuduScanToken} API
- */
- @Deprecated
- public List<LocatedTablet> getTabletsLocations(long deadline) throws Exception {
- return getTabletsLocations(null, null, deadline);
- }
-
- /**
* Asynchronously get all the tablets for this table.
* @param deadline max time spent in milliseconds for the deferred result of this method to
* get called back, if deadline is reached, the deferred result will get erred back
@@ -164,12 +151,26 @@ public class KuduTable {
}
/**
- * Get all or some tablets for this table. This may query the master multiple times if there
- * are a lot of tablets.
- * This method blocks until it gets all the tablets.
+ * Asynchronously get all or some tablets for this table.
* @param startKey where to start in the table, pass null to start at the beginning
* @param endKey where to stop in the table (exclusive), pass null to get all the tablets until
* the end of the table
+ * @param deadline max time spent in milliseconds for the deferred result of this method to
+ * get called back, if deadline is reached, the deferred result will get erred back
+ * @return a {@link Deferred} object that yields a list containing the metadata and locations
+ * for each of the tablets in the table
+ * @deprecated use the {@link KuduScanToken} API
+ */
+ @Deprecated
+ public Deferred<List<LocatedTablet>> asyncGetTabletsLocations(byte[] startKey,
+ byte[] endKey,
+ long deadline) {
+ return client.locateTable(this, startKey, endKey, deadline);
+ }
+
+ /**
+ * Get all the tablets for this table. This may query the master multiple times if there
+ * are a lot of tablets.
* @param deadline deadline in milliseconds for this method to finish
* @return a list containing the metadata and locations for each of the tablets in the
* table
@@ -177,27 +178,27 @@ public class KuduTable {
* @deprecated use the {@link KuduScanToken} API
*/
@Deprecated
- public List<LocatedTablet> getTabletsLocations(byte[] startKey,
- byte[] endKey,
- long deadline) throws Exception {
- return client.syncLocateTable(this, startKey, endKey, deadline);
+ public List<LocatedTablet> getTabletsLocations(long deadline) throws Exception {
+ return getTabletsLocations(null, null, deadline);
}
/**
- * Asynchronously get all or some tablets for this table.
+ * Get all or some tablets for this table. This may query the master multiple times if there
+ * are a lot of tablets.
+ * This method blocks until it gets all the tablets.
* @param startKey where to start in the table, pass null to start at the beginning
* @param endKey where to stop in the table (exclusive), pass null to get all the tablets until
* the end of the table
- * @param deadline max time spent in milliseconds for the deferred result of this method to
- * get called back, if deadline is reached, the deferred result will get erred back
- * @return a {@link Deferred} object that yields a list containing the metadata and locations
- * for each of the tablets in the table
+ * @param deadline deadline in milliseconds for this method to finish
+ * @return a list containing the metadata and locations for each of the tablets in the
+ * table
+ * @throws Exception
* @deprecated use the {@link KuduScanToken} API
*/
@Deprecated
- public Deferred<List<LocatedTablet>> asyncGetTabletsLocations(byte[] startKey,
- byte[] endKey,
- long deadline) {
- return client.locateTable(this, startKey, endKey, deadline);
+ public List<LocatedTablet> getTabletsLocations(byte[] startKey,
+ byte[] endKey,
+ long deadline) throws Exception {
+ return client.syncLocateTable(this, startKey, endKey, deadline);
}
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/ListTablesRequest.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/ListTablesRequest.java b/java/kudu-client/src/main/java/org/apache/kudu/client/ListTablesRequest.java
index 470f45d..2962264 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/ListTablesRequest.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/ListTablesRequest.java
@@ -14,16 +14,18 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
+import java.util.ArrayList;
+import java.util.List;
+
import com.google.protobuf.Message;
+import org.jboss.netty.buffer.ChannelBuffer;
+
import org.apache.kudu.annotations.InterfaceAudience;
import org.apache.kudu.master.Master;
import org.apache.kudu.util.Pair;
-import org.jboss.netty.buffer.ChannelBuffer;
-
-import java.util.ArrayList;
-import java.util.List;
@InterfaceAudience.Private
class ListTablesRequest extends KuduRpc<ListTablesResponse> {
@@ -47,7 +49,9 @@ class ListTablesRequest extends KuduRpc<ListTablesResponse> {
}
@Override
- String serviceName() { return MASTER_SERVICE_NAME; }
+ String serviceName() {
+ return MASTER_SERVICE_NAME;
+ }
@Override
String method() {
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/ListTablesResponse.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/ListTablesResponse.java b/java/kudu-client/src/main/java/org/apache/kudu/client/ListTablesResponse.java
index 92e8a0f..b12f71d 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/ListTablesResponse.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/ListTablesResponse.java
@@ -14,13 +14,14 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
+import java.util.List;
+
import org.apache.kudu.annotations.InterfaceAudience;
import org.apache.kudu.annotations.InterfaceStability;
-import java.util.List;
-
@InterfaceAudience.Public
@InterfaceStability.Evolving
public class ListTablesResponse extends KuduRpcResponse {
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletServersRequest.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletServersRequest.java b/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletServersRequest.java
index c16c223..68683b7 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletServersRequest.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletServersRequest.java
@@ -14,17 +14,20 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
+import static org.apache.kudu.master.Master.ListTabletServersRequestPB;
+import static org.apache.kudu.master.Master.ListTabletServersResponsePB;
+
+import java.util.ArrayList;
+import java.util.List;
+
import com.google.protobuf.Message;
-import static org.apache.kudu.master.Master.*;
+import org.jboss.netty.buffer.ChannelBuffer;
import org.apache.kudu.annotations.InterfaceAudience;
import org.apache.kudu.util.Pair;
-import org.jboss.netty.buffer.ChannelBuffer;
-
-import java.util.ArrayList;
-import java.util.List;
@InterfaceAudience.Private
public class ListTabletServersRequest extends KuduRpc<ListTabletServersResponse> {
@@ -32,6 +35,7 @@ public class ListTabletServersRequest extends KuduRpc<ListTabletServersResponse>
public ListTabletServersRequest(KuduTable masterTable) {
super(masterTable);
}
+
@Override
ChannelBuffer serialize(Message header) {
assert header.isInitialized();
@@ -41,7 +45,9 @@ public class ListTabletServersRequest extends KuduRpc<ListTabletServersResponse>
}
@Override
- String serviceName() { return MASTER_SERVICE_NAME; }
+ String serviceName() {
+ return MASTER_SERVICE_NAME;
+ }
@Override
String method() {
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletServersResponse.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletServersResponse.java b/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletServersResponse.java
index dc3767a..78f7382 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletServersResponse.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletServersResponse.java
@@ -14,13 +14,14 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
+import java.util.List;
+
import org.apache.kudu.annotations.InterfaceAudience;
import org.apache.kudu.annotations.InterfaceStability;
-import java.util.List;
-
@InterfaceAudience.Public
@InterfaceStability.Evolving
public class ListTabletServersResponse extends KuduRpcResponse {
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletsRequest.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletsRequest.java b/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletsRequest.java
index 1fe3d4d..80f24b3 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletsRequest.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletsRequest.java
@@ -14,16 +14,18 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
+import java.util.ArrayList;
+import java.util.List;
+
import com.google.protobuf.Message;
+import org.jboss.netty.buffer.ChannelBuffer;
+
import org.apache.kudu.annotations.InterfaceAudience;
import org.apache.kudu.tserver.Tserver;
import org.apache.kudu.util.Pair;
-import org.jboss.netty.buffer.ChannelBuffer;
-
-import java.util.ArrayList;
-import java.util.List;
@InterfaceAudience.Private
class ListTabletsRequest extends KuduRpc<ListTabletsResponse> {
@@ -41,7 +43,9 @@ class ListTabletsRequest extends KuduRpc<ListTabletsResponse> {
}
@Override
- String serviceName() { return TABLET_SERVER_SERVICE_NAME; }
+ String serviceName() {
+ return TABLET_SERVER_SERVICE_NAME;
+ }
@Override
String method() {
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletsResponse.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletsResponse.java b/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletsResponse.java
index db12fa2..43f56f9 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletsResponse.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletsResponse.java
@@ -14,12 +14,13 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.kudu.client;
-import org.apache.kudu.annotations.InterfaceAudience;
+package org.apache.kudu.client;
import java.util.List;
+import org.apache.kudu.annotations.InterfaceAudience;
+
@InterfaceAudience.Private
public class ListTabletsResponse extends KuduRpcResponse {
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/LocatedTablet.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/LocatedTablet.java b/java/kudu-client/src/main/java/org/apache/kudu/client/LocatedTablet.java
index febd167..eaa85b5 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/LocatedTablet.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/LocatedTablet.java
@@ -17,6 +17,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.apache.kudu.client;
import java.util.List;
@@ -85,7 +86,9 @@ public class LocatedTablet {
*/
private Replica getOneOfRoleOrNull(Role role) {
for (Replica r : replicas) {
- if (r.getRole() == role.toString()) return r;
+ if (r.getRole() == role.toString()) {
+ return r;
+ }
}
return null;
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/NoLeaderFoundException.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/NoLeaderFoundException.java b/java/kudu-client/src/main/java/org/apache/kudu/client/NoLeaderFoundException.java
index 86aeccf..19b9222 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/NoLeaderFoundException.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/NoLeaderFoundException.java
@@ -14,13 +14,12 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
import org.apache.kudu.annotations.InterfaceAudience;
import org.apache.kudu.annotations.InterfaceStability;
-import java.util.List;
-
/**
* Indicates that the request failed because we couldn't find a leader. It is retried as long
* as the original call hasn't timed out.
@@ -32,6 +31,7 @@ final class NoLeaderFoundException extends RecoverableException {
NoLeaderFoundException(Status status) {
super(status);
}
+
NoLeaderFoundException(Status status, Exception cause) {
super(status, cause);
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/NonCoveredRangeException.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/NonCoveredRangeException.java b/java/kudu-client/src/main/java/org/apache/kudu/client/NonCoveredRangeException.java
index 801da77..1aa358f 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/NonCoveredRangeException.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/NonCoveredRangeException.java
@@ -14,10 +14,10 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
import org.apache.kudu.annotations.InterfaceAudience;
-import org.apache.kudu.annotations.InterfaceStability;
/**
* Exception indicating that an operation attempted to access a non-covered range partition.
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/NonRecoverableException.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/NonRecoverableException.java b/java/kudu-client/src/main/java/org/apache/kudu/client/NonRecoverableException.java
index e080043..882a1bf 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/NonRecoverableException.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/NonRecoverableException.java
@@ -23,6 +23,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+
package org.apache.kudu.client;
import org.apache.kudu.annotations.InterfaceAudience;
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/Operation.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/Operation.java b/java/kudu-client/src/main/java/org/apache/kudu/client/Operation.java
index 512bddd..3727d5d 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/Operation.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/Operation.java
@@ -14,12 +14,19 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.ArrayList;
+import java.util.List;
+
import com.google.common.collect.ImmutableList;
import com.google.protobuf.ByteString;
import com.google.protobuf.Message;
import com.google.protobuf.ZeroCopyLiteralByteString;
+import org.jboss.netty.buffer.ChannelBuffer;
import org.apache.kudu.ColumnSchema;
import org.apache.kudu.Schema;
@@ -32,12 +39,6 @@ import org.apache.kudu.client.Statistics.Statistic;
import org.apache.kudu.client.Statistics.TabletStatistics;
import org.apache.kudu.tserver.Tserver;
import org.apache.kudu.util.Pair;
-import org.jboss.netty.buffer.ChannelBuffer;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.util.ArrayList;
-import java.util.List;
/**
* Base class for the RPCs that related to WriteRequestPB. It contains almost all the logic
@@ -60,8 +61,10 @@ public abstract class Operation extends KuduRpc<OperationResponse> {
UPSERT((byte)RowOperationsPB.Type.UPSERT.getNumber()),
RANGE_LOWER_BOUND((byte) RowOperationsPB.Type.RANGE_LOWER_BOUND.getNumber()),
RANGE_UPPER_BOUND((byte) RowOperationsPB.Type.RANGE_UPPER_BOUND.getNumber()),
- EXCLUSIVE_RANGE_LOWER_BOUND((byte) RowOperationsPB.Type.EXCLUSIVE_RANGE_LOWER_BOUND.getNumber()),
- INCLUSIVE_RANGE_UPPER_BOUND((byte) RowOperationsPB.Type.INCLUSIVE_RANGE_UPPER_BOUND.getNumber());
+ EXCLUSIVE_RANGE_LOWER_BOUND(
+ (byte) RowOperationsPB.Type.EXCLUSIVE_RANGE_LOWER_BOUND.getNumber()),
+ INCLUSIVE_RANGE_UPPER_BOUND(
+ (byte) RowOperationsPB.Type.INCLUSIVE_RANGE_UPPER_BOUND.getNumber());
ChangeType(byte encodedByte) {
this.encodedByte = encodedByte;
@@ -115,7 +118,9 @@ public abstract class Operation extends KuduRpc<OperationResponse> {
}
@Override
- String serviceName() { return TABLET_SERVER_SERVICE_NAME; }
+ String serviceName() {
+ return TABLET_SERVER_SERVICE_NAME;
+ }
@Override
String method() {
@@ -126,8 +131,8 @@ public abstract class Operation extends KuduRpc<OperationResponse> {
ChannelBuffer serialize(Message header) {
final Tserver.WriteRequestPB.Builder builder =
createAndFillWriteRequestPB(ImmutableList.of(this));
- this.rowOperationSizeBytes = builder.getRowOperations().getRows().size()
- + builder.getRowOperations().getIndirectData().size();
+ this.rowOperationSizeBytes = builder.getRowOperations().getRows().size() +
+ builder.getRowOperations().getIndirectData().size();
builder.setTabletId(ZeroCopyLiteralByteString.wrap(getTablet().getTabletIdAsBytes()));
builder.setExternalConsistencyMode(this.externalConsistencyMode.pbVersion());
if (this.propagatedTimestamp != AsyncKuduClient.NO_TIMESTAMP) {
@@ -209,10 +214,14 @@ public abstract class Operation extends KuduRpc<OperationResponse> {
* null if no rows were passed.
*/
static Tserver.WriteRequestPB.Builder createAndFillWriteRequestPB(List<Operation> operations) {
- if (operations == null || operations.isEmpty()) return null;
+ if (operations == null || operations.isEmpty()) {
+ return null;
+ }
Schema schema = operations.get(0).table.getSchema();
RowOperationsPB rowOps = new OperationsEncoder().encodeOperations(operations);
- if (rowOps == null) return null;
+ if (rowOps == null) {
+ return null;
+ }
Tserver.WriteRequestPB.Builder requestBuilder = Tserver.WriteRequestPB.newBuilder();
requestBuilder.setSchema(ProtobufHelper.schemaToPb(schema));
@@ -313,7 +322,9 @@ public abstract class Operation extends KuduRpc<OperationResponse> {
}
public RowOperationsPB encodeOperations(List<Operation> operations) {
- if (operations == null || operations.isEmpty()) return null;
+ if (operations == null || operations.isEmpty()) {
+ return null;
+ }
init(operations.get(0).table.getSchema(), operations.size());
for (Operation operation : operations) {
encodeRow(operation.row, operation.getChangeType());
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/OperationResponse.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/OperationResponse.java b/java/kudu-client/src/main/java/org/apache/kudu/client/OperationResponse.java
index 93d1a63..9ae092b 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/OperationResponse.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/OperationResponse.java
@@ -14,15 +14,16 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
+import java.util.ArrayList;
+import java.util.List;
+
import org.apache.kudu.annotations.InterfaceAudience;
import org.apache.kudu.annotations.InterfaceStability;
import org.apache.kudu.tserver.Tserver;
-import java.util.ArrayList;
-import java.util.List;
-
@InterfaceAudience.Public
@InterfaceStability.Evolving
public class OperationResponse extends KuduRpcResponse {
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/PartialRow.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/PartialRow.java b/java/kudu-client/src/main/java/org/apache/kudu/client/PartialRow.java
index b012bfc..21142d2 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/PartialRow.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/PartialRow.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
import java.nio.ByteBuffer;
@@ -24,12 +25,12 @@ import java.util.List;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
+
import org.apache.kudu.ColumnSchema;
import org.apache.kudu.Schema;
import org.apache.kudu.Type;
import org.apache.kudu.annotations.InterfaceAudience;
import org.apache.kudu.annotations.InterfaceStability;
-import org.apache.kudu.util.ByteVec;
/**
* Class used to represent parts of a row along with its schema.<p>
@@ -218,8 +219,8 @@ public class PartialRow {
/**
* Add an long for the specified column.
*
- * If this is a UNIXTIME_MICROS column, the long value provided should be the number of microseconds
- * between a given time and January 1, 1970 UTC.
+ * If this is a UNIXTIME_MICROS column, the long value provided should be the number of
+ * microseconds between a given time and January 1, 1970 UTC.
* For example, to encode the current time, use setLong(System.currentTimeMillis() * 1000);
*
* @param columnName Name of the column
@@ -451,8 +452,10 @@ public class PartialRow {
private void checkColumn(ColumnSchema column, Type... types) {
checkNotFrozen();
checkColumnExists(column);
- for(Type type : types) {
- if (column.getType().equals(type)) return;
+ for (Type type : types) {
+ if (column.getType().equals(type)) {
+ return;
+ }
}
throw new IllegalArgumentException(String.format("%s isn't %s, it's %s", column.getName(),
Arrays.toString(types), column.getType().getName()));
@@ -463,8 +466,9 @@ public class PartialRow {
* @throws IllegalArgumentException if the column doesn't exist
*/
private void checkColumnExists(ColumnSchema column) {
- if (column == null)
+ if (column == null) {
throw new IllegalArgumentException("Column name isn't present in the table's schema");
+ }
}
/**
@@ -600,6 +604,9 @@ public class PartialRow {
} else {
sb.append(Bytes.pretty(data));
}
+ break;
+ default:
+ throw new RuntimeException("unreachable");
}
}
}
@@ -611,16 +618,36 @@ public class PartialRow {
void setMin(int index) {
Type type = schema.getColumnByIndex(index).getType();
switch (type) {
- case BOOL: addBoolean(index, false); break;
- case INT8: addByte(index, Byte.MIN_VALUE); break;
- case INT16: addShort(index, Short.MIN_VALUE); break;
- case INT32: addInt(index, Integer.MIN_VALUE); break;
+ case BOOL:
+ addBoolean(index, false);
+ break;
+ case INT8:
+ addByte(index, Byte.MIN_VALUE);
+ break;
+ case INT16:
+ addShort(index, Short.MIN_VALUE);
+ break;
+ case INT32:
+ addInt(index, Integer.MIN_VALUE);
+ break;
case INT64:
- case UNIXTIME_MICROS: addLong(index, Integer.MIN_VALUE); break;
- case FLOAT: addFloat(index, -Float.MAX_VALUE); break;
- case DOUBLE: addDouble(index, -Double.MAX_VALUE); break;
- case STRING: addStringUtf8(index, AsyncKuduClient.EMPTY_ARRAY); break;
- case BINARY: addBinary(index, AsyncKuduClient.EMPTY_ARRAY); break;
+ case UNIXTIME_MICROS:
+ addLong(index, Integer.MIN_VALUE);
+ break;
+ case FLOAT:
+ addFloat(index, -Float.MAX_VALUE);
+ break;
+ case DOUBLE:
+ addDouble(index, -Double.MAX_VALUE);
+ break;
+ case STRING:
+ addStringUtf8(index, AsyncKuduClient.EMPTY_ARRAY);
+ break;
+ case BINARY:
+ addBinary(index, AsyncKuduClient.EMPTY_ARRAY);
+ break;
+ default:
+ throw new RuntimeException("unreachable");
}
}
@@ -641,7 +668,8 @@ public class PartialRow {
case FLOAT:
case DOUBLE: {
Preconditions.checkArgument(value.length == type.getSize());
- System.arraycopy(value, 0, rowAlloc, getPositionInRowAllocAndSetBitSet(index), value.length);
+ System.arraycopy(value, 0, rowAlloc,
+ getPositionInRowAllocAndSetBitSet(index), value.length);
break;
}
case STRING:
@@ -649,6 +677,8 @@ public class PartialRow {
addVarLengthData(index, value);
break;
}
+ default:
+ throw new RuntimeException("unreachable");
}
}
@@ -670,42 +700,54 @@ public class PartialRow {
rowAlloc[offset] = 1;
return isFalse;
}
- case INT8:{
+ case INT8: {
byte existing = rowAlloc[offset];
- if (existing == Byte.MAX_VALUE) return false;
+ if (existing == Byte.MAX_VALUE) {
+ return false;
+ }
rowAlloc[offset] = (byte) (existing + 1);
return true;
}
case INT16: {
short existing = Bytes.getShort(rowAlloc, offset);
- if (existing == Short.MAX_VALUE) return false;
+ if (existing == Short.MAX_VALUE) {
+ return false;
+ }
Bytes.setShort(rowAlloc, (short) (existing + 1), offset);
return true;
}
case INT32: {
int existing = Bytes.getInt(rowAlloc, offset);
- if (existing == Integer.MAX_VALUE) return false;
+ if (existing == Integer.MAX_VALUE) {
+ return false;
+ }
Bytes.setInt(rowAlloc, existing + 1, offset);
return true;
}
case INT64:
case UNIXTIME_MICROS: {
long existing = Bytes.getLong(rowAlloc, offset);
- if (existing == Long.MAX_VALUE) return false;
+ if (existing == Long.MAX_VALUE) {
+ return false;
+ }
Bytes.setLong(rowAlloc, existing + 1, offset);
return true;
}
case FLOAT: {
float existing = Bytes.getFloat(rowAlloc, offset);
float incremented = Math.nextAfter(existing, Float.POSITIVE_INFINITY);
- if (existing == incremented) return false;
+ if (existing == incremented) {
+ return false;
+ }
Bytes.setFloat(rowAlloc, incremented, offset);
return true;
}
case DOUBLE: {
double existing = Bytes.getFloat(rowAlloc, offset);
double incremented = Math.nextAfter(existing, Double.POSITIVE_INFINITY);
- if (existing == incremented) return false;
+ if (existing == incremented) {
+ return false;
+ }
Bytes.setDouble(rowAlloc, incremented, offset);
return true;
}
@@ -718,8 +760,9 @@ public class PartialRow {
addVarLengthData(index, incremented);
return true;
}
+ default:
+ throw new RuntimeException("unreachable");
}
- throw new RuntimeException("unreachable");
}
/**
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/Partition.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/Partition.java b/java/kudu-client/src/main/java/org/apache/kudu/client/Partition.java
index c95fa34..90f570a 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/Partition.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/Partition.java
@@ -14,15 +14,17 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
+import java.util.Arrays;
+import java.util.List;
+
import com.google.common.base.Objects;
+
import org.apache.kudu.annotations.InterfaceAudience;
import org.apache.kudu.annotations.InterfaceStability;
-import java.util.Arrays;
-import java.util.List;
-
/**
* A Partition describes the set of rows that a Tablet is responsible for
* serving. Each tablet is assigned a single Partition.<p>
@@ -125,11 +127,15 @@ public class Partition implements Comparable<Partition> {
*/
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
Partition partition = (Partition) o;
- return Arrays.equals(partitionKeyStart, partition.partitionKeyStart)
- && Arrays.equals(partitionKeyEnd, partition.partitionKeyEnd);
+ return Arrays.equals(partitionKeyStart, partition.partitionKeyStart) &&
+ Arrays.equals(partitionKeyEnd, partition.partitionKeyEnd);
}
/**
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/PartitionPruner.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/PartitionPruner.java b/java/kudu-client/src/main/java/org/apache/kudu/client/PartitionPruner.java
index 59c85d5..1535173 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/PartitionPruner.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/PartitionPruner.java
@@ -14,13 +14,8 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.kudu.client;
-import org.apache.kudu.ColumnSchema;
-import org.apache.kudu.Schema;
-import org.apache.kudu.annotations.InterfaceAudience;
-import org.apache.kudu.util.ByteVec;
-import org.apache.kudu.util.Pair;
+package org.apache.kudu.client;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -32,6 +27,12 @@ import java.util.List;
import java.util.Map;
import javax.annotation.concurrent.NotThreadSafe;
+import org.apache.kudu.ColumnSchema;
+import org.apache.kudu.Schema;
+import org.apache.kudu.annotations.InterfaceAudience;
+import org.apache.kudu.util.ByteVec;
+import org.apache.kudu.util.Pair;
+
@InterfaceAudience.Private
@NotThreadSafe
public class PartitionPruner {
@@ -143,8 +144,8 @@ public class PartitionPruner {
// Step 1: Build the range portion of the partition key. If the range partition
// columns match the primary key columns, then we can substitute the primary
// key bounds, if they are tighter.
- byte[] rangeLowerBound = pushPredicatesIntoLowerBoundRangeKey(schema, rangeSchema, predicates);
- byte[] rangeUpperBound = pushPredicatesIntoUpperBoundRangeKey(schema, rangeSchema, predicates);
+ byte[] rangeLowerBound = pushPredsIntoLowerBoundRangeKey(schema, rangeSchema, predicates);
+ byte[] rangeUpperBound = pushPredsIntoUpperBoundRangeKey(schema, rangeSchema, predicates);
if (partitionSchema.isSimpleRangePartitioning()) {
if (Bytes.memcmp(rangeLowerBound, scanner.lowerBoundPrimaryKey) < 0) {
rangeLowerBound = scanner.lowerBoundPrimaryKey;
@@ -239,7 +240,8 @@ public class PartitionPruner {
}
// Step 4: Filter ranges that fall outside the scan's upper and lower bound partition keys.
- Deque<Pair<byte[], byte[]>> partitionKeyRangeBytes = new ArrayDeque<>(partitionKeyRanges.size());
+ Deque<Pair<byte[], byte[]>> partitionKeyRangeBytes =
+ new ArrayDeque<>(partitionKeyRanges.size());
for (Pair<ByteVec, ByteVec> range : partitionKeyRanges) {
byte[] lower = range.getFirst().toArray();
byte[] upper = range.getSecond().toArray();
@@ -290,7 +292,9 @@ public class PartitionPruner {
while (!rangePartitions.isEmpty()) {
Pair<byte[], byte[]> range = rangePartitions.getFirst();
- if (Bytes.memcmp(upperBound, range.getFirst()) <= 0) break;
+ if (Bytes.memcmp(upperBound, range.getFirst()) <= 0) {
+ break;
+ }
rangePartitions.removeFirst();
if (range.getSecond().length == 0 || Bytes.memcmp(upperBound, range.getSecond()) < 0) {
// The upper bound falls in the middle of this range, so add it back
@@ -338,7 +342,9 @@ public class PartitionPruner {
private static boolean incrementKey(PartialRow row, List<Integer> keyIndexes) {
for (int i = keyIndexes.size() - 1; i >= 0; i--) {
- if (row.incrementColumn(keyIndexes.get(i))) return true;
+ if (row.incrementColumn(keyIndexes.get(i))) {
+ return true;
+ }
}
return false;
}
@@ -350,9 +356,9 @@ public class PartitionPruner {
* @param predicates the predicates
* @return a lower bound range partition key
*/
- private static byte[] pushPredicatesIntoLowerBoundRangeKey(Schema schema,
- PartitionSchema.RangeSchema rangeSchema,
- Map<String, KuduPredicate> predicates) {
+ private static byte[] pushPredsIntoLowerBoundRangeKey(Schema schema,
+ PartitionSchema.RangeSchema rangeSchema,
+ Map<String, KuduPredicate> predicates) {
PartialRow row = schema.newPartialRow();
int pushedPredicates = 0;
@@ -363,11 +369,15 @@ public class PartitionPruner {
loop: for (int idx : rangePartitionColumnIdxs) {
ColumnSchema column = schema.getColumnByIndex(idx);
KuduPredicate predicate = predicates.get(column.getName());
- if (predicate == null) break;
+ if (predicate == null) {
+ break;
+ }
switch (predicate.getType()) {
case RANGE:
- if (predicate.getLower() == null) break loop;
+ if (predicate.getLower() == null) {
+ break loop;
+ }
// fall through
case EQUALITY:
row.setRaw(idx, predicate.getLower());
@@ -386,7 +396,9 @@ public class PartitionPruner {
}
// If no predicates were pushed, no need to do any more work.
- if (pushedPredicates == 0) return AsyncKuduClient.EMPTY_ARRAY;
+ if (pushedPredicates == 0) {
+ return AsyncKuduClient.EMPTY_ARRAY;
+ }
// For each remaining column in the partition key, fill it with the minimum value.
Iterator<Integer> remainingIdxs = rangePartitionColumnIdxs.listIterator(pushedPredicates);
@@ -404,9 +416,9 @@ public class PartitionPruner {
* @param predicates the predicates
* @return an upper bound range partition key
*/
- private static byte[] pushPredicatesIntoUpperBoundRangeKey(Schema schema,
- PartitionSchema.RangeSchema rangeSchema,
- Map<String, KuduPredicate> predicates) {
+ private static byte[] pushPredsIntoUpperBoundRangeKey(Schema schema,
+ PartitionSchema.RangeSchema rangeSchema,
+ Map<String, KuduPredicate> predicates) {
PartialRow row = schema.newPartialRow();
int pushedPredicates = 0;
KuduPredicate finalPredicate = null;
@@ -418,7 +430,9 @@ public class PartitionPruner {
loop: for (int idx : rangePartitionColumnIdxs) {
ColumnSchema column = schema.getColumnByIndex(idx);
KuduPredicate predicate = predicates.get(column.getName());
- if (predicate == null) break;
+ if (predicate == null) {
+ break;
+ }
switch (predicate.getType()) {
case EQUALITY:
@@ -454,7 +468,9 @@ public class PartitionPruner {
}
// If no predicates were pushed, no need to do any more work.
- if (pushedPredicates == 0) return AsyncKuduClient.EMPTY_ARRAY;
+ if (pushedPredicates == 0) {
+ return AsyncKuduClient.EMPTY_ARRAY;
+ }
// Step 2: If the final predicate is an equality or IN-list predicate, increment the
// key to convert it to an exclusive upper bound.
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/PartitionSchema.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/PartitionSchema.java b/java/kudu-client/src/main/java/org/apache/kudu/client/PartitionSchema.java
index fa4ac4c..dd455f0 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/PartitionSchema.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/PartitionSchema.java
@@ -14,14 +14,15 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
+import java.util.List;
+
import org.apache.kudu.Schema;
import org.apache.kudu.annotations.InterfaceAudience;
import org.apache.kudu.annotations.InterfaceStability;
-import java.util.List;
-
/**
* A partition schema describes how the rows of a table are distributed among
* tablets.
@@ -60,8 +61,8 @@ public class PartitionSchema {
this.rangeSchema = rangeSchema;
this.hashBucketSchemas = hashBucketSchemas;
- boolean isSimple = hashBucketSchemas.isEmpty()
- && rangeSchema.columns.size() == schema.getPrimaryKeyColumnCount();
+ boolean isSimple = hashBucketSchemas.isEmpty() &&
+ rangeSchema.columns.size() == schema.getPrimaryKeyColumnCount();
if (isSimple) {
int i = 0;
for (Integer id : rangeSchema.columns) {
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/PingRequest.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/PingRequest.java b/java/kudu-client/src/main/java/org/apache/kudu/client/PingRequest.java
index 79e788b..26a7f58 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/PingRequest.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/PingRequest.java
@@ -14,14 +14,16 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
import com.google.protobuf.Message;
+import org.jboss.netty.buffer.ChannelBuffer;
+
import org.apache.kudu.annotations.InterfaceAudience;
import org.apache.kudu.annotations.InterfaceStability;
import org.apache.kudu.master.Master;
import org.apache.kudu.util.Pair;
-import org.jboss.netty.buffer.ChannelBuffer;
/**
* Ping request only used for tests to test connections.
@@ -64,7 +66,8 @@ class PingRequest extends KuduRpc<PingResponse> {
}
@Override
- Pair<PingResponse, Object> deserialize(CallResponse callResponse, String tsUUID) throws KuduException {
+ Pair<PingResponse, Object> deserialize(CallResponse callResponse, String tsUUID)
+ throws KuduException {
final Master.PingResponsePB.Builder respBuilder =
Master.PingResponsePB.newBuilder();
readProtobuf(callResponse.getPBMessage(), respBuilder);
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/PingResponse.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/PingResponse.java b/java/kudu-client/src/main/java/org/apache/kudu/client/PingResponse.java
index 83d08a7..7ee6523 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/PingResponse.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/PingResponse.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
import org.apache.kudu.annotations.InterfaceAudience;
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/PleaseThrottleException.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/PleaseThrottleException.java b/java/kudu-client/src/main/java/org/apache/kudu/client/PleaseThrottleException.java
index 6b5adb8..226218d 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/PleaseThrottleException.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/PleaseThrottleException.java
@@ -23,9 +23,11 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+
package org.apache.kudu.client;
import com.stumbleupon.async.Deferred;
+
import org.apache.kudu.annotations.InterfaceAudience;
import org.apache.kudu.annotations.InterfaceStability;
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/ProtobufHelper.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/ProtobufHelper.java b/java/kudu-client/src/main/java/org/apache/kudu/client/ProtobufHelper.java
index d4ca5b8..5831e25 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/ProtobufHelper.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/ProtobufHelper.java
@@ -14,23 +14,24 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
+import java.util.ArrayList;
+import java.util.List;
+
import com.google.common.base.Charsets;
import com.google.common.collect.ImmutableList;
import com.google.common.net.HostAndPort;
import com.google.protobuf.ByteString;
import com.google.protobuf.ZeroCopyLiteralByteString;
+
import org.apache.kudu.ColumnSchema;
import org.apache.kudu.Common;
import org.apache.kudu.Schema;
import org.apache.kudu.Type;
import org.apache.kudu.annotations.InterfaceAudience;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.List;
-
@InterfaceAudience.Private
public class ProtobufHelper {
@@ -60,8 +61,8 @@ public class ProtobufHelper {
return columnToPb(Common.ColumnSchemaPB.newBuilder(), column);
}
- public static Common.ColumnSchemaPB
- columnToPb(Common.ColumnSchemaPB.Builder schemaBuilder, ColumnSchema column) {
+ public static Common.ColumnSchemaPB columnToPb(Common.ColumnSchemaPB.Builder schemaBuilder,
+ ColumnSchema column) {
schemaBuilder
.setName(column.getName())
.setType(column.getType().getDataType())
@@ -74,8 +75,10 @@ public class ProtobufHelper {
if (column.getCompressionAlgorithm() != null) {
schemaBuilder.setCompression(column.getCompressionAlgorithm().getInternalPbType());
}
- if (column.getDefaultValue() != null) schemaBuilder.setReadDefaultValue
- (ZeroCopyLiteralByteString.wrap(objectToWireFormat(column, column.getDefaultValue())));
+ if (column.getDefaultValue() != null) {
+ schemaBuilder.setReadDefaultValue(ZeroCopyLiteralByteString.wrap(
+ objectToWireFormat(column, column.getDefaultValue())));
+ }
return schemaBuilder.build();
}
@@ -171,6 +174,8 @@ public class ProtobufHelper {
String.format("Expected column ID from master: %s", column));
case IDENTIFIER_NOT_SET:
throw new IllegalArgumentException("Unknown column: " + column);
+ default:
+ throw new IllegalArgumentException("Unknown identifier type!");
}
}
return columnIds.build();
@@ -231,7 +236,8 @@ public class ProtobufHelper {
}
/**
- * Convert a {@link com.google.common.net.HostAndPort} to {@link org.apache.kudu.Common.HostPortPB}
+ * Convert a {@link com.google.common.net.HostAndPort} to
+ * {@link org.apache.kudu.Common.HostPortPB}
* protobuf message for serialization.
* @param hostAndPort The host and port object. Both host and port must be specified.
* @return An initialized HostPortPB object.
@@ -244,7 +250,8 @@ public class ProtobufHelper {
}
/**
- * Convert a {@link org.apache.kudu.Common.HostPortPB} to {@link com.google.common.net.HostAndPort}.
+ * Convert a {@link org.apache.kudu.Common.HostPortPB} to
+ * {@link com.google.common.net.HostAndPort}.
* @param hostPortPB The fully initialized HostPortPB object. Must have both host and port
* specified.
* @return An initialized initialized HostAndPort object.
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/RangePartitionBound.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/RangePartitionBound.java b/java/kudu-client/src/main/java/org/apache/kudu/client/RangePartitionBound.java
index 36e5294..63b7333 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/RangePartitionBound.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/RangePartitionBound.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
import org.apache.kudu.annotations.InterfaceAudience;
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/RecoverableException.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/RecoverableException.java b/java/kudu-client/src/main/java/org/apache/kudu/client/RecoverableException.java
index 02dfe65..f0cc510 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/RecoverableException.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/RecoverableException.java
@@ -23,6 +23,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+
package org.apache.kudu.client;
import org.apache.kudu.annotations.InterfaceAudience;
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/RemoteTablet.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/RemoteTablet.java b/java/kudu-client/src/main/java/org/apache/kudu/client/RemoteTablet.java
index d98f21d..46e8766 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/RemoteTablet.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/RemoteTablet.java
@@ -14,23 +14,25 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
+import javax.annotation.concurrent.GuardedBy;
+
import com.google.common.base.Objects;
import com.google.common.collect.ComparisonChain;
import com.google.common.collect.ImmutableList;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import org.apache.kudu.annotations.InterfaceAudience;
import org.apache.kudu.annotations.InterfaceStability;
import org.apache.kudu.consensus.Metadata;
import org.apache.kudu.master.Master;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.annotation.concurrent.GuardedBy;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicReference;
/**
* This class encapsulates the information regarding a tablet and its locations.
@@ -218,8 +220,12 @@ class RemoteTablet implements Comparable<RemoteTablet> {
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
RemoteTablet that = (RemoteTablet) o;
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/ReplicaSelection.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/ReplicaSelection.java b/java/kudu-client/src/main/java/org/apache/kudu/client/ReplicaSelection.java
index e33ba34..4d6fb63 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/ReplicaSelection.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/ReplicaSelection.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
import org.apache.kudu.annotations.InterfaceAudience;
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/RequestTracker.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/RequestTracker.java b/java/kudu-client/src/main/java/org/apache/kudu/client/RequestTracker.java
index 213b182..1945119 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/RequestTracker.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/RequestTracker.java
@@ -14,14 +14,15 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.kudu.client;
-import org.apache.kudu.annotations.InterfaceAudience;
+package org.apache.kudu.client;
import java.util.Queue;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.atomic.AtomicLong;
+import org.apache.kudu.annotations.InterfaceAudience;
+
/**
* This is the same class as src/kudu/rpc/request_tracker.h.
*/
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/RowError.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/RowError.java b/java/kudu-client/src/main/java/org/apache/kudu/client/RowError.java
index 11b53fc..2b872bb 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/RowError.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/RowError.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
import org.apache.kudu.WireProtocol;
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/RowErrorsAndOverflowStatus.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/RowErrorsAndOverflowStatus.java b/java/kudu-client/src/main/java/org/apache/kudu/client/RowErrorsAndOverflowStatus.java
index 9c7f074..7c9cd5b 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/RowErrorsAndOverflowStatus.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/RowErrorsAndOverflowStatus.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
import org.apache.kudu.annotations.InterfaceAudience;
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/RowResult.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/RowResult.java b/java/kudu-client/src/main/java/org/apache/kudu/client/RowResult.java
index 64871d9..898a3fc 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/RowResult.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/RowResult.java
@@ -14,14 +14,8 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.kudu.client;
-import org.apache.kudu.ColumnSchema;
-import org.apache.kudu.Schema;
-import org.apache.kudu.Type;
-import org.apache.kudu.annotations.InterfaceAudience;
-import org.apache.kudu.annotations.InterfaceStability;
-import org.apache.kudu.util.Slice;
+package org.apache.kudu.client;
import java.nio.ByteBuffer;
import java.text.DateFormat;
@@ -31,6 +25,13 @@ import java.util.BitSet;
import java.util.Date;
import java.util.TimeZone;
+import org.apache.kudu.ColumnSchema;
+import org.apache.kudu.Schema;
+import org.apache.kudu.Type;
+import org.apache.kudu.annotations.InterfaceAudience;
+import org.apache.kudu.annotations.InterfaceStability;
+import org.apache.kudu.util.Slice;
+
/**
* RowResult represents one row from a scanner. Do not reuse or store the objects.
*/
@@ -41,7 +42,7 @@ public class RowResult {
private static final int INDEX_RESET_LOCATION = -1;
// Thread local DateFormat since they're not thread-safe.
- private static final ThreadLocal<DateFormat> DATE_FORMAT = new ThreadLocal<DateFormat>(){
+ private static final ThreadLocal<DateFormat> DATE_FORMAT = new ThreadLocal<DateFormat>() {
@Override
protected DateFormat initialValue() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
@@ -110,8 +111,8 @@ public class RowResult {
if (schema.hasNullableColumns() && this.index != INDEX_RESET_LOCATION) {
this.nullsBitSet = Bytes.toBitSet(
this.rowData.getRawArray(),
- this.rowData.getRawOffset()
- + getCurrentRowDataOffsetForColumn(schema.getColumnCount()),
+ this.rowData.getRawOffset() +
+ getCurrentRowDataOffsetForColumn(schema.getColumnCount()),
schema.getColumnCount());
}
}
@@ -192,8 +193,8 @@ public class RowResult {
checkNull(columnIndex);
checkType(columnIndex, Type.BOOL);
byte b = Bytes.getByte(this.rowData.getRawArray(),
- this.rowData.getRawOffset()
- + getCurrentRowDataOffsetForColumn(columnIndex));
+ this.rowData.getRawOffset() +
+ getCurrentRowDataOffsetForColumn(columnIndex));
return b == 1;
}
@@ -253,8 +254,8 @@ public class RowResult {
checkNull(columnIndex);
// Can't check type because this could be a long, string, or Timestamp
return Bytes.getLong(this.rowData.getRawArray(),
- this.rowData.getRawOffset()
- + getCurrentRowDataOffsetForColumn(columnIndex));
+ this.rowData.getRawOffset() +
+ getCurrentRowDataOffsetForColumn(columnIndex));
}
/**
@@ -276,8 +277,8 @@ public class RowResult {
checkNull(columnIndex);
checkType(columnIndex, Type.FLOAT);
return Bytes.getFloat(this.rowData.getRawArray(),
- this.rowData.getRawOffset()
- + getCurrentRowDataOffsetForColumn(columnIndex));
+ this.rowData.getRawOffset() +
+ getCurrentRowDataOffsetForColumn(columnIndex));
}
/**
@@ -300,8 +301,8 @@ public class RowResult {
checkNull(columnIndex);
checkType(columnIndex, Type.DOUBLE);
return Bytes.getDouble(this.rowData.getRawArray(),
- this.rowData.getRawOffset()
- + getCurrentRowDataOffsetForColumn(columnIndex));
+ this.rowData.getRawOffset() +
+ getCurrentRowDataOffsetForColumn(columnIndex));
}
/**
@@ -439,8 +440,8 @@ public class RowResult {
if (nullsBitSet == null) {
return false;
}
- return schema.getColumnByIndex(columnIndex).isNullable()
- && nullsBitSet.get(columnIndex);
+ return schema.getColumnByIndex(columnIndex).isNullable() &&
+ nullsBitSet.get(columnIndex);
}
/**
@@ -499,7 +500,7 @@ public class RowResult {
Type columnType = columnSchema.getType();
if (!columnType.equals(expectedType)) {
throw new IllegalArgumentException("Column (name: " + columnSchema.getName() +
- ", index: " + columnIndex +") is of type " +
+ ", index: " + columnIndex + ") is of type " +
columnType.getName() + " but was requested as a type " + expectedType.getName());
}
}
@@ -542,20 +543,39 @@ public class RowResult {
buf.append("NULL");
} else {
switch (col.getType()) {
- case INT8: buf.append(getByte(i)); break;
- case INT16: buf.append(getShort(i));
+ case INT8:
+ buf.append(getByte(i));
+ break;
+ case INT16:
+ buf.append(getShort(i));
+ break;
+ case INT32:
+ buf.append(getInt(i));
+ break;
+ case INT64:
+ buf.append(getLong(i));
break;
- case INT32: buf.append(getInt(i)); break;
- case INT64: buf.append(getLong(i)); break;
case UNIXTIME_MICROS: {
buf.append(timestampToString(getLong(i)));
} break;
- case STRING: buf.append(getString(i)); break;
- case BINARY: buf.append(Bytes.pretty(getBinaryCopy(i))); break;
- case FLOAT: buf.append(getFloat(i)); break;
- case DOUBLE: buf.append(getDouble(i)); break;
- case BOOL: buf.append(getBoolean(i)); break;
- default: buf.append("<unknown type!>"); break;
+ case STRING:
+ buf.append(getString(i));
+ break;
+ case BINARY:
+ buf.append(Bytes.pretty(getBinaryCopy(i)));
+ break;
+ case FLOAT:
+ buf.append(getFloat(i));
+ break;
+ case DOUBLE:
+ buf.append(getDouble(i));
+ break;
+ case BOOL:
+ buf.append(getBoolean(i));
+ break;
+ default:
+ buf.append("<unknown type!>");
+ break;
}
}
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/RowResultIterator.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/RowResultIterator.java b/java/kudu-client/src/main/java/org/apache/kudu/client/RowResultIterator.java
index 2d4c2d0..978bfd1 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/RowResultIterator.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/RowResultIterator.java
@@ -14,9 +14,11 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
import java.util.Iterator;
+
import org.apache.kudu.Schema;
import org.apache.kudu.WireProtocol;
import org.apache.kudu.annotations.InterfaceAudience;
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/RpcTraceFrame.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/RpcTraceFrame.java b/java/kudu-client/src/main/java/org/apache/kudu/client/RpcTraceFrame.java
index a327f23..b141292 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/RpcTraceFrame.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/RpcTraceFrame.java
@@ -14,12 +14,14 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
+import java.util.List;
+
import com.google.common.base.MoreObjects;
-import org.apache.kudu.annotations.InterfaceAudience;
-import java.util.List;
+import org.apache.kudu.annotations.InterfaceAudience;
/**
* Container class for traces. Most of its properties can be null, when they aren't set via the
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/SecureRpcHelper.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/SecureRpcHelper.java b/java/kudu-client/src/main/java/org/apache/kudu/client/SecureRpcHelper.java
index 8b48efa..269b256 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/SecureRpcHelper.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/SecureRpcHelper.java
@@ -23,20 +23,8 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-package org.apache.kudu.client;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableSet;
-import com.google.protobuf.ByteString;
-import com.google.protobuf.ZeroCopyLiteralByteString;
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.buffer.ChannelBuffers;
-import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.Channels;
-import org.apache.kudu.annotations.InterfaceAudience;
-import org.apache.kudu.rpc.RpcHeader;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+package org.apache.kudu.client;
import java.util.Map;
import java.util.Set;
@@ -52,6 +40,20 @@ import javax.security.sasl.Sasl;
import javax.security.sasl.SaslClient;
import javax.security.sasl.SaslException;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableSet;
+import com.google.protobuf.ByteString;
+import com.google.protobuf.ZeroCopyLiteralByteString;
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.Channels;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.kudu.annotations.InterfaceAudience;
+import org.apache.kudu.rpc.RpcHeader;
+
@InterfaceAudience.Private
public class SecureRpcHelper {
@@ -143,7 +145,7 @@ public class SecureRpcHelper {
* buffer payload.
*/
public ChannelBuffer unwrap(ChannelBuffer payload) {
- if(!useWrap) {
+ if (!useWrap) {
return payload;
}
int len = payload.readInt();
@@ -162,7 +164,7 @@ public class SecureRpcHelper {
* into the proper payload (ie encryption, signature, etc)
*/
public ChannelBuffer wrap(ChannelBuffer content) {
- if(!useWrap) {
+ if (!useWrap) {
return content;
}
try {
@@ -174,7 +176,7 @@ public class SecureRpcHelper {
ret.writeInt(wrapped.length);
ret.writeBytes(wrapped);
if (LOG.isDebugEnabled()) {
- LOG.debug("Wrapped payload: "+Bytes.pretty(ret));
+ LOG.debug("Wrapped payload: " + Bytes.pretty(ret));
}
return ret;
} catch (SaslException e) {
@@ -212,8 +214,9 @@ public class SecureRpcHelper {
serverFeatures = features.build();
byte[] saslToken = new byte[0];
- if (saslClient.hasInitialResponse())
+ if (saslClient.hasInitialResponse()) {
saslToken = saslClient.evaluateChallenge(saslToken);
+ }
RpcHeader.SaslMessagePB.Builder builder = RpcHeader.SaslMessagePB.newBuilder();
if (saslToken != null) {
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/ServerInfo.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/ServerInfo.java b/java/kudu-client/src/main/java/org/apache/kudu/client/ServerInfo.java
index 999f7f2..39ac597 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/ServerInfo.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/ServerInfo.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
import org.apache.kudu.annotations.InterfaceAudience;
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/SessionConfiguration.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/SessionConfiguration.java b/java/kudu-client/src/main/java/org/apache/kudu/client/SessionConfiguration.java
index a651ae6..fe3485b 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/SessionConfiguration.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/SessionConfiguration.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
import org.apache.kudu.annotations.InterfaceAudience;
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/Statistics.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/Statistics.java b/java/kudu-client/src/main/java/org/apache/kudu/client/Statistics.java
index da09b5e..5f595c8 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/Statistics.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/Statistics.java
@@ -14,8 +14,14 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
+import java.nio.charset.Charset;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicLongArray;
+
import com.google.common.collect.Sets;
import org.apache.kudu.annotations.InterfaceAudience;
@@ -23,12 +29,6 @@ import org.apache.kudu.annotations.InterfaceStability;
import org.apache.kudu.util.Slice;
import org.apache.kudu.util.Slices;
-import java.nio.charset.Charset;
-import java.util.Collections;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicLongArray;
-
/**
* A Statistics belongs to a specific AsyncKuduClient. It stores client-level
@@ -46,7 +46,8 @@ import java.util.concurrent.atomic.AtomicLongArray;
@InterfaceAudience.Public
@InterfaceStability.Evolving
public class Statistics {
- private final ConcurrentHashMap<String, Statistics.TabletStatistics> stsMap = new ConcurrentHashMap<>();
+ private final ConcurrentHashMap<String, Statistics.TabletStatistics> stsMap =
+ new ConcurrentHashMap<>();
/**
* The statistic enum to pass when querying.
@@ -90,7 +91,7 @@ public class Statistics {
}
private final int idx;
- };
+ }
/**
* Get the statistic count of this tablet.
@@ -218,9 +219,9 @@ public class Statistics {
}
static class TabletStatistics {
- final private AtomicLongArray statistics;
- final private String tableName;
- final private String tabletId;
+ private final AtomicLongArray statistics;
+ private final String tableName;
+ private final String tabletId;
TabletStatistics(String tableName, String tabletId) {
this.tableName = tableName;
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/Status.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/Status.java b/java/kudu-client/src/main/java/org/apache/kudu/client/Status.java
index 2592e17..07be8b1 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/Status.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/Status.java
@@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
+
package org.apache.kudu.client;
import org.apache.kudu.WireProtocol;
@@ -91,7 +92,7 @@ public class Status {
static Status fromPB(WireProtocol.AppStatusPB pb) {
return new Status(pb);
}
-
+ // CHECKSTYLE:OFF
public static Status OK() {
return STATIC_OK;
}
@@ -221,63 +222,81 @@ public class Status {
public static Status EndOfFile(String msg, int posixCode) {
return new Status(WireProtocol.AppStatusPB.ErrorCode.END_OF_FILE, msg, posixCode);
}
-
+ // CHECKSTYLE:ON
// Boolean status checks.
public boolean ok() {
return appStatusPB.getCode() == WireProtocol.AppStatusPB.ErrorCode.OK;
}
+
public boolean isCorruption() {
return appStatusPB.getCode() == WireProtocol.AppStatusPB.ErrorCode.CORRUPTION;
}
+
public boolean isNotFound() {
return appStatusPB.getCode() == WireProtocol.AppStatusPB.ErrorCode.NOT_FOUND;
}
+
public boolean isNotSupported() {
return appStatusPB.getCode() == WireProtocol.AppStatusPB.ErrorCode.NOT_SUPPORTED;
}
+
public boolean isInvalidArgument() {
return appStatusPB.getCode() == WireProtocol.AppStatusPB.ErrorCode.INVALID_ARGUMENT;
}
+
public boolean isIOError() {
return appStatusPB.getCode() == WireProtocol.AppStatusPB.ErrorCode.IO_ERROR;
}
+
public boolean isAlreadyPresent() {
return appStatusPB.getCode() == WireProtocol.AppStatusPB.ErrorCode.ALREADY_PRESENT;
}
+
public boolean isRuntimeError() {
return appStatusPB.getCode() == WireProtocol.AppStatusPB.ErrorCode.RUNTIME_ERROR;
}
+
public boolean isNetworkError() {
return appStatusPB.getCode() == WireProtocol.AppStatusPB.ErrorCode.NETWORK_ERROR;
}
+
public boolean isIllegalState() {
return appStatusPB.getCode() == WireProtocol.AppStatusPB.ErrorCode.ILLEGAL_STATE;
}
+
public boolean isNotAuthorized() {
return appStatusPB.getCode() == WireProtocol.AppStatusPB.ErrorCode.NOT_AUTHORIZED;
}
+
public boolean isAborted() {
return appStatusPB.getCode() == WireProtocol.AppStatusPB.ErrorCode.ABORTED;
}
+
public boolean isRemoteError() {
return appStatusPB.getCode() == WireProtocol.AppStatusPB.ErrorCode.REMOTE_ERROR;
}
+
public boolean isServiceUnavailable() {
return appStatusPB.getCode() == WireProtocol.AppStatusPB.ErrorCode.SERVICE_UNAVAILABLE;
}
+
public boolean isTimedOut() {
return appStatusPB.getCode() == WireProtocol.AppStatusPB.ErrorCode.TIMED_OUT;
}
+
public boolean isUninitialized() {
return appStatusPB.getCode() == WireProtocol.AppStatusPB.ErrorCode.UNINITIALIZED;
}
+
public boolean isConfigurationError() {
return appStatusPB.getCode() == WireProtocol.AppStatusPB.ErrorCode.CONFIGURATION_ERROR;
}
+
public boolean isIncomplete() {
return appStatusPB.getCode() == WireProtocol.AppStatusPB.ErrorCode.INCOMPLETE;
}
+
public boolean isEndOfFile() {
return appStatusPB.getCode() == WireProtocol.AppStatusPB.ErrorCode.END_OF_FILE;
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/22067edb/java/kudu-client/src/main/java/org/apache/kudu/client/TableLocationsCache.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/TableLocationsCache.java b/java/kudu-client/src/main/java/org/apache/kudu/client/TableLocationsCache.java
index 97c68e7..25678ce 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/TableLocationsCache.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/TableLocationsCache.java
@@ -14,15 +14,8 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package org.apache.kudu.client;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
-import com.google.common.primitives.UnsignedBytes;
-import org.apache.kudu.annotations.InterfaceAudience;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+package org.apache.kudu.client;
import java.util.ArrayList;
import java.util.Comparator;
@@ -35,6 +28,14 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Preconditions;
+import com.google.common.primitives.UnsignedBytes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.kudu.annotations.InterfaceAudience;
+
/**
* A cache of the tablet locations in a table, keyed by partition key. Entries
* in the cache are either tablets or non-covered ranges.
@@ -141,7 +142,8 @@ class TableLocationsCache {
if (Bytes.memcmp(requestPartitionKey, firstLowerBound) < 0) {
// If the first tablet is past the requested partition key, then the
// partition key falls in an initial non-covered range, such as A.
- newEntries.add(Entry.nonCoveredRange(AsyncKuduClient.EMPTY_ARRAY, firstLowerBound, deadline));
+ newEntries.add(
+ Entry.nonCoveredRange(AsyncKuduClient.EMPTY_ARRAY, firstLowerBound, deadline));
}
// lastUpperBound tracks the upper bound of the previously processed
@@ -167,7 +169,8 @@ class TableLocationsCache {
tablets.size() < AsyncKuduClient.MAX_RETURNED_TABLE_LOCATIONS) {
// There is a non-covered range between the last tablet and the end of the
// partition key space, such as F.
- newEntries.add(Entry.nonCoveredRange(lastUpperBound, AsyncKuduClient.EMPTY_ARRAY, deadline));
+ newEntries.add(
+ Entry.nonCoveredRange(lastUpperBound, AsyncKuduClient.EMPTY_ARRAY, deadline));
}
}