You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by vi...@apache.org on 2011/10/27 17:25:17 UTC
svn commit: r1189806 [31/46] - in /incubator/accumulo: branches/1.3/contrib/
branches/1.3/src/core/src/main/java/org/apache/accumulo/core/client/
branches/1.3/src/core/src/main/java/org/apache/accumulo/core/client/admin/
branches/1.3/src/core/src/main/...
Modified: incubator/accumulo/branches/1.3/src/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java (original)
+++ incubator/accumulo/branches/1.3/src/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java Thu Oct 27 15:24:51 2011
@@ -127,7 +127,8 @@ public class AccumuloClassLoader {
* if not it must be the build-server in which case I use a hack to get unittests working
*/
String userDir = System.getProperty("user.dir");
- if (userDir == null) throw new RuntimeException("Property user.dir is not set");
+ if (userDir == null)
+ throw new RuntimeException("Property user.dir is not set");
int index = userDir.indexOf("accumulo/");
if (index >= 0) {
String acuhome = userDir.substring(0, index + "accumulo/".length());
@@ -147,7 +148,8 @@ public class AccumuloClassLoader {
private static ArrayList<URL> findDynamicURLs() throws IOException {
StringBuilder cp = new StringBuilder(DYNAMIC_CLASSPATH_VALUE);
String envJars = System.getenv("ACCUMULO_XTRAJARS");
- if (null != envJars && !envJars.equals("")) cp = cp.append(",").append(envJars);
+ if (null != envJars && !envJars.equals(""))
+ cp = cp.append(",").append(envJars);
String[] cps = replaceEnvVars(cp.toString(), System.getenv()).split(",");
ArrayList<URL> urls = new ArrayList<URL>();
for (String classpath : cps) {
@@ -162,13 +164,15 @@ public class AccumuloClassLoader {
Set<File> dirs = new HashSet<File>();
StringBuilder cp = new StringBuilder(DYNAMIC_CLASSPATH_VALUE);
String envJars = System.getenv("ACCUMULO_XTRAJARS");
- if (null != envJars && !envJars.equals("")) cp = cp.append(",").append(envJars);
+ if (null != envJars && !envJars.equals(""))
+ cp = cp.append(",").append(envJars);
String[] cps = replaceEnvVars(cp.toString(), System.getenv()).split(",");
ArrayList<URL> urls = new ArrayList<URL>();
for (String classpath : cps) {
if (!classpath.startsWith("#")) {
classpath = classpath.trim();
- if (classpath.length() == 0) continue;
+ if (classpath.length() == 0)
+ continue;
classpath = replaceEnvVars(classpath, System.getenv());
@@ -184,7 +188,8 @@ public class AccumuloClassLoader {
// Then treat this URI as a File.
// This checks to see if the url string is a dir if it expand and get all jars in that directory
final File extDir = new File(classpath);
- if (extDir.isDirectory()) urls.add(extDir.toURI().toURL());
+ if (extDir.isDirectory())
+ urls.add(extDir.toURI().toURL());
else {
urls.add(extDir.getAbsoluteFile().getParentFile().toURI().toURL());
}
@@ -197,7 +202,8 @@ public class AccumuloClassLoader {
for (URL url : urls) {
try {
File f = new File(url.toURI());
- if (!f.isDirectory()) f = f.getParentFile();
+ if (!f.isDirectory())
+ f = f.getParentFile();
dirs.add(f);
} catch (URISyntaxException e) {
log.error("Unable to find directory for " + url + ", cannot create URI from it");
@@ -208,7 +214,8 @@ public class AccumuloClassLoader {
private static ArrayList<URL> findAccumuloURLs() throws IOException {
String cp = getAccumuloClasspathStrings();
- if (cp == null) return new ArrayList<URL>();
+ if (cp == null)
+ return new ArrayList<URL>();
String[] cps = replaceEnvVars(cp, System.getenv()).split(",");
ArrayList<URL> urls = new ArrayList<URL>();
for (String classpath : cps) {
@@ -221,7 +228,8 @@ public class AccumuloClassLoader {
private static void addUrl(String classpath, ArrayList<URL> urls) throws MalformedURLException {
classpath = classpath.trim();
- if (classpath.length() == 0) return;
+ if (classpath.length() == 0)
+ return;
classpath = replaceEnvVars(classpath, System.getenv());
@@ -237,7 +245,8 @@ public class AccumuloClassLoader {
// Then treat this URI as a File.
// This checks to see if the url string is a dir if it expand and get all jars in that directory
final File extDir = new File(classpath);
- if (extDir.isDirectory()) urls.add(extDir.toURI().toURL());
+ if (extDir.isDirectory())
+ urls.add(extDir.toURI().toURL());
else {
if (extDir.getParentFile() != null) {
File[] extJars = extDir.getParentFile().listFiles(new FilenameFilter() {
@@ -290,7 +299,8 @@ public class AccumuloClassLoader {
} catch (Exception e) {
/* we don't care because this is optional and we can use defaults */
}
- if (site_classpath_string != null) return site_classpath_string;
+ if (site_classpath_string != null)
+ return site_classpath_string;
return ACCUMULO_CLASSPATH_VALUE;
} catch (Exception e) {
throw new IllegalStateException("ClassPath Strings Lookup failed", e);
@@ -364,7 +374,8 @@ public class AccumuloClassLoader {
monitor = null;
}
- if (null == parent) parent = getAccumuloClassLoader();
+ if (null == parent)
+ parent = getAccumuloClassLoader();
// Find the dynamic classpath items
ArrayList<URL> dynamicURLs = findDynamicURLs();
Modified: incubator/accumulo/branches/1.3/src/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloFilesystemAlterationMonitor.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloFilesystemAlterationMonitor.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloFilesystemAlterationMonitor.java (original)
+++ incubator/accumulo/branches/1.3/src/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloFilesystemAlterationMonitor.java Thu Oct 27 15:24:51 2011
@@ -121,7 +121,8 @@ public final class AccumuloFilesystemAlt
observer.checkAndNotify();
}
- if (!running) break;
+ if (!running)
+ break;
try {
Thread.sleep(delay);
} catch (final InterruptedException e) {}
Modified: incubator/accumulo/branches/1.3/src/start/src/test/java/org/apache/accumulo/start/Test.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/start/src/test/java/org/apache/accumulo/start/Test.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/start/src/test/java/org/apache/accumulo/start/Test.java (original)
+++ incubator/accumulo/branches/1.3/src/start/src/test/java/org/apache/accumulo/start/Test.java Thu Oct 27 15:24:51 2011
@@ -45,7 +45,8 @@ public class Test extends TestCase {
public void setUp() {
String aHome = System.getenv("ACCUMULO_HOME");
- if (aHome == null) fail("ACCUMULO_HOME must be set");
+ if (aHome == null)
+ fail("ACCUMULO_HOME must be set");
tmpDir = new File(aHome + "/lib/ext");
if (!tmpDir.exists())
tmpDir.mkdir();
@@ -111,7 +112,8 @@ public class Test extends TestCase {
Logger.getRootLogger().setLevel(Level.ERROR);
// Copy JarA to the dir
- if (log.isDebugEnabled()) log.debug("Test with Jar A");
+ if (log.isDebugEnabled())
+ log.debug("Test with Jar A");
copyJar(jarA);
// Load the TestObject class from the new classloader.
test.Test a = create();
@@ -119,7 +121,8 @@ public class Test extends TestCase {
assertTrue(a.add() == 1);
assertTrue(a.add() == 2);
// Copy jarB and wait to reload
- if (log.isDebugEnabled()) log.debug("Test with Jar B");
+ if (log.isDebugEnabled())
+ log.debug("Test with Jar B");
copyJar(jarB);
test.Test b = create();
assertEquals(a.hello(), "Hello from testA");
@@ -128,7 +131,8 @@ public class Test extends TestCase {
assertTrue(b.add() == 2);
assertTrue(a.add() == 3);
assertTrue(a.add() == 4);
- if (log.isDebugEnabled()) log.debug("Test with Jar C");
+ if (log.isDebugEnabled())
+ log.debug("Test with Jar C");
copyJar(jarC);
test.Test c = create();
assertEquals(a.hello(), "Hello from testA");
@@ -141,7 +145,8 @@ public class Test extends TestCase {
assertTrue(a.add() == 5);
assertTrue(a.add() == 6);
- if (log.isDebugEnabled()) log.debug("Deleting jar");
+ if (log.isDebugEnabled())
+ log.debug("Deleting jar");
assertTrue(destJar.delete());
// give the class loader time to remove the classes from the deleted jar
Thread.sleep(1500);
@@ -151,7 +156,8 @@ public class Test extends TestCase {
} catch (ClassNotFoundException cnfe) {}
// uncomment this block when #2987 is fixed
- if (log.isDebugEnabled()) log.debug("Test with Jar C");
+ if (log.isDebugEnabled())
+ log.debug("Test with Jar C");
copyJar(jarC);
test.Test e = create();
assertEquals(e.hello(), "Hello from testC");
Modified: incubator/accumulo/branches/1.3/src/trace/src/main/java/cloudtrace/instrument/Trace.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/trace/src/main/java/cloudtrace/instrument/Trace.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/trace/src/main/java/cloudtrace/instrument/Trace.java (original)
+++ incubator/accumulo/branches/1.3/src/trace/src/main/java/cloudtrace/instrument/Trace.java Thu Oct 27 15:24:51 2011
@@ -80,7 +80,8 @@ public class Trace {
// Wrap the runnable in a new span, if tracing
public static Runnable wrap(Runnable runnable) {
- if (isTracing()) return new TraceRunnable(Trace.currentTrace(), runnable);
+ if (isTracing())
+ return new TraceRunnable(Trace.currentTrace(), runnable);
return runnable;
}
Modified: incubator/accumulo/branches/1.3/src/trace/src/main/java/cloudtrace/instrument/Tracer.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/trace/src/main/java/cloudtrace/instrument/Tracer.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/trace/src/main/java/cloudtrace/instrument/Tracer.java (original)
+++ incubator/accumulo/branches/1.3/src/trace/src/main/java/cloudtrace/instrument/Tracer.java Thu Oct 27 15:24:51 2011
@@ -60,7 +60,8 @@ public class Tracer {
public Span start(String description) {
Span parent = currentTrace.get();
- if (parent == null) return NULL_SPAN;
+ if (parent == null)
+ return NULL_SPAN;
return push(parent.child(description));
}
@@ -125,7 +126,8 @@ public class Tracer {
if (span != null) {
deliver(span);
currentTrace.set(span.parent());
- } else currentTrace.set(null);
+ } else
+ currentTrace.set(null);
}
public Span continueTrace(String description, long traceId, long parentId) {
Modified: incubator/accumulo/branches/1.3/src/trace/src/main/java/cloudtrace/instrument/impl/MilliSpan.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/trace/src/main/java/cloudtrace/instrument/impl/MilliSpan.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/trace/src/main/java/cloudtrace/instrument/impl/MilliSpan.java (original)
+++ incubator/accumulo/branches/1.3/src/trace/src/main/java/cloudtrace/instrument/impl/MilliSpan.java Thu Oct 27 15:24:51 2011
@@ -51,12 +51,14 @@ public class MilliSpan implements Span {
}
public synchronized void start() {
- if (start > 0) throw new IllegalStateException("Span for " + description + " has already been started");
+ if (start > 0)
+ throw new IllegalStateException("Span for " + description + " has already been started");
start = System.currentTimeMillis();
}
public synchronized void stop() {
- if (start == 0) throw new IllegalStateException("Span for " + description + " has not been started");
+ if (start == 0)
+ throw new IllegalStateException("Span for " + description + " has not been started");
stop = System.currentTimeMillis();
Tracer.getInstance().pop(this);
}
@@ -70,8 +72,10 @@ public class MilliSpan implements Span {
}
public synchronized long accumulatedMillis() {
- if (start == 0) return 0;
- if (stop > 0) return stop - start;
+ if (start == 0)
+ return 0;
+ if (stop > 0)
+ return stop - start;
return currentTimeMillis() - start;
}
@@ -98,7 +102,8 @@ public class MilliSpan implements Span {
@Override
public long parentId() {
- if (parent == null) return -1;
+ if (parent == null)
+ return -1;
return parent.spanId();
}
@@ -119,13 +124,15 @@ public class MilliSpan implements Span {
@Override
public void data(String key, String value) {
- if (traceInfo == null) traceInfo = new HashMap<String,String>();
+ if (traceInfo == null)
+ traceInfo = new HashMap<String,String>();
traceInfo.put(key, value);
}
@Override
public Map<String,String> getData() {
- if (traceInfo == null) return Collections.emptyMap();
+ if (traceInfo == null)
+ return Collections.emptyMap();
return Collections.unmodifiableMap(traceInfo);
}
}
\ No newline at end of file
Modified: incubator/accumulo/branches/1.3/src/trace/src/main/java/cloudtrace/instrument/receivers/AsyncSpanReceiver.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/trace/src/main/java/cloudtrace/instrument/receivers/AsyncSpanReceiver.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/trace/src/main/java/cloudtrace/instrument/receivers/AsyncSpanReceiver.java (original)
+++ incubator/accumulo/branches/1.3/src/trace/src/main/java/cloudtrace/instrument/receivers/AsyncSpanReceiver.java Thu Oct 27 15:24:51 2011
@@ -97,7 +97,8 @@ public abstract class AsyncSpanReceiver<
log.error(ex, ex);
}
}
- if (!sent) break;
+ if (!sent)
+ break;
}
}
Modified: incubator/accumulo/branches/1.3/src/trace/src/main/java/cloudtrace/instrument/receivers/LogSpans.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/trace/src/main/java/cloudtrace/instrument/receivers/LogSpans.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/trace/src/main/java/cloudtrace/instrument/receivers/LogSpans.java (original)
+++ incubator/accumulo/branches/1.3/src/trace/src/main/java/cloudtrace/instrument/receivers/LogSpans.java Thu Oct 27 15:24:51 2011
@@ -39,7 +39,8 @@ public class LogSpans implements SpanRec
}
static public Level toLevel(int val) {
- if (val == Level.DEBUG_INT + 150) return Level.DEBUG;
+ if (val == Level.DEBUG_INT + 150)
+ return Level.DEBUG;
return Level.toLevel(val);
}
}
@@ -48,7 +49,8 @@ public class LogSpans implements SpanRec
public static String format(long traceId, long spanId, long parentId, long start, long stop, String description, Map<String,String> data) {
String parentStr = "";
- if (parentId > 0) parentStr = " parent:" + parentId;
+ if (parentId > 0)
+ parentStr = " parent:" + parentId;
String startStr = fmt.format(new Date(start));
return String.format("%20s:%x id:%d%s start:%s ms:%d", description, traceId, spanId, parentStr, startStr, stop - start);
}
Modified: incubator/accumulo/branches/1.3/src/trace/src/main/java/cloudtrace/instrument/receivers/ZooSpanClient.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/trace/src/main/java/cloudtrace/instrument/receivers/ZooSpanClient.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/trace/src/main/java/cloudtrace/instrument/receivers/ZooSpanClient.java (original)
+++ incubator/accumulo/branches/1.3/src/trace/src/main/java/cloudtrace/instrument/receivers/ZooSpanClient.java Thu Oct 27 15:24:51 2011
@@ -49,7 +49,8 @@ public class ZooSpanClient extends SendS
this.path = path;
zoo = new ZooKeeper(keepers, 30 * 1000, this);
for (int i = 0; i < TOTAL_TIME_WAIT_CONNECT_MS; i += TIME_WAIT_CONNECT_CHECK_MS) {
- if (zoo.getState().equals(States.CONNECTED)) break;
+ if (zoo.getState().equals(States.CONNECTED))
+ break;
try {
Thread.sleep(TIME_WAIT_CONNECT_CHECK_MS);
} catch (InterruptedException ex) {
Modified: incubator/accumulo/branches/1.3/src/trace/src/test/java/cloudtrace/instrument/CountSamplerTest.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/trace/src/test/java/cloudtrace/instrument/CountSamplerTest.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/trace/src/test/java/cloudtrace/instrument/CountSamplerTest.java (original)
+++ incubator/accumulo/branches/1.3/src/trace/src/test/java/cloudtrace/instrument/CountSamplerTest.java Thu Oct 27 15:24:51 2011
@@ -29,8 +29,10 @@ public class CountSamplerTest {
int halfCount = 0;
int hundredCount = 0;
for (int i = 0; i < 200; i++) {
- if (half.next()) halfCount++;
- if (hundred.next()) hundredCount++;
+ if (half.next())
+ halfCount++;
+ if (hundred.next())
+ hundredCount++;
}
Assert.assertEquals(2, hundredCount);
Assert.assertEquals(100, halfCount);
Modified: incubator/accumulo/branches/1.3/src/trace/src/test/java/cloudtrace/instrument/TracerTest.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.3/src/trace/src/test/java/cloudtrace/instrument/TracerTest.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/branches/1.3/src/trace/src/test/java/cloudtrace/instrument/TracerTest.java (original)
+++ incubator/accumulo/branches/1.3/src/trace/src/test/java/cloudtrace/instrument/TracerTest.java Thu Oct 27 15:24:51 2011
@@ -74,7 +74,8 @@ public class TracerTest {
@Override
public void span(long traceId, long spanId, long parentId, long start, long stop, String description, Map<String,String> data) {
SpanStruct span = new SpanStruct(traceId, spanId, parentId, start, stop, description, data);
- if (!traces.containsKey(traceId)) traces.put(traceId, new ArrayList<SpanStruct>());
+ if (!traces.containsKey(traceId))
+ traces.put(traceId, new ArrayList<SpanStruct>());
traces.get(traceId).add(span);
}
Modified: incubator/accumulo/trunk/contrib/Eclipse-Accumulo-Codestyle.xml
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/contrib/Eclipse-Accumulo-Codestyle.xml?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/contrib/Eclipse-Accumulo-Codestyle.xml (original)
+++ incubator/accumulo/trunk/contrib/Eclipse-Accumulo-Codestyle.xml Thu Oct 27 15:24:51 2011
@@ -20,7 +20,7 @@
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
@@ -286,6 +286,6 @@
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
-<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
</profile>
</profiles>
Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/ClientSideIteratorScanner.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/ClientSideIteratorScanner.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/ClientSideIteratorScanner.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/ClientSideIteratorScanner.java Thu Oct 27 15:24:51 2011
@@ -77,13 +77,16 @@ public class ClientSideIteratorScanner e
@Override
public void next() throws IOException {
- if (iter.hasNext()) top = iter.next();
- else top = null;
+ if (iter.hasNext())
+ top = iter.next();
+ else
+ top = null;
}
@Override
public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException {
- if (!inclusive && columnFamilies.size() > 0) throw new UnsupportedOperationException();
+ if (!inclusive && columnFamilies.size() > 0)
+ throw new UnsupportedOperationException();
scanner.setRange(range);
scanner.clearColumns();
for (ByteSequence colf : columnFamilies) {
@@ -126,8 +129,10 @@ public class ClientSideIteratorScanner e
public Iterator<Entry<Key,Value>> iterator() {
smi.scanner.setBatchSize(size);
smi.scanner.setTimeOut(timeOut);
- if (isolated) smi.scanner.enableIsolation();
- else smi.scanner.disableIsolation();
+ if (isolated)
+ smi.scanner.enableIsolation();
+ else
+ smi.scanner.disableIsolation();
TreeMap<Integer,IterInfo> tm = new TreeMap<Integer,IterInfo>();
Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/IsolatedScanner.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/IsolatedScanner.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/IsolatedScanner.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/IsolatedScanner.java Thu Oct 27 15:24:51 2011
@@ -91,7 +91,8 @@ public class IsolatedScanner extends Sca
nextRowStart = null;
- if (lastRow == null) seekRange = range;
+ if (lastRow == null)
+ seekRange = range;
else {
Text lastRowText = new Text();
lastRowText.set(lastRow.getBackingArray(), lastRow.offset(), lastRow.length());
Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/IteratorSetting.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/IteratorSetting.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/IteratorSetting.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/IteratorSetting.java Thu Oct 27 15:24:51 2011
@@ -226,8 +226,10 @@ public class IteratorSetting {
* key/value pairs
*/
public void addOptions(IteratorScope scope, Map<String,String> properties) {
- if (properties == null) return;
- if (!this.properties.containsKey(scope)) this.properties.put(scope, new HashMap<String,String>());
+ if (properties == null)
+ return;
+ if (!this.properties.containsKey(scope))
+ this.properties.put(scope, new HashMap<String,String>());
for (Entry<String,String> entry : properties.entrySet()) {
this.properties.get(scope).put(entry.getKey(), entry.getValue());
}
Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/RowIterator.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/RowIterator.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/RowIterator.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/RowIterator.java Thu Oct 27 15:24:51 2011
@@ -44,23 +44,27 @@ public class RowIterator implements Iter
*/
public SingleRowIter(PeekingIterator<Entry<Key,Value>> source) {
this.source = source;
- if (source.hasNext()) currentRow = source.peek().getKey().getRow();
+ if (source.hasNext())
+ currentRow = source.peek().getKey().getRow();
}
@Override
public boolean hasNext() {
- if (disabled) throw new IllegalStateException("SingleRowIter no longer valid");
+ if (disabled)
+ throw new IllegalStateException("SingleRowIter no longer valid");
return currentRow != null;
}
@Override
public Entry<Key,Value> next() {
- if (disabled) throw new IllegalStateException("SingleRowIter no longer valid");
+ if (disabled)
+ throw new IllegalStateException("SingleRowIter no longer valid");
return _next();
}
private Entry<Key,Value> _next() {
- if (currentRow == null) throw new NoSuchElementException();
+ if (currentRow == null)
+ throw new NoSuchElementException();
count++;
Entry<Key,Value> kv = source.next();
if (!source.hasNext() || !source.peek().getKey().getRow().equals(currentRow)) {
@@ -134,7 +138,8 @@ public class RowIterator implements Iter
*/
@Override
public Iterator<Entry<Key,Value>> next() {
- if (!hasNext()) throw new NoSuchElementException();
+ if (!hasNext())
+ throw new NoSuchElementException();
return lastIter = new SingleRowIter(iter);
}
Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/TableOfflineException.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/TableOfflineException.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/TableOfflineException.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/TableOfflineException.java Thu Oct 27 15:24:51 2011
@@ -23,7 +23,8 @@ public class TableOfflineException exten
private static final long serialVersionUID = 1L;
private static String getTableName(Instance instance, String tableId) {
- if (tableId == null) return " <unknown table> ";
+ if (tableId == null)
+ return " <unknown table> ";
try {
String tableName = Tables.getTableName(instance, tableId);
return tableName + " (" + tableId + ")";
Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java Thu Oct 27 15:24:51 2011
@@ -145,7 +145,8 @@ public class ZooKeeperInstance implement
}
if (zooCache.get(Constants.ZROOT + "/" + instanceId) == null) {
- if (instanceName == null) throw new RuntimeException("Instance id " + instanceId + " does not exist in zookeeper");
+ if (instanceName == null)
+ throw new RuntimeException("Instance id " + instanceId + " does not exist in zookeeper");
throw new RuntimeException("Instance id " + instanceId + " pointed to by the name " + instanceName + " does not exist in zookeeper");
}
@@ -184,7 +185,8 @@ public class ZooKeeperInstance implement
@Override
public String getInstanceName() {
- if (instanceName == null) instanceName = lookupInstanceName(zooCache, UUID.fromString(getInstanceID()));
+ if (instanceName == null)
+ instanceName = lookupInstanceName(zooCache, UUID.fromString(getInstanceID()));
return instanceName;
}
@@ -220,7 +222,8 @@ public class ZooKeeperInstance implement
@Override
public AccumuloConfiguration getConfiguration() {
- if (conf == null) conf = AccumuloConfiguration.getDefaultConfiguration();
+ if (conf == null)
+ conf = AccumuloConfiguration.getDefaultConfiguration();
return conf;
}
Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/FindMax.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/FindMax.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/FindMax.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/FindMax.java Thu Oct 27 15:24:51 2011
@@ -47,8 +47,10 @@ public class FindMax {
endOS.write(maxBS.getBytes(), 0, maxBS.getLength());
// make the numbers of the same magnitude
- if (startOS.size() < endOS.size()) appendZeros(startOS, endOS.size() - startOS.size());
- else if (endOS.size() < startOS.size()) appendZeros(endOS, startOS.size() - endOS.size());
+ if (startOS.size() < endOS.size())
+ appendZeros(startOS, endOS.size() - startOS.size());
+ else if (endOS.size() < startOS.size())
+ appendZeros(endOS, startOS.size() - endOS.size());
BigInteger min = new BigInteger(startOS.toByteArray());
BigInteger max = new BigInteger(endOS.toByteArray());
@@ -60,7 +62,8 @@ public class FindMax {
Text ret = new Text();
if (ba.length == startOS.size()) {
- if (ba[0] != 0) throw new RuntimeException();
+ if (ba[0] != 0)
+ throw new RuntimeException();
// big int added a zero so it would not be negative, drop it
ret.set(ba, 1, ba.length - 1);
@@ -95,7 +98,8 @@ public class FindMax {
if (inclStart && inclEnd && cmp == 0) {
scanner.setRange(new Range(start, true, end, true));
Iterator<Entry<Key,Value>> iter = scanner.iterator();
- if (iter.hasNext()) return iter.next().getKey().getRow();
+ if (iter.hasNext())
+ return iter.next().getKey().getRow();
}
return null;
@@ -117,11 +121,14 @@ public class FindMax {
count++;
}
- if (!iter.hasNext()) return next.getRow();
+ if (!iter.hasNext())
+ return next.getRow();
Text ret = _findMax(scanner, next.followingKey(PartialKey.ROW).getRow(), true, end, inclEnd);
- if (ret == null) return next.getRow();
- else return ret;
+ if (ret == null)
+ return next.getRow();
+ else
+ return ret;
} else {
return _findMax(scanner, start, inclStart, mid, mid.equals(start) ? inclStart : false);
@@ -155,7 +162,8 @@ public class FindMax {
is = true;
}
- if (end == null) end = findInitialEnd(scanner);
+ if (end == null)
+ end = findInitialEnd(scanner);
return _findMax(scanner, start, is, end, ie);
}
Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperationsImpl.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperationsImpl.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperationsImpl.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperationsImpl.java Thu Oct 27 15:24:51 2011
@@ -48,8 +48,10 @@ public class SecurityOperationsImpl impl
ServerClient.executeRaw(instance, exec);
} catch (ThriftTableOperationException ttoe) {
// recast missing table
- if (ttoe.getType() == TableOperationExceptionType.NOTFOUND) throw new AccumuloSecurityException(null, SecurityErrorCode.TABLE_DOESNT_EXIST);
- else throw new AccumuloException(ttoe);
+ if (ttoe.getType() == TableOperationExceptionType.NOTFOUND)
+ throw new AccumuloSecurityException(null, SecurityErrorCode.TABLE_DOESNT_EXIST);
+ else
+ throw new AccumuloException(ttoe);
} catch (ThriftSecurityException e) {
throw new AccumuloSecurityException(e.user, e.code, e);
} catch (AccumuloException e) {
@@ -64,8 +66,10 @@ public class SecurityOperationsImpl impl
return ServerClient.executeRaw(instance, exec);
} catch (ThriftTableOperationException ttoe) {
// recast missing table
- if (ttoe.getType() == TableOperationExceptionType.NOTFOUND) throw new AccumuloSecurityException(null, SecurityErrorCode.TABLE_DOESNT_EXIST);
- else throw new AccumuloException(ttoe);
+ if (ttoe.getType() == TableOperationExceptionType.NOTFOUND)
+ throw new AccumuloSecurityException(null, SecurityErrorCode.TABLE_DOESNT_EXIST);
+ else
+ throw new AccumuloException(ttoe);
} catch (ThriftSecurityException e) {
throw new AccumuloSecurityException(e.user, e.code, e);
} catch (AccumuloException e) {
Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsHelper.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsHelper.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsHelper.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsHelper.java Thu Oct 27 15:24:51 2011
@@ -53,7 +53,8 @@ public abstract class TableOperationsHel
for (Entry<String,String> property : copy.entrySet()) {
for (IteratorScope scope : IteratorScope.values()) {
String root = String.format("%s%s.%s", Property.TABLE_ITERATOR_PREFIX, scope.name().toLowerCase(), name);
- if (property.getKey().equals(root) || property.getKey().startsWith(root + ".opt.")) this.removeProperty(tableName, property.getKey());
+ if (property.getKey().equals(root) || property.getKey().startsWith(root + ".opt."))
+ this.removeProperty(tableName, property.getKey());
}
}
}
@@ -75,9 +76,11 @@ public abstract class TableOperationsHel
}
priority = Integer.parseInt(parts[0]);
classname = parts[1];
- if (!settings.containsKey(scope)) settings.put(scope, new HashMap<String,String>());
+ if (!settings.containsKey(scope))
+ settings.put(scope, new HashMap<String,String>());
} else if (property.getKey().startsWith(opt)) {
- if (!settings.containsKey(scope)) settings.put(scope, new HashMap<String,String>());
+ if (!settings.containsKey(scope))
+ settings.put(scope, new HashMap<String,String>());
settings.get(scope).put(property.getKey().substring(opt.length()), property.getValue());
}
}
@@ -102,7 +105,8 @@ public abstract class TableOperationsHel
String name = property.getKey();
String[] parts = name.split("\\.");
if (parts.length == 4) {
- if (parts[0].equals("table") && parts[1].equals("iterator") && lifecycles.contains(parts[2])) result.add(parts[3]);
+ if (parts[0].equals("table") && parts[1].equals("iterator") && lifecycles.contains(parts[2]))
+ result.add(parts[3]);
}
}
return result;
Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java Thu Oct 27 15:24:51 2011
@@ -133,7 +133,8 @@ public class TableOperationsImpl extends
*/
public boolean exists(String tableName) {
ArgumentChecker.notNull(tableName);
- if (tableName.equals(Constants.METADATA_TABLE_NAME)) return true;
+ if (tableName.equals(Constants.METADATA_TABLE_NAME))
+ return true;
OpTimer opTimer = new OpTimer(log, Level.TRACE).start("Checking if table " + tableName + "exists...");
boolean exists = Tables.getNameToIdMap(instance).containsKey(tableName);
@@ -184,7 +185,8 @@ public class TableOperationsImpl extends
if (limitVersion) {
List<PerColumnIteratorConfig> emptyArgs = Collections.emptyList();
opts = IteratorUtil.generateInitialTableProperties(emptyArgs);
- } else opts = Collections.emptyMap();
+ } else
+ opts = Collections.emptyMap();
try {
doTableOperation(TableOperation.CREATE, args, opts);
@@ -294,11 +296,12 @@ public class TableOperationsImpl extends
throw new AccumuloException(e.getMessage(), e);
} finally {
// always finish table op, even when exception
- if (opid != null) try {
- finishTableOperation(opid);
- } catch (Exception e) {
- log.warn(e.getMessage(), e);
- }
+ if (opid != null)
+ try {
+ finishTableOperation(opid);
+ } catch (Exception e) {
+ log.warn(e.getMessage(), e);
+ }
}
}
@@ -329,15 +332,18 @@ public class TableOperationsImpl extends
while (!successful) {
- if (attempt > 0) UtilWaitThread.sleep(100);
+ if (attempt > 0)
+ UtilWaitThread.sleep(100);
attempt++;
TabletLocation tl = tabLocator.locateTablet(split, false, false);
if (tl == null) {
- if (!Tables.exists(instance, tableId)) throw new TableNotFoundException(tableId, tableName, null);
- else if (Tables.getTableState(instance, tableId) == TableState.OFFLINE) throw new TableOfflineException(instance, tableId);
+ if (!Tables.exists(instance, tableId))
+ throw new TableNotFoundException(tableId, tableName, null);
+ else if (Tables.getTableState(instance, tableId) == TableState.OFFLINE)
+ throw new TableOfflineException(instance, tableId);
continue;
}
@@ -345,15 +351,16 @@ public class TableOperationsImpl extends
TabletClientService.Iface client = ThriftUtil.getTServerClient(tl.tablet_location, instance.getConfiguration());
try {
OpTimer opTimer = null;
- if (log.isTraceEnabled()) opTimer = new OpTimer(log, Level.TRACE).start("Splitting tablet " + tl.tablet_extent + " on " + tl.tablet_location
- + " at " + split);
+ if (log.isTraceEnabled())
+ opTimer = new OpTimer(log, Level.TRACE).start("Splitting tablet " + tl.tablet_extent + " on " + tl.tablet_location + " at " + split);
client.splitTablet(null, credentials, tl.tablet_extent.toThrift(), TextUtil.getByteBuffer(split));
// just split it, might as well invalidate it in the cache
tabLocator.invalidateCache(tl.tablet_extent);
- if (opTimer != null) opTimer.stop("Split tablet in %DURATION%");
+ if (opTimer != null)
+ opTimer.stop("Split tablet in %DURATION%");
} finally {
ThriftUtil.returnClient((TServiceClient) client);
}
@@ -365,7 +372,8 @@ public class TableOperationsImpl extends
continue;
} catch (ThriftSecurityException e) {
Tables.clearCache(instance);
- if (!Tables.exists(instance, tableId)) throw new TableNotFoundException(tableId, tableName, null);
+ if (!Tables.exists(instance, tableId))
+ throw new TableNotFoundException(tableId, tableName, null);
throw new AccumuloSecurityException(e.user, e.code, e);
} catch (NotServingTabletException e) {
tabLocator.invalidateCache(tl.tablet_extent);
@@ -442,7 +450,8 @@ public class TableOperationsImpl extends
ArrayList<Text> endRows = new ArrayList<Text>(tablets.size());
for (KeyExtent ke : tablets)
- if (ke.getEndRow() != null) endRows.add(ke.getEndRow());
+ if (ke.getEndRow() != null)
+ endRows.add(ke.getEndRow());
return endRows;
}
@@ -459,7 +468,8 @@ public class TableOperationsImpl extends
public Collection<Text> getSplits(String tableName, int maxSplits) throws TableNotFoundException {
Collection<Text> endRows = getSplits(tableName);
- if (endRows.size() <= maxSplits) return endRows;
+ if (endRows.size() <= maxSplits)
+ return endRows;
double r = (maxSplits + 1) / (double) (endRows.size());
double pos = 0;
@@ -514,10 +524,11 @@ public class TableOperationsImpl extends
String srcTableId = Tables.getTableId(instance, srcTableName);
- if (flush) _flush(srcTableId, null, null, true);
+ if (flush)
+ _flush(srcTableId, null, null, true);
- if (!Collections.disjoint(propertiesToExclude, propertiesToSet.keySet())) throw new IllegalArgumentException(
- "propertiesToSet and propertiesToExclude not disjoint");
+ if (!Collections.disjoint(propertiesToExclude, propertiesToSet.keySet()))
+ throw new IllegalArgumentException("propertiesToSet and propertiesToExclude not disjoint");
List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(srcTableId.getBytes()), ByteBuffer.wrap(newTableName.getBytes()));
Map<String,String> opts = new HashMap<String,String>();
@@ -588,7 +599,8 @@ public class TableOperationsImpl extends
String tableId = Tables.getTableId(instance, tableName);
- if (flush) _flush(tableId, start, end, true);
+ if (flush)
+ _flush(tableId, start, end, true);
List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableId.getBytes()), start == null ? EMPTY : TextUtil.getByteBuffer(start), end == null ? EMPTY
: TextUtil.getByteBuffer(end));
@@ -832,8 +844,10 @@ public class TableOperationsImpl extends
public Set<Range> splitRangeByTablets(String tableName, Range range, int maxSplits) throws AccumuloException, AccumuloSecurityException,
TableNotFoundException {
ArgumentChecker.notNull(tableName, range);
- if (maxSplits < 1) throw new IllegalArgumentException("maximum splits must be >= 1");
- if (maxSplits == 1) return Collections.singleton(range);
+ if (maxSplits < 1)
+ throw new IllegalArgumentException("maximum splits must be >= 1");
+ if (maxSplits == 1)
+ return Collections.singleton(range);
Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<String,Map<KeyExtent,List<Range>>>();
TabletLocator tl = TabletLocator.getInstance(instance, credentials, new Text(Tables.getTableId(instance, tableName)));
@@ -886,8 +900,10 @@ public class TableOperationsImpl extends
FileSystem fs = FileSystem.get(CachedConfiguration.getInstance());
Path failPath = new Path(failureDir);
FileStatus[] listStatus = fs.listStatus(failPath);
- if (fs.exists(failPath) && listStatus != null && listStatus.length != 0) throw new AccumuloException("Failure directory exists, and is not empty");
- if (!fs.exists(failPath)) fs.mkdirs(failPath);
+ if (fs.exists(failPath) && listStatus != null && listStatus.length != 0)
+ throw new AccumuloException("Failure directory exists, and is not empty");
+ if (!fs.exists(failPath))
+ fs.mkdirs(failPath);
try {
importDirectory(tableName, dir, failureDir, false);
@@ -906,11 +922,14 @@ public class TableOperationsImpl extends
ArgumentChecker.notNull(tableName, dir, failureDir);
FileSystem fs = FileSystem.get(CachedConfiguration.getInstance());
Path failPath = fs.makeQualified(new Path(failureDir));
- if (!fs.exists(new Path(dir))) throw new AccumuloException("Bulk import directory " + dir + " does not exist!");
- if (!fs.exists(failPath)) throw new AccumuloException("Bulk import failure directory " + failureDir + " does not exist!");
+ if (!fs.exists(new Path(dir)))
+ throw new AccumuloException("Bulk import directory " + dir + " does not exist!");
+ if (!fs.exists(failPath))
+ throw new AccumuloException("Bulk import failure directory " + failureDir + " does not exist!");
FileStatus[] listStatus = fs.listStatus(failPath);
if (listStatus != null && listStatus.length != 0) {
- if (listStatus.length == 1 && listStatus[0].isDir()) throw new AccumuloException("Bulk import directory " + failPath + " is a file");
+ if (listStatus.length == 1 && listStatus[0].isDir())
+ throw new AccumuloException("Bulk import directory " + failPath + " is a file");
throw new AccumuloException("Bulk import failure directory " + failPath + " is not empty");
}
Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java Thu Oct 27 15:24:51 2011
@@ -82,7 +82,8 @@ public class ConnectorImpl extends Conne
private String getTableId(String tableName) throws TableNotFoundException {
String tableId = Tables.getTableId(instance, tableName);
- if (Tables.getTableState(instance, tableId) == TableState.OFFLINE) throw new TableOfflineException(instance, tableId);
+ if (Tables.getTableState(instance, tableId) == TableState.OFFLINE)
+ throw new TableOfflineException(instance, tableId);
return tableId;
}
@@ -138,7 +139,8 @@ public class ConnectorImpl extends Conne
*/
@Override
public synchronized TableOperations tableOperations() {
- if (tableops == null) tableops = new TableOperationsImpl(instance, credentials);
+ if (tableops == null)
+ tableops = new TableOperationsImpl(instance, credentials);
return tableops;
}
@@ -149,7 +151,8 @@ public class ConnectorImpl extends Conne
*/
@Override
public synchronized SecurityOperations securityOperations() {
- if (secops == null) secops = new SecurityOperationsImpl(instance, credentials);
+ if (secops == null)
+ secops = new SecurityOperationsImpl(instance, credentials);
return secops;
}
@@ -161,7 +164,8 @@ public class ConnectorImpl extends Conne
*/
@Override
public synchronized InstanceOperations instanceOperations() {
- if (instanceops == null) instanceops = new InstanceOperations(instance, credentials);
+ if (instanceops == null)
+ instanceops = new InstanceOperations(instance, credentials);
return instanceops;
}
Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/MasterClient.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/MasterClient.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/MasterClient.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/MasterClient.java Thu Oct 27 15:24:51 2011
@@ -89,7 +89,8 @@ public class MasterClient {
} catch (Exception e) {
throw new AccumuloException(e);
} finally {
- if (client != null) close(client);
+ if (client != null)
+ close(client);
}
}
}
@@ -111,7 +112,8 @@ public class MasterClient {
} catch (Exception e) {
throw new AccumuloException(e);
} finally {
- if (client != null) close(client);
+ if (client != null)
+ close(client);
}
}
}
Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/MetadataLocationObtainer.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/MetadataLocationObtainer.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/MetadataLocationObtainer.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/MetadataLocationObtainer.java Thu Oct 27 15:24:51 2011
@@ -75,8 +75,9 @@ public class MetadataLocationObtainer im
try {
OpTimer opTimer = null;
- if (log.isTraceEnabled()) opTimer = new OpTimer(log, Level.TRACE).start("Looking up in " + src.tablet_extent.getTableId() + " row="
- + TextUtil.truncate(row) + " extent=" + src.tablet_extent + " tserver=" + src.tablet_location);
+ if (log.isTraceEnabled())
+ opTimer = new OpTimer(log, Level.TRACE).start("Looking up in " + src.tablet_extent.getTableId() + " row=" + TextUtil.truncate(row) + " extent="
+ + src.tablet_extent + " tserver=" + src.tablet_location);
Range range = new Range(row, true, stopRow, true);
@@ -92,7 +93,8 @@ public class MetadataLocationObtainer im
Constants.NO_AUTHS, false, instance.getConfiguration());
}
- if (opTimer != null) opTimer.stop("Got " + results.size() + " results from " + src.tablet_extent + " in %DURATION%");
+ if (opTimer != null)
+ opTimer.stop("Got " + results.size() + " results from " + src.tablet_extent + " in %DURATION%");
// System.out.println("results "+results.keySet());
@@ -103,13 +105,16 @@ public class MetadataLocationObtainer im
}
} catch (AccumuloServerException ase) {
- if (log.isTraceEnabled()) log.trace(src.tablet_extent.getTableId() + " lookup failed, " + src.tablet_location + " server side exception");
+ if (log.isTraceEnabled())
+ log.trace(src.tablet_extent.getTableId() + " lookup failed, " + src.tablet_location + " server side exception");
throw ase;
} catch (NotServingTabletException e) {
- if (log.isTraceEnabled()) log.trace(src.tablet_extent.getTableId() + " lookup failed, " + src.tablet_location + " not serving " + src.tablet_extent);
+ if (log.isTraceEnabled())
+ log.trace(src.tablet_extent.getTableId() + " lookup failed, " + src.tablet_location + " not serving " + src.tablet_extent);
parent.invalidateCache(src.tablet_extent);
} catch (AccumuloException e) {
- if (log.isTraceEnabled()) log.trace(src.tablet_extent.getTableId() + " lookup failed", e);
+ if (log.isTraceEnabled())
+ log.trace(src.tablet_extent.getTableId() + " lookup failed", e);
parent.invalidateCache(src.tablet_location);
}
@@ -142,7 +147,8 @@ public class MetadataLocationObtainer im
instance.getConfiguration());
if (failures.size() > 0) {
// invalidate extents in parents cache
- if (log.isTraceEnabled()) log.trace("lookupTablets failed for " + failures.size() + " extents");
+ if (log.isTraceEnabled())
+ log.trace("lookupTablets failed for " + failures.size() + " extents");
parent.invalidateCache(failures.keySet());
}
} catch (IOException e) {
Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java Thu Oct 27 15:24:51 2011
@@ -90,9 +90,11 @@ public class MultiTableBatchWriterImpl i
public synchronized BatchWriter getBatchWriter(String tableName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
ArgumentChecker.notNull(tableName);
String tableId = Tables.getNameToIdMap(instance).get(tableName);
- if (tableId == null) throw new TableNotFoundException(tableId, tableName, null);
+ if (tableId == null)
+ throw new TableNotFoundException(tableId, tableName, null);
- if (Tables.getTableState(instance, tableId) == TableState.OFFLINE) throw new TableOfflineException(instance, tableId);
+ if (Tables.getTableState(instance, tableId) == TableState.OFFLINE)
+ throw new TableOfflineException(instance, tableId);
BatchWriter tbw = tableWriters.get(tableId);
if (tbw == null) {
Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/RootTabletLocator.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/RootTabletLocator.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/RootTabletLocator.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/RootTabletLocator.java Thu Oct 27 15:24:51 2011
@@ -86,7 +86,8 @@ public class RootTabletLocator extends T
UtilWaitThread.sleep(500);
location = instance.getRootTabletLocation();
}
- if (location != null) return new TabletLocation(Constants.ROOT_TABLET_EXTENT, location);
+ if (location != null)
+ return new TabletLocation(Constants.ROOT_TABLET_EXTENT, location);
return null;
}
Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerImpl.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerImpl.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerImpl.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerImpl.java Thu Oct 27 15:24:51 2011
@@ -100,8 +100,10 @@ public class ScannerImpl extends Scanner
@Override
public synchronized void setBatchSize(int size) {
- if (size > 0) this.size = size;
- else throw new IllegalArgumentException("size must be greater than zero");
+ if (size > 0)
+ this.size = size;
+ else
+ throw new IllegalArgumentException("size must be greater than zero");
}
@Override
Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerIterator.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerIterator.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerIterator.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerIterator.java Thu Oct 27 15:24:51 2011
@@ -79,7 +79,8 @@ public class ScannerIterator implements
return;
}
- if (currentBatch.size() == 0) continue;
+ if (currentBatch.size() == 0)
+ continue;
synchQ.add(currentBatch);
return;
@@ -143,7 +144,8 @@ public class ScannerIterator implements
@SuppressWarnings("unchecked")
public boolean hasNext() {
- if (finished) return false;
+ if (finished)
+ return false;
if (iter != null && iter.hasNext()) {
return true;
@@ -161,8 +163,10 @@ public class ScannerIterator implements
if (obj instanceof Exception) {
finished = true;
- if (obj instanceof RuntimeException) throw (RuntimeException) obj;
- else throw new RuntimeException((Exception) obj);
+ if (obj instanceof RuntimeException)
+ throw (RuntimeException) obj;
+ else
+ throw new RuntimeException((Exception) obj);
}
List<KeyValue> currentBatch = (List<KeyValue>) obj;
@@ -188,7 +192,8 @@ public class ScannerIterator implements
}
public Entry<Key,Value> next() {
- if (hasNext()) return iter.next();
+ if (hasNext())
+ return iter.next();
throw new NoSuchElementException();
}
Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerOptions.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerOptions.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerOptions.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerOptions.java Thu Oct 27 15:24:51 2011
@@ -61,14 +61,17 @@ public class ScannerOptions implements S
@Override
public synchronized void addScanIterator(IteratorSetting si) {
ArgumentChecker.notNull(si);
- if (serverSideIteratorList.size() == 0) serverSideIteratorList = new ArrayList<IterInfo>();
+ if (serverSideIteratorList.size() == 0)
+ serverSideIteratorList = new ArrayList<IterInfo>();
for (IterInfo ii : serverSideIteratorList)
- if (ii.iterName.equals(si.getName())) throw new RuntimeException("Iterator name is already in use " + si.getName());
+ if (ii.iterName.equals(si.getName()))
+ throw new RuntimeException("Iterator name is already in use " + si.getName());
serverSideIteratorList.add(new IterInfo(si.getPriority(), si.getIteratorClass(), si.getName()));
- if (serverSideIteratorOptions.size() == 0) serverSideIteratorOptions = new HashMap<String,Map<String,String>>();
+ if (serverSideIteratorOptions.size() == 0)
+ serverSideIteratorOptions = new HashMap<String,Map<String,String>>();
Map<String,String> opts = serverSideIteratorOptions.get(si.getName());
@@ -101,7 +104,8 @@ public class ScannerOptions implements S
@Override
public synchronized void updateScanIteratorOption(String iteratorName, String key, String value) {
ArgumentChecker.notNull(iteratorName, key, value);
- if (serverSideIteratorOptions.size() == 0) serverSideIteratorOptions = new HashMap<String,Map<String,String>>();
+ if (serverSideIteratorOptions.size() == 0)
+ serverSideIteratorOptions = new HashMap<String,Map<String,String>>();
Map<String,String> opts = serverSideIteratorOptions.get(iteratorName);
@@ -121,7 +125,8 @@ public class ScannerOptions implements S
@Override
public synchronized void setupRegex(String iteratorName, int iteratorPriority) throws IOException {
ArgumentChecker.notNull(iteratorName);
- if (regexIterName != null) throw new RuntimeException("regex already setup");
+ if (regexIterName != null)
+ throw new RuntimeException("regex already setup");
addScanIterator(new IteratorSetting(iteratorPriority, iteratorName, RegExFilter.class));
regexIterName = iteratorName;
@@ -144,7 +149,8 @@ public class ScannerOptions implements S
@Override
public synchronized void setRowRegex(String regex) {
ArgumentChecker.notNull(regex);
- if (regexIterName == null) setupDefaultRegex();
+ if (regexIterName == null)
+ setupDefaultRegex();
setScanIteratorOption(regexIterName, RegExFilter.ROW_REGEX, regex);
}
@@ -157,7 +163,8 @@ public class ScannerOptions implements S
@Override
public synchronized void setColumnFamilyRegex(String regex) {
ArgumentChecker.notNull(regex);
- if (regexIterName == null) setupDefaultRegex();
+ if (regexIterName == null)
+ setupDefaultRegex();
setScanIteratorOption(regexIterName, RegExFilter.COLF_REGEX, regex);
}
@@ -170,7 +177,8 @@ public class ScannerOptions implements S
@Override
public synchronized void setColumnQualifierRegex(String regex) {
ArgumentChecker.notNull(regex);
- if (regexIterName == null) setupDefaultRegex();
+ if (regexIterName == null)
+ setupDefaultRegex();
setScanIteratorOption(regexIterName, RegExFilter.COLQ_REGEX, regex);
}
@@ -183,7 +191,8 @@ public class ScannerOptions implements S
@Override
public synchronized void setValueRegex(String regex) {
ArgumentChecker.notNull(regex);
- if (regexIterName == null) setupDefaultRegex();
+ if (regexIterName == null)
+ setupDefaultRegex();
setScanIteratorOption(regexIterName, RegExFilter.VALUE_REGEX, regex);
}
Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java Thu Oct 27 15:24:51 2011
@@ -86,7 +86,8 @@ public class ServerClient {
log.debug("ClientService request failed, retrying ... ", tte);
UtilWaitThread.sleep(100);
} finally {
- if (client != null) ServerClient.close(client);
+ if (client != null)
+ ServerClient.close(client);
}
}
}
@@ -102,7 +103,8 @@ public class ServerClient {
log.debug("ClientService request failed, retrying ... ", tte);
UtilWaitThread.sleep(100);
} finally {
- if (client != null) ServerClient.close(client);
+ if (client != null)
+ ServerClient.close(client);
}
}
}
@@ -119,9 +121,9 @@ public class ServerClient {
for (String tserver : zc.getChildren(ZooUtil.getRoot(instance) + Constants.ZTSERVERS)) {
String path = ZooUtil.getRoot(instance) + Constants.ZTSERVERS + "/" + tserver;
byte[] data = ZooUtil.getLockData(zc, path);
- if (data != null && !new String(data).equals("master")) servers.add(new ThriftTransportKey(new ServerServices(new String(data))
- .getAddressString(Service.TSERV_CLIENT), instance.getConfiguration().getPort(Property.TSERV_CLIENTPORT), instance.getConfiguration().getTimeInMillis(
- Property.GENERAL_RPC_TIMEOUT)));
+ if (data != null && !new String(data).equals("master"))
+ servers.add(new ThriftTransportKey(new ServerServices(new String(data)).getAddressString(Service.TSERV_CLIENT), instance.getConfiguration().getPort(
+ Property.TSERV_CLIENTPORT), instance.getConfiguration().getTimeInMillis(Property.GENERAL_RPC_TIMEOUT)));
}
boolean opened = false;
@@ -131,7 +133,8 @@ public class ServerClient {
opened = true;
return client;
} finally {
- if (!opened) log.warn("Failed to find an available server in the list of servers: " + servers);
+ if (!opened)
+ log.warn("Failed to find an available server in the list of servers: " + servers);
}
}
Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java Thu Oct 27 15:24:51 2011
@@ -50,8 +50,10 @@ public class Tables {
for (String tableId : tableIds) {
byte[] tblPath = zc.get(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_NAME);
if (tblPath != null) {
- if (nameAsKey) tableMap.put(new String(tblPath), tableId);
- else tableMap.put(tableId, new String(tblPath));
+ if (nameAsKey)
+ tableMap.put(new String(tblPath), tableId);
+ else
+ tableMap.put(tableId, new String(tblPath));
}
}
@@ -60,13 +62,15 @@ public class Tables {
public static String getTableId(Instance instance, String tableName) throws TableNotFoundException {
String tableId = getNameToIdMap(instance).get(tableName);
- if (tableId == null) throw new TableNotFoundException(tableId, tableName, null);
+ if (tableId == null)
+ throw new TableNotFoundException(tableId, tableName, null);
return tableId;
}
public static String getTableName(Instance instance, String tableId) throws TableNotFoundException {
String tableName = getIdToNameMap(instance).get(tableId);
- if (tableName == null) throw new TableNotFoundException(tableId, tableName, null);
+ if (tableName == null)
+ throw new TableNotFoundException(tableId, tableName, null);
return tableName;
}
@@ -102,7 +106,8 @@ public class Tables {
String statePath = ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_STATE;
ZooCache zc = getZooCache(instance);
byte[] state = zc.get(statePath);
- if (state == null) return TableState.UNKNOWN;
+ if (state == null)
+ return TableState.UNKNOWN;
return TableState.valueOf(new String(state));
}
Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java Thu Oct 27 15:24:51 2011
@@ -77,7 +77,8 @@ public abstract class TabletLocator {
@Override
public boolean equals(Object o) {
- if (o instanceof LocatorKey) return equals((LocatorKey) o);
+ if (o instanceof LocatorKey)
+ return equals((LocatorKey) o);
return false;
}
@@ -175,7 +176,8 @@ public abstract class TabletLocator {
@Override
public int compareTo(TabletLocation o) {
int result = tablet_extent.compareTo(o.tablet_extent);
- if (result == 0) result = tablet_location.compareTo(o.tablet_location);
+ if (result == 0)
+ result = tablet_location.compareTo(o.tablet_location);
return result;
}
}
Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java Thu Oct 27 15:24:51 2011
@@ -63,10 +63,15 @@ public class TabletLocatorImpl extends T
int ret;
- if (o1 == MAX_TEXT) if (o2 == MAX_TEXT) ret = 0;
- else ret = 1;
- else if (o2 == MAX_TEXT) ret = -1;
- else ret = o1.compareTo(o2);
+ if (o1 == MAX_TEXT)
+ if (o2 == MAX_TEXT)
+ ret = 0;
+ else
+ ret = 1;
+ else if (o2 == MAX_TEXT)
+ ret = -1;
+ else
+ ret = o1.compareTo(o2);
return ret;
}
@@ -107,7 +112,8 @@ public class TabletLocatorImpl extends T
AccumuloSecurityException, TableNotFoundException {
OpTimer opTimer = null;
- if (log.isTraceEnabled()) opTimer = new OpTimer(log, Level.TRACE).start("Binning " + mutations.size() + " mutations for table " + tableId);
+ if (log.isTraceEnabled())
+ opTimer = new OpTimer(log, Level.TRACE).start("Binning " + mutations.size() + " mutations for table " + tableId);
ArrayList<Mutation> notInCache = new ArrayList<Mutation>();
Text row = new Text();
@@ -125,8 +131,10 @@ public class TabletLocatorImpl extends T
for (Mutation mutation : mutations) {
row.set(mutation.getRow());
TabletLocation tl = locateTabletInCache(row);
- if (tl == null) notInCache.add(mutation);
- else addMutation(binnedMutations, mutation, tl);
+ if (tl == null)
+ notInCache.add(mutation);
+ else
+ addMutation(binnedMutations, mutation, tl);
}
} finally {
@@ -167,8 +175,8 @@ public class TabletLocatorImpl extends T
}
}
- if (opTimer != null) opTimer.stop("Binned " + mutations.size() + " mutations for table " + tableId + " to " + binnedMutations.size()
- + " tservers in %DURATION%");
+ if (opTimer != null)
+ opTimer.stop("Binned " + mutations.size() + " mutations for table " + tableId + " to " + binnedMutations.size() + " tservers in %DURATION%");
}
private void addMutation(Map<String,TabletServerMutations> binnedMutations, Mutation mutation, TabletLocation tl) {
@@ -196,16 +204,20 @@ public class TabletLocatorImpl extends T
if (range.getStartKey() != null) {
startRow = range.getStartKey().getRow();
- } else startRow = new Text();
+ } else
+ startRow = new Text();
TabletLocation tl = null;
- if (useCache) tl = locateTabletInCache(startRow);
- else if (!lookupFailed) tl = _locateTablet(startRow, false, false, false);
+ if (useCache)
+ tl = locateTabletInCache(startRow);
+ else if (!lookupFailed)
+ tl = _locateTablet(startRow, false, false, false);
if (tl == null) {
failures.add(range);
- if (!useCache) lookupFailed = true;
+ if (!useCache)
+ lookupFailed = true;
continue;
}
@@ -222,7 +234,8 @@ public class TabletLocatorImpl extends T
if (tl == null) {
failures.add(range);
- if (!useCache) lookupFailed = true;
+ if (!useCache)
+ lookupFailed = true;
continue l1;
}
tabletLocations.add(tl);
@@ -247,7 +260,8 @@ public class TabletLocatorImpl extends T
*/
OpTimer opTimer = null;
- if (log.isTraceEnabled()) opTimer = new OpTimer(log, Level.TRACE).start("Binning " + ranges.size() + " ranges for table " + tableId);
+ if (log.isTraceEnabled())
+ opTimer = new OpTimer(log, Level.TRACE).start("Binning " + ranges.size() + " ranges for table " + tableId);
List<Range> failures;
rLock.lock();
@@ -277,7 +291,8 @@ public class TabletLocatorImpl extends T
}
}
- if (opTimer != null) opTimer.stop("Binned " + ranges.size() + " ranges for table " + tableId + " to " + binnedRanges.size() + " tservers in %DURATION%");
+ if (opTimer != null)
+ opTimer.stop("Binned " + ranges.size() + " ranges for table " + tableId + " to " + binnedRanges.size() + " tservers in %DURATION%");
return failures;
}
@@ -290,7 +305,8 @@ public class TabletLocatorImpl extends T
} finally {
wLock.unlock();
}
- if (log.isTraceEnabled()) log.trace("Invalidated extent=" + failedExtent);
+ if (log.isTraceEnabled())
+ log.trace("Invalidated extent=" + failedExtent);
}
@Override
@@ -301,7 +317,8 @@ public class TabletLocatorImpl extends T
} finally {
wLock.unlock();
}
- if (log.isTraceEnabled()) log.trace("Invalidated " + keySet.size() + " cache entries for table " + tableId);
+ if (log.isTraceEnabled())
+ log.trace("Invalidated " + keySet.size() + " cache entries for table " + tableId);
}
@Override
@@ -319,7 +336,8 @@ public class TabletLocatorImpl extends T
wLock.unlock();
}
- if (log.isTraceEnabled()) log.trace("invalidated " + invalidatedCount + " cache entries table=" + tableId + " server=" + server);
+ if (log.isTraceEnabled())
+ log.trace("invalidated " + invalidatedCount + " cache entries table=" + tableId + " server=" + server);
}
@@ -333,15 +351,17 @@ public class TabletLocatorImpl extends T
} finally {
wLock.unlock();
}
- if (log.isTraceEnabled()) log.trace("invalidated all " + invalidatedCount + " cache entries for table=" + tableId);
+ if (log.isTraceEnabled())
+ log.trace("invalidated all " + invalidatedCount + " cache entries for table=" + tableId);
}
@Override
public TabletLocation locateTablet(Text row, boolean skipRow, boolean retry) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
OpTimer opTimer = null;
- if (log.isTraceEnabled()) opTimer = new OpTimer(log, Level.TRACE).start("Locating tablet table=" + tableId + " row=" + TextUtil.truncate(row)
- + " skipRow=" + skipRow + " retry=" + retry);
+ if (log.isTraceEnabled())
+ opTimer = new OpTimer(log, Level.TRACE).start("Locating tablet table=" + tableId + " row=" + TextUtil.truncate(row) + " skipRow=" + skipRow + " retry="
+ + retry);
while (true) {
@@ -351,12 +371,13 @@ public class TabletLocatorImpl extends T
if (retry && tl == null) {
UtilWaitThread.sleep(100);
- if (log.isTraceEnabled()) log.trace("Failed to locate tablet containing row " + TextUtil.truncate(row) + " in table " + tableId + ", will retry...");
+ if (log.isTraceEnabled())
+ log.trace("Failed to locate tablet containing row " + TextUtil.truncate(row) + " in table " + tableId + ", will retry...");
continue;
}
- if (opTimer != null) opTimer.stop("Located tablet " + (tl == null ? null : tl.tablet_extent) + " at " + (tl == null ? null : tl.tablet_location)
- + " in %DURATION%");
+ if (opTimer != null)
+ opTimer.stop("Located tablet " + (tl == null ? null : tl.tablet_extent) + " at " + (tl == null ? null : tl.tablet_location) + " in %DURATION%");
return tl;
}
@@ -376,7 +397,8 @@ public class TabletLocatorImpl extends T
if (er != null && er.compareTo(lastTabletRow) < 0) {
// System.out.println("er "+er+" ltr "+lastTabletRow);
ptl = parent.locateTablet(er, true, retry);
- if (ptl != null) locations = locationObtainer.lookupTablet(ptl, metadataRow, lastTabletRow, parent);
+ if (ptl != null)
+ locations = locationObtainer.lookupTablet(ptl, metadataRow, lastTabletRow, parent);
}
}
@@ -426,10 +448,12 @@ public class TabletLocatorImpl extends T
// add it to cache
Text er = tabletLocation.tablet_extent.getEndRow();
- if (er == null) er = MAX_TEXT;
+ if (er == null)
+ er = MAX_TEXT;
metaCache.put(er, tabletLocation);
- if (badExtents.size() > 0) removeOverlapping(badExtents, tabletLocation.tablet_extent);
+ if (badExtents.size() > 0)
+ removeOverlapping(badExtents, tabletLocation.tablet_extent);
}
static void removeOverlapping(TreeMap<Text,TabletLocation> metaCache, KeyExtent nke) {
@@ -478,7 +502,8 @@ public class TabletLocatorImpl extends T
if (entry != null) {
KeyExtent ke = entry.getValue().tablet_extent;
- if (ke.getPrevEndRow() == null || ke.getPrevEndRow().compareTo(row) < 0) return entry.getValue();
+ if (ke.getPrevEndRow() == null || ke.getPrevEndRow().compareTo(row) < 0)
+ return entry.getValue();
}
return null;
}
@@ -493,23 +518,27 @@ public class TabletLocatorImpl extends T
TabletLocation tl;
- if (lock) rLock.lock();
+ if (lock)
+ rLock.lock();
try {
processInvalidated();
tl = locateTabletInCache(row);
} finally {
- if (lock) rLock.unlock();
+ if (lock)
+ rLock.unlock();
}
if (tl == null) {
- if (lock) wLock.lock();
+ if (lock)
+ wLock.lock();
try {
// not in cache, so obtain info
lookupTabletLocation(row, retry);
tl = locateTabletInCache(row);
} finally {
- if (lock) wLock.unlock();
+ if (lock)
+ wLock.unlock();
}
}
@@ -518,14 +547,16 @@ public class TabletLocatorImpl extends T
private void processInvalidated() throws AccumuloSecurityException, AccumuloException, TableNotFoundException {
- if (badExtents.size() == 0) return;
+ if (badExtents.size() == 0)
+ return;
boolean writeLockHeld = rwLock.isWriteLockedByCurrentThread();
try {
if (!writeLockHeld) {
rLock.unlock();
wLock.lock();
- if (badExtents.size() == 0) return;
+ if (badExtents.size() == 0)
+ return;
}
List<Range> lookups = new ArrayList<Range>(badExtents.size());
Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchDeleter.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchDeleter.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchDeleter.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchDeleter.java Thu Oct 27 15:24:51 2011
@@ -73,7 +73,8 @@ public class TabletServerBatchDeleter ex
bw.addMutation(m);
}
} finally {
- if (bw != null) bw.close();
+ if (bw != null)
+ bw.close();
}
}
Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java?rev=1189806&r1=1189805&r2=1189806&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java Thu Oct 27 15:24:51 2011
@@ -148,8 +148,10 @@ public class TabletServerBatchReaderIter
try {
resultsQueue.put(new MyEntry(key, value));
} catch (InterruptedException e) {
- if (TabletServerBatchReaderIterator.this.queryThreadPool.isShutdown()) log.debug("Failed to add Batch Scan result for key " + key, e);
- else log.warn("Failed to add Batch Scan result for key " + key, e);
+ if (TabletServerBatchReaderIterator.this.queryThreadPool.isShutdown())
+ log.debug("Failed to add Batch Scan result for key " + key, e);
+ else
+ log.warn("Failed to add Batch Scan result for key " + key, e);
fatalException = e;
throw new RuntimeException(e);
@@ -171,15 +173,19 @@ public class TabletServerBatchReaderIter
public boolean hasNext() {
synchronized (nextLock) {
// check if one was cached
- if (nextEntry != null) return true;
+ if (nextEntry != null)
+ return true;
// don't have one cached, try to cache one and return success
try {
while (nextEntry == null && fatalException == null)
nextEntry = resultsQueue.poll(1, TimeUnit.SECONDS);
- if (fatalException != null) if (fatalException instanceof RuntimeException) throw (RuntimeException) fatalException;
- else throw new RuntimeException(fatalException);
+ if (fatalException != null)
+ if (fatalException instanceof RuntimeException)
+ throw (RuntimeException) fatalException;
+ else
+ throw new RuntimeException(fatalException);
return nextEntry.getKey() != null && nextEntry.getValue() != null;
} catch (InterruptedException e) {
@@ -234,12 +240,16 @@ public class TabletServerBatchReaderIter
// not work because nothing ever invalidated entries in the tabletLocator cache... so even though
// the table was deleted the tablet locator entries for the deleted table were not cleared... so
// need to always do the check when failures occur
- if (failures.size() >= lastFailureSize) if (!Tables.exists(instance, table)) throw new TableDeletedException(table);
- else if (Tables.getTableState(instance, table) == TableState.OFFLINE) throw new TableOfflineException(instance, table);
+ if (failures.size() >= lastFailureSize)
+ if (!Tables.exists(instance, table))
+ throw new TableDeletedException(table);
+ else if (Tables.getTableState(instance, table) == TableState.OFFLINE)
+ throw new TableOfflineException(instance, table);
lastFailureSize = failures.size();
- if (log.isTraceEnabled()) log.trace("Failed to bin " + failures.size() + " ranges, tablet locations were null, retrying in 100ms");
+ if (log.isTraceEnabled())
+ log.trace("Failed to bin " + failures.size() + " ranges, tablet locations were null, retrying in 100ms");
try {
Thread.sleep(100);
} catch (InterruptedException e) {
@@ -272,7 +282,8 @@ public class TabletServerBatchReaderIter
private void processFailures(Map<KeyExtent,List<Range>> failures, ResultReceiver receiver, List<Column> columns) throws AccumuloException,
AccumuloSecurityException, TableNotFoundException {
- if (log.isTraceEnabled()) log.trace("Failed to execute multiscans against " + failures.size() + " tablets, retrying...");
+ if (log.isTraceEnabled())
+ log.trace("Failed to execute multiscans against " + failures.size() + " tablets, retrying...");
UtilWaitThread.sleep(failSleepTime);
failSleepTime = Math.min(5000, failSleepTime * 2);
@@ -342,11 +353,15 @@ public class TabletServerBatchReaderIter
log.debug(e.getMessage(), e);
Tables.clearCache(instance);
- if (!Tables.exists(instance, table)) fatalException = new TableDeletedException(table);
- else fatalException = e;
+ if (!Tables.exists(instance, table))
+ fatalException = new TableDeletedException(table);
+ else
+ fatalException = e;
} catch (Throwable t) {
- if (queryThreadPool.isShutdown()) log.debug(t.getMessage(), t);
- else log.warn(t.getMessage(), t);
+ if (queryThreadPool.isShutdown())
+ log.debug(t.getMessage(), t);
+ else
+ log.warn(t.getMessage(), t);
fatalException = t;
} finally {
semaphore.release();
@@ -523,7 +538,8 @@ public class TabletServerBatchReaderIter
Translator.RT));
InitialMultiScan imsr = client.startMultiScan(null, credentials, thriftTabletRanges, Translator.translate(columns, Translator.CT),
options.serverSideIteratorList, options.serverSideIteratorOptions, ByteBufferUtil.toByteBuffers(authorizations.getAuthorizations()), waitForWrites);
- if (waitForWrites) ThriftScanner.serversWaitedForWrites.get(ttype).add(server);
+ if (waitForWrites)
+ ThriftScanner.serversWaitedForWrites.get(ttype).add(server);
MultiScanResult scanResult = imsr.result;