You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ra...@apache.org on 2010/03/08 23:25:09 UTC
svn commit: r920548 [1/5] - in /hadoop/hbase/trunk: ./
core/src/main/java/org/apache/hadoop/hbase/client/
core/src/main/java/org/apache/hadoop/hbase/filter/
core/src/main/java/org/apache/hadoop/hbase/ipc/
core/src/main/java/org/apache/hadoop/hbase/mast...
Author: rawson
Date: Mon Mar 8 22:25:06 2010
New Revision: 920548
URL: http://svn.apache.org/viewvc?rev=920548&view=rev
Log:
Javadoc, copyright, static analysis cleanup. Bug fix in HConnectionManager.java, code removal in Put.java.
Modified:
hadoop/hbase/trunk/.gitignore
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/Delete.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/Get.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HConnection.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HTable.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HTableFactory.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HTableInterfaceFactory.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HTablePool.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/MetaScanner.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/MultiPut.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/MultiPutResponse.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/NoServerForRegionException.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/Put.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/RegionOfflineException.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/Result.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/ResultScanner.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/RetriesExhaustedException.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/Row.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/RowLock.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/Scan.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/ScannerCallable.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/ScannerTimeoutException.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/ServerCallable.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/ServerConnection.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/ServerConnectionManager.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/UnmodifyableHColumnDescriptor.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/UnmodifyableHRegionInfo.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/UnmodifyableHTableDescriptor.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/package-info.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/filter/BinaryComparator.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/filter/BinaryPrefixComparator.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/filter/ColumnCountGetFilter.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/filter/CompareFilter.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/filter/Filter.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/filter/FilterList.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/filter/FirstKeyOnlyFilter.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/filter/InclusiveStopFilter.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/filter/InvalidRowFilterException.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/filter/PageFilter.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/filter/PrefixFilter.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/filter/QualifierFilter.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/filter/RegexStringComparator.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/filter/RowFilter.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/filter/SingleColumnValueExcludeFilter.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/filter/SingleColumnValueFilter.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/filter/SkipFilter.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/filter/SubstringComparator.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/filter/ValueFilter.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/filter/WhileMatchFilter.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/filter/WritableByteArrayComparable.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/filter/package-info.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/ipc/HBaseRPC.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/ipc/HBaseRPCErrorHandler.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/ipc/HBaseRPCProtocolVersion.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/ipc/HBaseRPCStatistics.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/ipc/HBaseRpcMetrics.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/ipc/HBaseServer.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/ipc/HMasterInterface.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/ipc/HMasterRegionInterface.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/ipc/HRegionInterface.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/AddColumn.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/BaseScanner.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ChangeTableState.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ColumnOperation.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/DeleteColumn.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/InvalidColumnNameException.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/MetaRegion.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/MetaScanner.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ModifyColumn.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ModifyTableMeta.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/NotAllMetaRegionsOnlineException.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/OldLogsCleaner.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ProcessRegionClose.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ProcessRegionOpen.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ProcessRegionStatusChange.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ProcessServerShutdown.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/RegionManager.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/RegionServerOperation.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/RetryableMetaOperation.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/RootScanner.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/TableDelete.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/TableOperation.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/master/ZKMasterAddressWatcher.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/ChangedReadersObserver.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/ColumnCount.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/DeleteCompare.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/DeleteTracker.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/FlushRequester.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/InternalScanner.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/KeyValueHeap.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/KeyValueScanner.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/KeyValueSkipListSet.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/LogRoller.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/LruHashMap.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/MinorCompactingStoreScanner.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/NoSuchColumnFamilyException.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/QueryMatcher.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServerRunningException.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/ScanDeleteTracker.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/ScanWildcardColumnTracker.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileGetScan.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/WildcardColumnTracker.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/WrongRegionException.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerStatistics.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/util/Base64.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/util/Bytes.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/util/ClassSize.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/util/CompressionTest.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/util/FileSystemVersionException.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/util/Hash.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/util/InfoServer.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/util/JenkinsHash.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/util/Keying.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/util/Merge.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/util/MetaUtils.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/util/MurmurHash.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/util/Pair.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/util/Sleeper.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/util/SoftValue.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/util/SoftValueMap.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/util/SoftValueSortedMap.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/util/Strings.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/util/Threads.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/util/VersionInfo.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/util/Writables.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/zookeeper/HQuorumPeer.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKServerTool.java
hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java
Modified: hadoop/hbase/trunk/.gitignore
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/.gitignore?rev=920548&r1=920547&r2=920548&view=diff
==============================================================================
--- hadoop/hbase/trunk/.gitignore (original)
+++ hadoop/hbase/trunk/.gitignore Mon Mar 8 22:25:06 2010
@@ -9,3 +9,4 @@
/contrib/stargate/target/
/contrib/transactional/target/
/core/target/
+*.iml
Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/Delete.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/Delete.java?rev=920548&r1=920547&r2=920548&view=diff
==============================================================================
--- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/Delete.java (original)
+++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/Delete.java Mon Mar 8 22:25:06 2010
@@ -1,5 +1,5 @@
/*
- * Copyright 2009 The Apache Software Foundation
+ * Copyright 2010 The Apache Software Foundation
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -20,6 +20,11 @@
package org.apache.hadoop.hbase.client;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.io.Writable;
+
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
@@ -28,11 +33,6 @@
import java.util.Map;
import java.util.TreeMap;
-import org.apache.hadoop.io.Writable;
-import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.util.Bytes;
-
/**
* Used to perform Delete operations on a single row.
* <p>
@@ -40,15 +40,15 @@
* to delete. To further define the scope of what to delete, perform
* additional methods as outlined below.
* <p>
- * To delete specific families, execute {@link #deleteFamily(byte []) deleteFamily}
+ * To delete specific families, execute {@link #deleteFamily(byte[]) deleteFamily}
* for each family to delete.
* <p>
* To delete multiple versions of specific columns, execute
- * {@link #deleteColumns(byte [],byte []) deleteColumns}
+ * {@link #deleteColumns(byte[], byte[]) deleteColumns}
* for each column to delete.
* <p>
* To delete specific versions of specific columns, execute
- * {@link #deleteColumn(byte [],byte [],long) deleteColumn}
+ * {@link #deleteColumn(byte[], byte[], long) deleteColumn}
* for each column version to delete.
* <p>
* Specifying timestamps, deleteFamily and deleteColumns will delete all
@@ -142,6 +142,7 @@
* Overrides previous calls to deleteColumn and deleteColumns for the
* specified family.
* @param family family name
+ * @return this for invocation chaining
*/
public Delete deleteFamily(byte [] family) {
this.deleteFamily(family, HConstants.LATEST_TIMESTAMP);
@@ -156,6 +157,7 @@
* specified family.
* @param family family name
* @param timestamp maximum version timestamp
+ * @return this for invocation chaining
*/
public Delete deleteFamily(byte [] family, long timestamp) {
List<KeyValue> list = familyMap.get(family);
@@ -173,6 +175,7 @@
* Delete all versions of the specified column.
* @param family family name
* @param qualifier column qualifier
+ * @return this for invocation chaining
*/
public Delete deleteColumns(byte [] family, byte [] qualifier) {
this.deleteColumns(family, qualifier, HConstants.LATEST_TIMESTAMP);
@@ -185,6 +188,7 @@
* @param family family name
* @param qualifier column qualifier
* @param timestamp maximum version timestamp
+ * @return this for invocation chaining
*/
public Delete deleteColumns(byte [] family, byte [] qualifier, long timestamp) {
List<KeyValue> list = familyMap.get(family);
@@ -204,6 +208,7 @@
* the fetched cells timestamp.
* @param family family name
* @param qualifier column qualifier
+ * @return this for invocation chaining
*/
public Delete deleteColumn(byte [] family, byte [] qualifier) {
this.deleteColumn(family, qualifier, HConstants.LATEST_TIMESTAMP);
@@ -215,6 +220,7 @@
* @param family family name
* @param qualifier column qualifier
* @param timestamp version timestamp
+ * @return this for invocation chaining
*/
public Delete deleteColumn(byte [] family, byte [] qualifier, long timestamp) {
List<KeyValue> list = familyMap.get(family);
@@ -351,6 +357,7 @@
* @param column colon-delimited family and qualifier
* @param timestamp maximum version timestamp
* @deprecated use {@link #deleteColumn(byte[], byte[], long)} instead
+ * @return this for invocation chaining
*/
public Delete deleteColumns(byte [] column, long timestamp) {
byte [][] parts = KeyValue.parseColumn(column);
@@ -363,6 +370,7 @@
* <code>family:qualifier</code> notation.
* @param column colon-delimited family and qualifier
* @deprecated use {@link #deleteColumn(byte[], byte[])} instead
+ * @return this for invocation chaining
*/
public Delete deleteColumn(byte [] column) {
byte [][] parts = KeyValue.parseColumn(column);
Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/Get.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/Get.java?rev=920548&r1=920547&r2=920548&view=diff
==============================================================================
--- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/Get.java (original)
+++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/Get.java Mon Mar 8 22:25:06 2010
@@ -1,5 +1,5 @@
/**
- * Copyright 2009 The Apache Software Foundation
+ * Copyright 2010 The Apache Software Foundation
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,6 +19,14 @@
*/
package org.apache.hadoop.hbase.client;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.filter.Filter;
+import org.apache.hadoop.hbase.io.TimeRange;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.io.Writable;
+import org.apache.hadoop.io.WritableFactories;
+
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
@@ -28,15 +36,6 @@
import java.util.TreeMap;
import java.util.TreeSet;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.filter.Filter;
-import org.apache.hadoop.hbase.io.HbaseObjectWritable;
-import org.apache.hadoop.hbase.io.TimeRange;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.io.Writable;
-import org.apache.hadoop.io.WritableFactories;
-
/**
* Used to perform Get operations on a single row.
* <p>
@@ -138,6 +137,7 @@
* @param minStamp minimum timestamp value, inclusive
* @param maxStamp maximum timestamp value, exclusive
* @throws IOException if invalid time range
+ * @return this for invocation chaining
*/
public Get setTimeRange(long minStamp, long maxStamp)
throws IOException {
@@ -147,7 +147,8 @@
/**
* Get versions of columns with the specified timestamp.
- * @param timestamp version timestamp
+ * @param timestamp version timestamp
+ * @return this for invocation chaining
*/
public Get setTimeStamp(long timestamp) {
try {
@@ -160,6 +161,7 @@
/**
* Get all available versions.
+ * @return this for invocation chaining
*/
public Get setMaxVersions() {
this.maxVersions = Integer.MAX_VALUE;
@@ -170,6 +172,7 @@
* Get up to the specified number of versions of each column.
* @param maxVersions maximum versions for each column
* @throws IOException if invalid number of versions
+ * @return this for invocation chaining
*/
public Get setMaxVersions(int maxVersions) throws IOException {
if(maxVersions <= 0) {
@@ -184,6 +187,7 @@
* Only {@link Filter#filterKeyValue(KeyValue)} is called AFTER all tests
* for ttl, column match, deletes and max versions have been run.
* @param filter filter to run on the server
+ * @return this for invocation chaining
*/
public Get setFilter(Filter filter) {
this.filter = filter;
@@ -280,9 +284,10 @@
sb.append("row=");
sb.append(Bytes.toString(this.row));
sb.append(", maxVersions=");
- sb.append("" + this.maxVersions);
+ sb.append("").append(this.maxVersions);
sb.append(", timeRange=");
- sb.append("[" + this.tr.getMin() + "," + this.tr.getMax() + ")");
+ sb.append("[").append(this.tr.getMin()).append(",");
+ sb.append(this.tr.getMax()).append(")");
sb.append(", families=");
if(this.familyMap.size() == 0) {
sb.append("ALL");
@@ -398,19 +403,22 @@
}
}
- /**
+ /**
* Adds an array of columns specified the old format, family:qualifier.
* <p>
* Overrides previous calls to addFamily for any families in the input.
* @param columns array of columns, formatted as <pre>family:qualifier</pre>
* @deprecated issue multiple {@link #addColumn(byte[], byte[])} instead
+ * @return this for invocation chaining
*/
+ @SuppressWarnings({"deprecation"})
public Get addColumns(byte [][] columns) {
if (columns == null) return this;
- for(int i = 0; i < columns.length; i++) {
+ for (byte[] column : columns) {
try {
- addColumn(columns[i]);
- } catch(Exception e) {}
+ addColumn(column);
+ } catch (Exception ignored) {
+ }
}
return this;
}
Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java?rev=920548&r1=920547&r2=920548&view=diff
==============================================================================
--- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java (original)
+++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java Mon Mar 8 22:25:06 2010
@@ -1,5 +1,5 @@
/**
- * Copyright 2007 The Apache Software Foundation
+ * Copyright 2010 The Apache Software Foundation
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,10 +19,6 @@
*/
package org.apache.hadoop.hbase.client;
-import java.io.IOException;
-import java.util.Map;
-import java.util.NavigableMap;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
@@ -47,6 +43,10 @@
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.ipc.RemoteException;
+import java.io.IOException;
+import java.util.Map;
+import java.util.NavigableMap;
+
/**
* Provides administrative functions for HBase
*/
@@ -63,7 +63,7 @@
* Constructor
*
* @param conf Configuration object
- * @throws MasterNotRunningException
+ * @throws MasterNotRunningException if the master is not running
*/
public HBaseAdmin(Configuration conf) throws MasterNotRunningException {
this.connection = HConnectionManager.getConnection(conf);
@@ -80,7 +80,7 @@
/**
* @return proxy connection to master server for this instance
- * @throws MasterNotRunningException
+ * @throws MasterNotRunningException if the master is not running
*/
public HMasterInterface getMaster() throws MasterNotRunningException{
return this.connection.getMaster();
@@ -94,7 +94,7 @@
/**
* @param tableName Table to check.
* @return True if table exists already.
- * @throws MasterNotRunningException
+ * @throws MasterNotRunningException if the master is not running
*/
public boolean tableExists(final String tableName)
throws MasterNotRunningException {
@@ -104,7 +104,7 @@
/**
* @param tableName Table to check.
* @return True if table exists already.
- * @throws MasterNotRunningException
+ * @throws MasterNotRunningException if the master is not running
*/
public boolean tableExists(final byte [] tableName)
throws MasterNotRunningException {
@@ -122,7 +122,7 @@
* Right now, it only exists as part of the META table's region info.
*
* @return - returns an array of HTableDescriptors
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public HTableDescriptor[] listTables() throws IOException {
return this.connection.listTables();
@@ -133,7 +133,7 @@
* Method for getting the tableDescriptor
* @param tableName as a byte []
* @return the tableDescriptor
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public HTableDescriptor getTableDescriptor(final byte [] tableName)
throws IOException {
@@ -158,7 +158,7 @@
* @throws TableExistsException if table already exists (If concurrent
* threads, the table may have been created between test-for-existence
* and attempt-at-creation).
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public void createTable(HTableDescriptor desc)
throws IOException {
@@ -195,7 +195,7 @@
* @throws TableExistsException if table already exists (If concurrent
* threads, the table may have been created between test-for-existence
* and attempt-at-creation).
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public void createTableAsync(HTableDescriptor desc)
throws IOException {
@@ -215,7 +215,7 @@
* Synchronous operation.
*
* @param tableName name of table to delete
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public void deleteTable(final String tableName) throws IOException {
deleteTable(Bytes.toBytes(tableName));
@@ -226,7 +226,7 @@
* Synchronous operation.
*
* @param tableName name of table to delete
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public void deleteTable(final byte [] tableName) throws IOException {
if (this.master == null) {
@@ -257,10 +257,9 @@
break;
}
boolean found = false;
- for (int i = 0; i < values.length; i++) {
- Result r = values[i];
+ for (Result r : values) {
NavigableMap<byte[], byte[]> infoValues =
- r.getFamilyMap(HConstants.CATALOG_FAMILY);
+ r.getFamilyMap(HConstants.CATALOG_FAMILY);
for (Map.Entry<byte[], byte[]> e : infoValues.entrySet()) {
if (Bytes.equals(e.getKey(), HConstants.REGIONINFO_QUALIFIER)) {
info = (HRegionInfo) Writables.getWritable(e.getValue(), info);
@@ -310,7 +309,7 @@
* Synchronous operation.
*
* @param tableName name of the table
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public void enableTable(final String tableName) throws IOException {
enableTable(Bytes.toBytes(tableName));
@@ -321,7 +320,7 @@
* Synchronous operation.
*
* @param tableName name of the table
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public void enableTable(final byte [] tableName) throws IOException {
if (this.master == null) {
@@ -366,7 +365,7 @@
* Synchronous operation.
*
* @param tableName name of table
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public void disableTable(final String tableName) throws IOException {
disableTable(Bytes.toBytes(tableName));
@@ -378,7 +377,7 @@
* Synchronous operation.
*
* @param tableName name of table
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public void disableTable(final byte [] tableName) throws IOException {
if (this.master == null) {
@@ -419,7 +418,7 @@
/**
* @param tableName name of table to check
* @return true if table is on-line
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public boolean isTableEnabled(String tableName) throws IOException {
return isTableEnabled(Bytes.toBytes(tableName));
@@ -427,7 +426,7 @@
/**
* @param tableName name of table to check
* @return true if table is on-line
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public boolean isTableEnabled(byte[] tableName) throws IOException {
return connection.isTableEnabled(tableName);
@@ -436,7 +435,7 @@
/**
* @param tableName name of table to check
* @return true if table is off-line
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public boolean isTableDisabled(byte[] tableName) throws IOException {
return connection.isTableDisabled(tableName);
@@ -445,7 +444,7 @@
/**
* @param tableName name of table to check
* @return true if all regions of the table are available
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public boolean isTableAvailable(byte[] tableName) throws IOException {
return connection.isTableAvailable(tableName);
@@ -454,7 +453,7 @@
/**
* @param tableName name of table to check
* @return true if all regions of the table are available
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public boolean isTableAvailable(String tableName) throws IOException {
return connection.isTableAvailable(Bytes.toBytes(tableName));
@@ -466,7 +465,7 @@
*
* @param tableName name of the table to add column to
* @param column column descriptor of column to be added
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public void addColumn(final String tableName, HColumnDescriptor column)
throws IOException {
@@ -479,7 +478,7 @@
*
* @param tableName name of the table to add column to
* @param column column descriptor of column to be added
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public void addColumn(final byte [] tableName, HColumnDescriptor column)
throws IOException {
@@ -500,7 +499,7 @@
*
* @param tableName name of table
* @param columnName name of column to be deleted
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public void deleteColumn(final String tableName, final String columnName)
throws IOException {
@@ -513,7 +512,7 @@
*
* @param tableName name of table
* @param columnName name of column to be deleted
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public void deleteColumn(final byte [] tableName, final byte [] columnName)
throws IOException {
@@ -535,7 +534,7 @@
* @param tableName name of table
* @param columnName name of column to be modified
* @param descriptor new column descriptor to use
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public void modifyColumn(final String tableName, final String columnName,
HColumnDescriptor descriptor)
@@ -551,7 +550,7 @@
* @param tableName name of table
* @param columnName name of column to be modified
* @param descriptor new column descriptor to use
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public void modifyColumn(final byte [] tableName, final byte [] columnName,
HColumnDescriptor descriptor)
@@ -571,10 +570,10 @@
* Close a region. For expert-admins.
* Asynchronous operation.
*
- * @param regionname
+ * @param regionname region name to close
* @param args Optional server name. Otherwise, we'll send close to the
* server registered in .META.
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public void closeRegion(final String regionname, final Object... args)
throws IOException {
@@ -585,10 +584,10 @@
* Close a region. For expert-admins.
* Asynchronous operation.
*
- * @param regionname
+ * @param regionname region name to close
* @param args Optional server name. Otherwise, we'll send close to the
* server registered in .META.
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public void closeRegion(final byte [] regionname, final Object... args)
throws IOException {
@@ -598,9 +597,7 @@
Object [] newargs = new Object[len + xtraArgsCount];
newargs[0] = regionname;
if(args != null) {
- for (int i = 0; i < len; i++) {
- newargs[i + xtraArgsCount] = args[i];
- }
+ System.arraycopy(args, 0, newargs, xtraArgsCount, len);
}
modifyTable(HConstants.META_TABLE_NAME, HConstants.Modify.CLOSE_REGION,
newargs);
@@ -610,8 +607,8 @@
* Flush a table or an individual region.
* Asynchronous operation.
*
- * @param tableNameOrRegionName
- * @throws IOException
+ * @param tableNameOrRegionName table or region to flush
+ * @throws IOException if a remote or network exception occurs
*/
public void flush(final String tableNameOrRegionName) throws IOException {
flush(Bytes.toBytes(tableNameOrRegionName));
@@ -621,8 +618,8 @@
* Flush a table or an individual region.
* Asynchronous operation.
*
- * @param tableNameOrRegionName
- * @throws IOException
+ * @param tableNameOrRegionName table or region to flush
+ * @throws IOException if a remote or network exception occurs
*/
public void flush(final byte [] tableNameOrRegionName) throws IOException {
modifyTable(tableNameOrRegionName, HConstants.Modify.TABLE_FLUSH);
@@ -632,8 +629,8 @@
* Compact a table or an individual region.
* Asynchronous operation.
*
- * @param tableNameOrRegionName
- * @throws IOException
+ * @param tableNameOrRegionName table or region to compact
+ * @throws IOException if a remote or network exception occurs
*/
public void compact(final String tableNameOrRegionName) throws IOException {
compact(Bytes.toBytes(tableNameOrRegionName));
@@ -643,8 +640,8 @@
* Compact a table or an individual region.
* Asynchronous operation.
*
- * @param tableNameOrRegionName
- * @throws IOException
+ * @param tableNameOrRegionName table or region to compact
+ * @throws IOException if a remote or network exception occurs
*/
public void compact(final byte [] tableNameOrRegionName) throws IOException {
modifyTable(tableNameOrRegionName, HConstants.Modify.TABLE_COMPACT);
@@ -654,8 +651,8 @@
* Major compact a table or an individual region.
* Asynchronous operation.
*
- * @param tableNameOrRegionName
- * @throws IOException
+ * @param tableNameOrRegionName table or region to major compact
+ * @throws IOException if a remote or network exception occurs
*/
public void majorCompact(final String tableNameOrRegionName)
throws IOException {
@@ -666,8 +663,8 @@
* Major compact a table or an individual region.
* Asynchronous operation.
*
- * @param tableNameOrRegionName
- * @throws IOException
+ * @param tableNameOrRegionName table or region to major compact
+ * @throws IOException if a remote or network exception occurs
*/
public void majorCompact(final byte [] tableNameOrRegionName)
throws IOException {
@@ -678,8 +675,8 @@
* Split a table or an individual region.
* Asynchronous operation.
*
- * @param tableNameOrRegionName
- * @throws IOException
+ * @param tableNameOrRegionName table or region to split
+ * @throws IOException if a remote or network exception occurs
*/
public void split(final String tableNameOrRegionName) throws IOException {
split(Bytes.toBytes(tableNameOrRegionName));
@@ -689,8 +686,8 @@
* Split a table or an individual region.
* Asynchronous operation.
*
- * @param tableNameOrRegionName
- * @throws IOException
+ * @param tableNameOrRegionName table to region to split
+ * @throws IOException if a remote or network exception occurs
*/
public void split(final byte [] tableNameOrRegionName) throws IOException {
modifyTable(tableNameOrRegionName, HConstants.Modify.TABLE_SPLIT);
@@ -722,7 +719,7 @@
*
* @param tableName name of table.
* @param htd modified description of the table
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public void modifyTable(final byte [] tableName, HTableDescriptor htd)
throws IOException {
@@ -737,7 +734,7 @@
* region.
* @param op table modification operation
* @param args operation specific arguments
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public void modifyTable(final byte [] tableName, HConstants.Modify op,
Object... args)
@@ -796,7 +793,7 @@
} else if (args[i] instanceof String) {
arr[i] = new ImmutableBytesWritable(Bytes.toBytes((String)args[i]));
} else if (args[i] instanceof Boolean) {
- arr[i] = new BooleanWritable(((Boolean)args[i]).booleanValue());
+ arr[i] = new BooleanWritable((Boolean) args[i]);
} else {
throw new IllegalArgumentException("Requires byte [] or " +
"ImmutableBytesWritable, not " + args[i]);
@@ -815,7 +812,7 @@
/**
* Shuts down the HBase instance
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public synchronized void shutdown() throws IOException {
if (this.master == null) {
@@ -832,7 +829,7 @@
/**
* @return cluster status
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public ClusterStatus getClusterStatus() throws IOException {
if (this.master == null) {
@@ -850,8 +847,8 @@
/**
* Check to see if HBase is running. Throw an exception if not.
*
- * @param conf
- * @throws MasterNotRunningException
+ * @param conf system configuration
+ * @throws MasterNotRunningException if a remote or network exception occurs
*/
public static void checkHBaseAvailable(Configuration conf)
throws MasterNotRunningException {
Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HConnection.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HConnection.java?rev=920548&r1=920547&r2=920548&view=diff
==============================================================================
--- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HConnection.java (original)
+++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HConnection.java Mon Mar 8 22:25:06 2010
@@ -1,5 +1,5 @@
/**
- * Copyright 2007 The Apache Software Foundation
+ * Copyright 2010 The Apache Software Foundation
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,11 +19,6 @@
*/
package org.apache.hadoop.hbase.client;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-
import org.apache.hadoop.hbase.HRegionLocation;
import org.apache.hadoop.hbase.HServerAddress;
import org.apache.hadoop.hbase.HTableDescriptor;
@@ -32,6 +27,11 @@
import org.apache.hadoop.hbase.ipc.HRegionInterface;
import org.apache.hadoop.hbase.zookeeper.ZooKeeperWrapper;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+
/**
* Cluster connection.
* {@link HConnectionManager} manages instances of this class.
@@ -40,13 +40,13 @@
/**
* Retrieve ZooKeeperWrapper used by the connection.
* @return ZooKeeperWrapper handle being used by the connection.
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public ZooKeeperWrapper getZooKeeperWrapper() throws IOException;
/**
* @return proxy connection to master server for this instance
- * @throws MasterNotRunningException
+ * @throws MasterNotRunningException if the master is not running
*/
public HMasterInterface getMaster() throws MasterNotRunningException;
@@ -57,7 +57,7 @@
* Checks if <code>tableName</code> exists.
* @param tableName Table to check.
* @return True if table exists already.
- * @throws MasterNotRunningException
+ * @throws MasterNotRunningException if the master is not running
*/
public boolean tableExists(final byte [] tableName)
throws MasterNotRunningException;
@@ -66,23 +66,23 @@
* A table that isTableEnabled == false and isTableDisabled == false
* is possible. This happens when a table has a lot of regions
* that must be processed.
- * @param tableName
+ * @param tableName table name
* @return true if the table is enabled, false otherwise
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public boolean isTableEnabled(byte[] tableName) throws IOException;
/**
- * @param tableName
+ * @param tableName table name
* @return true if the table is disabled, false otherwise
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public boolean isTableDisabled(byte[] tableName) throws IOException;
/**
- * @param tableName
+ * @param tableName table name
* @return true if all regions of the table are available, false otherwise
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public boolean isTableAvailable(byte[] tableName) throws IOException;
@@ -94,14 +94,14 @@
* Right now, it only exists as part of the META table's region info.
*
* @return - returns an array of HTableDescriptors
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public HTableDescriptor[] listTables() throws IOException;
/**
- * @param tableName
+ * @param tableName table name
* @return table metadata
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public HTableDescriptor getHTableDescriptor(byte[] tableName)
throws IOException;
@@ -113,7 +113,7 @@
* @param row row key you're trying to find the region of
* @return HRegionLocation that describes where to find the reigon in
* question
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public HRegionLocation locateRegion(final byte [] tableName,
final byte [] row)
@@ -131,7 +131,7 @@
* @param row row key you're trying to find the region of
* @return HRegionLocation that describes where to find the reigon in
* question
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public HRegionLocation relocateRegion(final byte [] tableName,
final byte [] row)
@@ -141,7 +141,7 @@
* Establishes a connection to the region server at the specified address.
* @param regionServer - the server to connect to
* @return proxy for HRegionServer
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public HRegionInterface getHRegionConnection(HServerAddress regionServer)
throws IOException;
@@ -151,7 +151,7 @@
* @param regionServer - the server to connect to
* @param getMaster - do we check if master is alive
* @return proxy for HRegionServer
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public HRegionInterface getHRegionConnection(
HServerAddress regionServer, boolean getMaster)
@@ -159,11 +159,11 @@
/**
* Find region location hosting passed row
- * @param tableName
+ * @param tableName table name
* @param row Row to find.
* @param reload If true do not use cache, otherwise bypass.
* @return Location of row.
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
HRegionLocation getRegionLocation(byte [] tableName, byte [] row,
boolean reload)
@@ -175,10 +175,10 @@
* and refinds of missing regions.
*
* @param <T> the type of the return value
- * @param callable
+ * @param callable callable to run
* @return an object of type T
- * @throws IOException
- * @throws RuntimeException
+ * @throws IOException if a remote or network exception occurs
+ * @throws RuntimeException other unspecified error
*/
public <T> T getRegionServerWithRetries(ServerCallable<T> callable)
throws IOException, RuntimeException;
@@ -187,10 +187,10 @@
* Pass in a ServerCallable with your particular bit of logic defined and
* this method will pass it to the defined region server.
* @param <T> the type of the return value
- * @param callable
+ * @param callable callable to run
* @return an object of type T
- * @throws IOException
- * @throws RuntimeException
+ * @throws IOException if a remote or network exception occurs
+ * @throws RuntimeException other unspecified error
*/
public <T> T getRegionServerForWithoutRetries(ServerCallable<T> callable)
throws IOException, RuntimeException;
@@ -201,7 +201,7 @@
* @param list A batch of Puts to process.
* @param tableName The name of the table
* @return Count of committed Puts. On fault, < list.size().
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public int processBatchOfRows(ArrayList<Put> list, byte[] tableName)
throws IOException;
@@ -211,7 +211,7 @@
* @param list A batch of Deletes to process.
* @return Count of committed Deletes. On fault, < list.size().
* @param tableName The name of the table
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public int processBatchOfDeletes(List<Delete> list, byte[] tableName)
throws IOException;
Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java?rev=920548&r1=920547&r2=920548&view=diff
==============================================================================
--- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java (original)
+++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java Mon Mar 8 22:25:06 2010
@@ -1,5 +1,5 @@
/**
- * Copyright 2009 The Apache Software Foundation
+ * Copyright 2010 The Apache Software Foundation
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,22 +19,6 @@
*/
package org.apache.hadoop.hbase.client;
-import java.io.IOException;
-import java.lang.reflect.UndeclaredThrowableException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeSet;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.atomic.AtomicBoolean;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
@@ -64,6 +48,22 @@
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.Watcher.Event.KeeperState;
+import java.io.IOException;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeSet;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+import java.util.concurrent.atomic.AtomicBoolean;
+
/**
* A non-instantiable class that manages connections to multiple tables in
* multiple HBase instances.
@@ -71,8 +71,8 @@
* Used by {@link HTable} and {@link HBaseAdmin}
*/
public class HConnectionManager implements HConstants {
- private static final Delete [] DELETE_ARRAY_TYPE = new Delete[0];
- private static final Put [] PUT_ARRAY_TYPE = new Put[0];
+ private static final Delete [] DELETE_ARRAY_TYPE = new Delete[]{};
+ private static final Put [] PUT_ARRAY_TYPE = new Put[]{};
// Register a shutdown hook, one that cleans up RPC and closes zk sessions.
static {
@@ -112,7 +112,7 @@
/**
* Get the connection object for the instance specified by the configuration
* If no current connection exists, create a new connection for that instance
- * @param conf
+ * @param conf configuration
* @return HConnection object for the instance specified by the configuration
*/
public static HConnection getConnection(Configuration conf) {
@@ -130,13 +130,14 @@
/**
* Delete connection information for the instance specified by configuration
- * @param conf
- * @param stopProxy
+ * @param conf configuration
+ * @param stopProxy stop the proxy as well
*/
public static void deleteConnectionInfo(Configuration conf,
boolean stopProxy) {
synchronized (HBASE_INSTANCES) {
- TableServers t = HBASE_INSTANCES.remove(conf);
+ Integer key = HBaseConfiguration.hashCode(conf);
+ TableServers t = HBASE_INSTANCES.remove(key);
if (t != null) {
t.close(stopProxy);
}
@@ -145,7 +146,7 @@
/**
* Delete information for all connections.
- * @param stopProxy
+ * @param stopProxy stop the proxy as well
*/
public static void deleteAllConnections(boolean stopProxy) {
synchronized (HBASE_INSTANCES) {
@@ -166,9 +167,9 @@
* Get a watcher of a zookeeper connection for a given quorum address.
* If the connection isn't established, a new one is created.
* This acts like a multiton.
- * @param conf
+ * @param conf configuration
* @return ZKW watcher
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public static synchronized ClientZKWatcher getClientZooKeeperWatcher(
Configuration conf) throws IOException {
@@ -193,8 +194,7 @@
/**
* Takes a configuration to pass it to ZKW but won't instanciate it
- * @param conf
- * @throws IOException
+ * @param conf configuration
*/
public ClientZKWatcher(Configuration conf) {
this.conf = conf;
@@ -224,6 +224,7 @@
/**
* Get this watcher's ZKW, instanciate it if necessary.
* @return ZKW
+ * @throws java.io.IOException if a remote or network exception occurs
*/
public synchronized ZooKeeperWrapper getZooKeeperWrapper() throws IOException {
if(zooKeeperWrapper == null) {
@@ -296,7 +297,7 @@
"Unable to find region server interface " + serverClassName, e);
}
- this.pause = conf.getLong("hbase.client.pause", 1 * 1000);
+ this.pause = conf.getLong("hbase.client.pause", 1000);
this.numRetries = conf.getInt("hbase.client.retries.number", 10);
this.maxRPCAttempts = conf.getInt("hbase.client.rpc.maxattempts", 1);
this.rpcTimeout = conf.getLong(HBASE_REGIONSERVER_LEASE_PERIOD_KEY, DEFAULT_HBASE_REGIONSERVER_LEASE_PERIOD);
@@ -327,7 +328,7 @@
}
public HMasterInterface getMaster() throws MasterNotRunningException {
- ZooKeeperWrapper zk = null;
+ ZooKeeperWrapper zk;
try {
zk = getZooKeeperWrapper();
} catch (IOException e) {
@@ -409,8 +410,8 @@
boolean exists = false;
try {
HTableDescriptor[] tables = listTables();
- for (int i = 0; i < tables.length; i++) {
- if (Bytes.equals(tables[i].getName(), tableName)) {
+ for (HTableDescriptor table : tables) {
+ if (Bytes.equals(table.getName(), tableName)) {
exists = true;
}
}
@@ -515,8 +516,8 @@
int rowsOffline = 0;
byte[] startKey =
HRegionInfo.createRegionName(tableName, null, HConstants.ZEROES);
- byte[] endKey = null;
- HRegionInfo currentRegion = null;
+ byte[] endKey;
+ HRegionInfo currentRegion;
Scan scan = new Scan(startKey);
scan.addColumn(CATALOG_FAMILY, REGIONINFO_QUALIFIER);
int rows = this.conf.getInt("hbase.meta.scanner.caching", 100);
@@ -528,13 +529,9 @@
// Open scanner
getRegionServerWithRetries(s);
do {
- HRegionInfo oldRegion = currentRegion;
- if (oldRegion != null) {
- startKey = oldRegion.getEndKey();
- }
currentRegion = s.getHRegionInfo();
- Result r = null;
- Result [] rrs = null;
+ Result r;
+ Result [] rrs;
while ((rrs = getRegionServerWithRetries(s)) != null && rrs.length > 0) {
r = rrs[0];
byte [] value = r.getValue(HConstants.CATALOG_FAMILY,
@@ -651,10 +648,11 @@
* Search one of the meta tables (-ROOT- or .META.) for the HRegionLocation
* info that contains the table and row we're seeking.
*/
+ @SuppressWarnings({"ConstantConditions"})
private HRegionLocation locateRegionInMeta(final byte [] parentTable,
final byte [] tableName, final byte [] row, boolean useCache)
throws IOException {
- HRegionLocation location = null;
+ HRegionLocation location;
// If supposed to be using the cache, then check it for a possible hit.
// Otherwise, delete any existing cached location so it won't interfere.
if (useCache) {
@@ -880,7 +878,7 @@
final byte [] tableName) {
// find the map of cached locations for this table
Integer key = Bytes.mapKey(tableName);
- SoftValueSortedMap<byte [], HRegionLocation> result = null;
+ SoftValueSortedMap<byte [], HRegionLocation> result;
synchronized (this.cachedRegionLocations) {
result = this.cachedRegionLocations.get(key);
// if tableLocations for this table isn't built yet, make one
@@ -1042,7 +1040,8 @@
HRegionInfo.ROOT_REGIONINFO, rootRegionAddress);
}
- public <T> T getRegionServerWithRetries(ServerCallable<T> callable)
+ @SuppressWarnings({"ConstantConditions"})
+ public <T> T getRegionServerWithRetries(ServerCallable<T> callable)
throws IOException, RuntimeException {
List<Throwable> exceptions = new ArrayList<Throwable>();
for(int tries = 0; tries < numRetries; tries++) {
@@ -1093,6 +1092,7 @@
return null;
}
+ @SuppressWarnings({"ConstantConditions"})
private HRegionLocation
getRegionLocationForRowWithRetries(byte[] tableName, byte[] rowKey,
boolean reload)
@@ -1140,29 +1140,29 @@
/**
* This is the method subclasses must implement.
- * @param currentList
- * @param tableName
- * @param row
+ * @param currentList current list of rows
+ * @param tableName table we are processing
+ * @param row row
* @return Count of items processed or -1 if all.
- * @throws IOException
- * @throws RuntimeException
+ * @throws IOException if a remote or network exception occurs
+ * @throws RuntimeException other undefined exception
*/
- abstract int doCall(final List<Row> currentList,
+ abstract int doCall(final List<? extends Row> currentList,
final byte [] row, final byte [] tableName)
throws IOException, RuntimeException;
/**
* Process the passed <code>list</code>.
- * @param list
- * @param tableName
+ * @param list list of rows to process
+ * @param tableName table we are processing
* @return Count of how many added or -1 if all added.
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
int process(final List<? extends Row> list, final byte[] tableName)
throws IOException {
byte [] region = getRegionName(tableName, list.get(0).getRow(), false);
byte [] currentRegion = region;
- boolean isLastRow = false;
+ boolean isLastRow;
boolean retryOnlyOne = false;
List<Row> currentList = new ArrayList<Row>();
int i, tries;
@@ -1250,7 +1250,7 @@
if (list.size() > 1) Collections.sort(list);
Batch b = new Batch(this) {
@Override
- int doCall(final List<Row> currentList, final byte [] row,
+ int doCall(final List<? extends Row> currentList, final byte [] row,
final byte [] tableName)
throws IOException, RuntimeException {
final Put [] puts = currentList.toArray(PUT_ARRAY_TYPE);
@@ -1272,7 +1272,7 @@
if (list.size() > 1) Collections.sort(list);
Batch b = new Batch(this) {
@Override
- int doCall(final List<Row> currentList, final byte [] row,
+ int doCall(final List<? extends Row> currentList, final byte [] row,
final byte [] tableName)
throws IOException, RuntimeException {
final Delete [] deletes = currentList.toArray(DELETE_ARRAY_TYPE);
@@ -1303,6 +1303,7 @@
}
}
+ @SuppressWarnings({"ConstantConditions"})
public void processBatchOfPuts(List<Put> list,
final byte[] tableName, ExecutorService pool) throws IOException {
for ( int tries = 0 ; tries < numRetries && !list.isEmpty(); ++tries) {
@@ -1389,8 +1390,7 @@
" ms!");
try {
Thread.sleep(sleepTime);
- } catch (InterruptedException e) {
-
+ } catch (InterruptedException ignored) {
}
}
}
Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HTable.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HTable.java?rev=920548&r1=920547&r2=920548&view=diff
==============================================================================
--- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HTable.java (original)
+++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HTable.java Mon Mar 8 22:25:06 2010
@@ -1,5 +1,5 @@
/**
- * Copyright 2009 The Apache Software Foundation
+ * Copyright 2010 The Apache Software Foundation
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,21 +19,6 @@
*/
package org.apache.hadoop.hbase.client;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
@@ -52,6 +37,21 @@
import org.apache.hadoop.hbase.util.Pair;
import org.apache.hadoop.hbase.util.Writables;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
/**
* Used to communicate with a single HBase table.
@@ -79,7 +79,7 @@
* Creates an object to access a HBase table
*
* @param tableName name of the table
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public HTable(final String tableName)
throws IOException {
@@ -90,7 +90,7 @@
* Creates an object to access a HBase table
*
* @param tableName name of the table
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public HTable(final byte [] tableName)
throws IOException {
@@ -102,7 +102,7 @@
*
* @param conf configuration object
* @param tableName name of the table
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public HTable(Configuration conf, final String tableName)
throws IOException {
@@ -115,7 +115,7 @@
*
* @param conf configuration object
* @param tableName name of the table
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public HTable(Configuration conf, final byte [] tableName)
throws IOException {
@@ -163,7 +163,7 @@
* TODO Might want to change this to public, would be nice if the number
* of threads would automatically change when servers were added and removed
* @return the number of region servers that are currently running
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
private int getCurrentNrHRS() throws IOException {
HBaseAdmin admin = new HBaseAdmin(this.configuration);
@@ -176,7 +176,7 @@
/**
* @param tableName name of table to check
* @return true if table is on-line
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public static boolean isTableEnabled(String tableName) throws IOException {
return isTableEnabled(Bytes.toBytes(tableName));
@@ -184,7 +184,7 @@
/**
* @param tableName name of table to check
* @return true if table is on-line
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public static boolean isTableEnabled(byte[] tableName) throws IOException {
return isTableEnabled(HBaseConfiguration.create(), tableName);
@@ -194,7 +194,7 @@
* @param conf HBaseConfiguration object
* @param tableName name of table to check
* @return true if table is on-line
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public static boolean isTableEnabled(Configuration conf, String tableName)
throws IOException {
@@ -205,7 +205,7 @@
* @param conf HBaseConfiguration object
* @param tableName name of table to check
* @return true if table is on-line
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public static boolean isTableEnabled(Configuration conf, byte[] tableName)
throws IOException {
@@ -216,7 +216,7 @@
* Find region location hosting passed row using cached info
* @param row Row to find.
* @return Location of row.
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public HRegionLocation getRegionLocation(final String row)
throws IOException {
@@ -227,7 +227,7 @@
* Find region location hosting passed row using cached info
* @param row Row to find.
* @return Location of row.
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public HRegionLocation getRegionLocation(final byte [] row)
throws IOException {
@@ -277,7 +277,7 @@
* Gets the starting row key for every region in the currently open table
*
* @return Array of region starting row keys
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public byte [][] getStartKeys() throws IOException {
return getStartEndKeys().getFirst();
@@ -287,7 +287,7 @@
* Gets the ending row key for every region in the currently open table
*
* @return Array of region ending row keys
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public byte[][] getEndKeys() throws IOException {
return getStartEndKeys().getSecond();
@@ -298,7 +298,7 @@
* open table
*
* @return Pair of arrays of region starting and ending row keys
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
@SuppressWarnings("unchecked")
public Pair<byte[][],byte[][]> getStartEndKeys() throws IOException {
@@ -327,7 +327,7 @@
* Get all the regions and their address for this table
*
* @return A map of HRegionInfo with it's server address
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
public Map<HRegionInfo, HServerAddress> getRegionsInfo() throws IOException {
final Map<HRegionInfo, HServerAddress> regionMap =
@@ -444,8 +444,9 @@
}
/**
+ * Execute a delete
*
- * @param delete
+ * @param delete the delete
* @throws IOException
* @since 0.20.0
*/
@@ -482,7 +483,7 @@
* Commit a Put to the table.
* <p>
* If autoFlush is false, the update is buffered.
- * @param put
+ * @param put data to put
* @throws IOException
* @since 0.20.0
*/
@@ -494,24 +495,15 @@
* Commit a List of Puts to the table.
* <p>
* If autoFlush is false, the update is buffered.
- * @param puts
- * @throws IOException
+ * @param puts list of puts
+ * @throws IOException if a remote or network exception occurs
* @since 0.20.0
*/
public synchronized void put(final List<Put> puts) throws IOException {
doPut(puts);
}
- /**
- * Internal helper method.
- * Need to synchronize this instance to prevent race conditions on the internal
- * data structures.
- * <p>
- * If autoFlush is false, the update is buffered.
- * @param puts
- * @throws IOException
- */
- private void doPut(final List<Put> puts) throws IOException {
+ private void doPut(final List<Put> puts) throws IOException {
for (Put put : puts) {
validatePut(put);
writeBuffer.add(put);
@@ -526,12 +518,12 @@
* Atomically increments a column value. If the column value already exists
* and is not a big-endian long, this could throw an exception.<p>
*
- * @param row
- * @param family
- * @param qualifier
- * @param amount
- * @return The new value.
- * @throws IOException
+ * @param row row
+ * @param family column family
+ * @param qualifier column qualifier
+ * @param amount long amount to increment by
+ * @return The new value after incrementing
+ * @throws IOException if a remote or network exception occurs
*/
public long incrementColumnValue(final byte [] row, final byte [] family,
final byte [] qualifier, final long amount)
@@ -545,14 +537,15 @@
*
* Setting writeToWAL to false means that in a fail scenario, you will lose
* any increments that have not been flushed.
- * @param row
- * @param family
- * @param qualifier
- * @param amount
+ * @param row row
+ * @param family column family
+ * @param qualifier column qualifier
+ * @param amount long amount to increment by
* @param writeToWAL true if increment should be applied to WAL, false if not
* @return The new value.
- * @throws IOException
+ * @throws IOException if a remote or network exception occurs
*/
+ @SuppressWarnings({"ThrowableInstanceNeverThrown"})
public long incrementColumnValue(final byte [] row, final byte [] family,
final byte [] qualifier, final long amount, final boolean writeToWAL)
throws IOException {
@@ -563,9 +556,8 @@
npe = new NullPointerException("column is null");
}
if (npe != null) {
- IOException io = new IOException(
+ throw new IOException(
"Invalid arguments to incrementColumnValue", npe);
- throw io;
}
return connection.getRegionServerWithRetries(
new ServerCallable<Long>(connection, tableName, row) {
@@ -580,13 +572,14 @@
/**
* Atomically checks if a row/family/qualifier value match the expectedValue.
- * If it does, it adds the put.
+ * If it does, it adds the put. If value == null, checks for non-existance
+ * of the value.
*
- * @param row
- * @param family
- * @param qualifier
+ * @param row to check
+ * @param family column family
+ * @param qualifier column qualifier
* @param value the expected value
- * @param put
+ * @param put put to execute if value matches.
* @throws IOException
* @return true if the new put was execute, false otherwise
*/
@@ -598,10 +591,10 @@
new ServerCallable<Boolean>(connection, tableName, row) {
public Boolean call() throws IOException {
return server.checkAndPut(location.getRegionInfo().getRegionName(),
- row, family, qualifier, value, put)? Boolean.TRUE: Boolean.FALSE;
+ row, family, qualifier, value, put) ? Boolean.TRUE : Boolean.FALSE;
}
}
- ).booleanValue();
+ );
}
/**
@@ -611,35 +604,35 @@
*
* This is a server-side call so it prevents any data from being transfered
* to the client.
- * @param get
+ * @param get param to check for
* @return true if the specified Get matches one or more keys, false if not
* @throws IOException
*/
public boolean exists(final Get get) throws IOException {
return connection.getRegionServerWithRetries(
- new ServerCallable<Boolean>(connection, tableName, get.getRow()) {
- public Boolean call() throws IOException {
- return Boolean.valueOf(server.
- exists(location.getRegionInfo().getRegionName(), get));
+ new ServerCallable<Boolean>(connection, tableName, get.getRow()) {
+ public Boolean call() throws IOException {
+ return server.
+ exists(location.getRegionInfo().getRegionName(), get);
+ }
}
- }
- ).booleanValue();
+ );
}
/**
- * Commit to the table the buffer of BatchUpdate.
+ * Commit to the table the buffer of Puts.
* Called automatically in the commit methods when autoFlush is true.
- * @throws IOException
+ * @throws IOException e
*/
public void flushCommits() throws IOException {
try {
connection.processBatchOfPuts(writeBuffer,
tableName, pool);
} finally {
- // the write buffer was adjsuted by processBatchOfPuts
+ // the write buffer was adjusted by processBatchOfPuts
currentWriteBufferSize = 0;
- for (int i = 0; i < writeBuffer.size(); i++) {
- currentWriteBufferSize += writeBuffer.get(i).heapSize();
+ for (Put aWriteBuffer : writeBuffer) {
+ currentWriteBufferSize += aWriteBuffer.heapSize();
}
}
}
@@ -653,12 +646,7 @@
flushCommits();
}
- /**
- * Utility method that verifies Put is well formed.
- *
- * @param put
- * @throws IllegalArgumentException
- */
+ // validate for well-formedness
private void validatePut(final Put put) throws IllegalArgumentException{
if (put.isEmpty()) {
throw new IllegalArgumentException("No columns to insert");
@@ -687,8 +675,7 @@
public RowLock call() throws IOException {
long lockId =
server.lockRow(location.getRegionInfo().getRegionName(), row);
- RowLock rowLock = new RowLock(row,lockId);
- return rowLock;
+ return new RowLock(row,lockId);
}
}
);
@@ -721,8 +708,11 @@
}
/**
- * Set if this instanciation of HTable will autoFlush
- * @param autoFlush
+ * Turning off autoflush will cause operations to be batched for greater
+ * efficiency in the RPC. Also see @{link #flushCommits}
+ *
+ * @param autoFlush flag
+ * @see #flushCommits
*/
public void setAutoFlush(boolean autoFlush) {
this.autoFlush = autoFlush;
@@ -740,8 +730,8 @@
* Set the size of the buffer in bytes.
* If the new size is lower than the current size of data in the
* write buffer, the buffer is flushed.
- * @param writeBufferSize
- * @throws IOException
+ * @param writeBufferSize new write buffer size
+ * @throws IOException e
*/
public void setWriteBufferSize(long writeBufferSize) throws IOException {
this.writeBufferSize = writeBufferSize;
@@ -814,10 +804,7 @@
return lastNext;
}
- /**
- * @param endKey
- * @return Returns true if the passed region endkey.
- */
+ // returns true if the passed region endKey
private boolean checkScanStopRow(final byte [] endKey) {
if (this.scan.getStopRow().length > 0) {
// there is a stop row, check to see if we are past it.
@@ -852,7 +839,7 @@
}
// Where to start the next scanner
- byte [] localStartKey = null;
+ byte [] localStartKey;
// if we're at end of table, close and return false to stop iterating
if (this.currentRegion != null) {
Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HTableFactory.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HTableFactory.java?rev=920548&r1=920547&r2=920548&view=diff
==============================================================================
--- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HTableFactory.java (original)
+++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HTableFactory.java Mon Mar 8 22:25:06 2010
@@ -1,5 +1,5 @@
/**
- * Copyright 2009 The Apache Software Foundation
+ * Copyright 2010 The Apache Software Foundation
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,10 +19,10 @@
*/
package org.apache.hadoop.hbase.client;
-import java.io.IOException;
-
import org.apache.hadoop.conf.Configuration;
+import java.io.IOException;
+
/**
* Factory for creating HTable instances.
*
Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java?rev=920548&r1=920547&r2=920548&view=diff
==============================================================================
--- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java (original)
+++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java Mon Mar 8 22:25:06 2010
@@ -1,5 +1,5 @@
/**
- * Copyright 2009 The Apache Software Foundation
+ * Copyright 2010 The Apache Software Foundation
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,12 +19,12 @@
*/
package org.apache.hadoop.hbase.client;
-import java.io.IOException;
-import java.util.List;
-
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HTableDescriptor;
+import java.io.IOException;
+import java.util.List;
+
/**
* Used to communicate with a single HBase table.
*
@@ -49,7 +49,7 @@
* Gets the table descriptor for this table.
*
* @return table metadata
- * @throws IOException
+ * @throws IOException e
*/
HTableDescriptor getTableDescriptor() throws IOException;
@@ -65,7 +65,7 @@
*
* @param get the Get
* @return true if the specified Get matches one or more keys, false if not
- * @throws IOException
+ * @throws IOException e
*/
boolean exists(Get get) throws IOException;
@@ -76,7 +76,7 @@
*
* @param get the Get to fetch
* @return the result
- * @throws IOException
+ * @throws IOException e
*/
Result get(Get get) throws IOException;
@@ -87,7 +87,7 @@
* @param row row key
* @param family Column family to look for row in
* @return map of values
- * @throws IOException
+ * @throws IOException e
*/
Result getRowOrBefore(byte[] row, byte[] family) throws IOException;
@@ -95,8 +95,8 @@
* Get a scanner on the current table as specified by the {@link Scan} object.
*
* @param scan a configured {@link Scan} object
- * @return scanner
- * @throws IOException
+ * @return the scanner
+ * @throws IOException e
*/
ResultScanner getScanner(Scan scan) throws IOException;
@@ -105,7 +105,7 @@
*
* @param family the column family to scan
* @return the scanner
- * @throws IOException
+ * @throws IOException e
*/
ResultScanner getScanner(byte[] family) throws IOException;
@@ -115,7 +115,7 @@
* @param family the column family to scan
* @param qualifier the column qualifier to scan
* @return The scanner
- * @throws IOException
+ * @throws IOException e
*/
ResultScanner getScanner(byte[] family, byte[] qualifier) throws IOException;
@@ -124,8 +124,8 @@
* <p>
* If autoFlush is false, the update is buffered.
*
- * @param put
- * @throws IOException
+ * @param put data
+ * @throws IOException e
*/
void put(Put put) throws IOException;
@@ -134,21 +134,22 @@
* <p>
* If autoFlush is false, the update is buffered.
*
- * @param puts
- * @throws IOException
+ * @param puts list of puts
+ * @throws IOException e
*/
void put(List<Put> puts) throws IOException;
/**
* Atomically checks if a row/family/qualifier value matches the expected
- * value. If it does, it adds the put.
+ * value. If it does, it adds the put. If the passed value is null, the check
+ * is for the lack of column (ie: non-existance)
*
- * @param row
- * @param family
- * @param qualifier
+ * @param row to check
+ * @param family column family to check
+ * @param qualifier column qualifier to check
* @param value the expected value
- * @param put
- * @throws IOException
+ * @param put data to put if check succeeds
+ * @throws IOException e
* @return true if the new put was executed, false otherwise
*/
boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier,
@@ -157,8 +158,8 @@
/**
* Deletes as specified by the delete.
*
- * @param delete
- * @throws IOException
+ * @param delete a delete
+ * @throws IOException e
*/
void delete(Delete delete) throws IOException;
@@ -166,7 +167,7 @@
* Bulk commit a List of Deletes to the table.
* @param deletes List of deletes. List is modified by this method.
* On exception holds deletes that were NOT applied.
- * @throws IOException
+ * @throws IOException e
*/
void delete(List<Delete> deletes) throws IOException;
@@ -176,12 +177,12 @@
* value does not yet exist it is initialized to <code>amount</code> and
* written to the specified column.
*
- * @param row
- * @param family
- * @param qualifier
- * @param amount
+ * @param row row to increment
+ * @param family column family
+ * @param qualifier column qualifier
+ * @param amount long amount to increment
* @return the new value
- * @throws IOException
+ * @throws IOException e
*/
long incrementColumnValue(byte[] row, byte[] family, byte[] qualifier,
long amount) throws IOException;
@@ -194,13 +195,13 @@
*
* <p>Setting writeToWAL to false means that in a fail scenario, you will lose
* any increments that have not been flushed.
- * @param row
- * @param family
- * @param qualifier
- * @param amount
+ * @param row row to increment
+ * @param family column family
+ * @param qualifier column qualifier
+ * @param amount long amount to increment
* @param writeToWAL true if increment should be applied to WAL, false if not
* @return The new value.
- * @throws IOException
+ * @throws IOException e
*/
long incrementColumnValue(byte[] row, byte[] family, byte[] qualifier,
long amount, boolean writeToWAL) throws IOException;
@@ -215,14 +216,14 @@
/**
* Flushes buffer data. Called automatically when autoFlush is true.
*
- * @throws IOException
+ * @throws IOException e
*/
void flushCommits() throws IOException;
/**
* Releases held resources.
*
- * @throws IOException
+ * @throws IOException e
*/
void close() throws IOException;
@@ -231,7 +232,7 @@
*
* @param row the row to lock
* @return rowLock RowLock containing row and lock id
- * @throws IOException
+ * @throws IOException e
*/
RowLock lockRow(byte[] row) throws IOException;
@@ -239,7 +240,7 @@
* Releases the row lock.
*
* @param rl the row lock to release
- * @throws IOException
+ * @throws IOException e
*/
void unlockRow(RowLock rl) throws IOException;
}
Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HTableInterfaceFactory.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HTableInterfaceFactory.java?rev=920548&r1=920547&r2=920548&view=diff
==============================================================================
--- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HTableInterfaceFactory.java (original)
+++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HTableInterfaceFactory.java Mon Mar 8 22:25:06 2010
@@ -1,5 +1,5 @@
/**
- * Copyright 2009 The Apache Software Foundation
+ * Copyright 2010 The Apache Software Foundation
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Modified: hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HTablePool.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HTablePool.java?rev=920548&r1=920547&r2=920548&view=diff
==============================================================================
--- hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HTablePool.java (original)
+++ hadoop/hbase/trunk/core/src/main/java/org/apache/hadoop/hbase/client/HTablePool.java Mon Mar 8 22:25:06 2010
@@ -1,5 +1,5 @@
/**
- * Copyright 2009 The Apache Software Foundation
+ * Copyright 2010 The Apache Software Foundation
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,15 +19,15 @@
*/
package org.apache.hadoop.hbase.client;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.util.Bytes;
+
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseConfiguration;
-import org.apache.hadoop.hbase.util.Bytes;
-
/**
* A simple pool of HTable instances.<p>
*
@@ -73,7 +73,7 @@
* Get a reference to the specified table from the pool.<p>
*
* Create a new one if one is not available.
- * @param tableName
+ * @param tableName table name
* @return a reference to the specified table
* @throws RuntimeException if there is a problem instantiating the HTable
*/
@@ -98,7 +98,7 @@
* Get a reference to the specified table from the pool.<p>
*
* Create a new one if one is not available.
- * @param tableName
+ * @param tableName table name
* @return a reference to the specified table
* @throws RuntimeException if there is a problem instantiating the HTable
*/
@@ -111,7 +111,7 @@
*
* If the pool already contains <i>maxSize</i> references to the table,
* then nothing happens.
- * @param table
+ * @param table table
*/
public void putTable(HTableInterface table) {
LinkedList<HTableInterface> queue = tables.get(Bytes.toString(table.getTableName()));