Author: ecn Date: Thu May 16 18:40:18 2013 New Revision: 1483496 URL: http://svn.apache.org/r1483496 Log: ACCUMULO-1421 simplify reflection lookup of SafeModeAction, reverting inadvertent check-in of LargeRowTest
Modified: accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/Accumulo.java accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/functional/LargeRowTest.java Modified: accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/Accumulo.java URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/Accumulo.java?rev=1483496&r1=1483495&r2=1483496&view=diff ============================================================================== --- accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/Accumulo.java (original) +++ accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/Accumulo.java Thu May 16 18:40:18 2013 @@ -218,29 +218,18 @@ public class Accumulo { DistributedFileSystem dfs = (DistributedFileSystem) FileSystem.get(CachedConfiguration.getInstance()); // So this: if (!dfs.setSafeMode(SafeModeAction.SAFEMODE_GET)) // Becomes this: - Class<?> constantClass; + Class<?> safeModeAction; try { // hadoop 2.0 - constantClass = Class.forName("org.apache.hadoop.hdfs.protocol.HdfsConstants"); + safeModeAction = Class.forName("org.apache.hadoop.hdfs.protocol.HdfsConstants$SafeModeAction"); } catch (ClassNotFoundException ex) { // hadoop 1.0 try { - constantClass = Class.forName("org.apache.hadoop.hdfs.protocol.FSConstants"); + safeModeAction = Class.forName("org.apache.hadoop.hdfs.protocol.FSConstants$SafeModeAction"); } catch (ClassNotFoundException e) { throw new RuntimeException("Cannot figure out the right class for Constants"); } } - Class<?> safeModeAction = null; - for (Class<?> klass : constantClass.getDeclaredClasses()) { - if (klass.getSimpleName().equals("SafeModeAction")) { - safeModeAction = klass; - break; - } - } - if (safeModeAction == null) { - throw new RuntimeException("Cannot find SafeModeAction in constants class"); - } - Object get = null; for (Object obj : safeModeAction.getEnumConstants()) { if (obj.toString().equals("SAFEMODE_GET")) Modified: accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/functional/LargeRowTest.java URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/functional/LargeRowTest.java?rev=1483496&r1=1483495&r2=1483496&view=diff ============================================================================== --- accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/functional/LargeRowTest.java (original) +++ accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/functional/LargeRowTest.java Thu May 16 18:40:18 2013 @@ -97,7 +97,7 @@ public class LargeRowTest extends Functi UtilWaitThread.sleep(12000); Logger.getLogger(LargeRowTest.class).warn("checking splits"); - checkSplits(REG_TABLE_NAME, NUM_PRE_SPLITS/2, NUM_PRE_SPLITS * 2); + checkSplits(REG_TABLE_NAME, NUM_PRE_SPLITS/2, NUM_PRE_SPLITS); verify(REG_TABLE_NAME); }