Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/util/SoftValueSortedMap.java URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/util/SoftValueSortedMap.java?rev=942184&r1=942183&r2=942184&view=diff ============================================================================== --- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/util/SoftValueSortedMap.java (original) +++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/util/SoftValueSortedMap.java Fri May 7 19:17:48 2010 @@ -33,19 +33,19 @@ import java.util.TreeSet; * A SortedMap implementation that uses Soft Reference values * internally to make it play well with the GC when in a low-memory * situation. Use as a cache where you also need SortedMap functionality. - * + * * @param <K> key class * @param <V> value class */ public class SoftValueSortedMap<K,V> implements SortedMap<K,V> { private final SortedMap<K, SoftValue<K,V>> internalMap; private final ReferenceQueue rq = new ReferenceQueue(); - + /** Constructor */ public SoftValueSortedMap() { this(new TreeMap<K, SoftValue<K,V>>()); } - + /** * Constructor * @param c @@ -53,7 +53,7 @@ public class SoftValueSortedMap<K,V> imp public SoftValueSortedMap(final Comparator<K> c) { this(new TreeMap<K, SoftValue<K,V>>(c)); } - + /** For headMap and tailMap support */ private SoftValueSortedMap(SortedMap<K,SoftValue<K,V>> original) { this.internalMap = original; @@ -80,12 +80,12 @@ public class SoftValueSortedMap<K,V> imp new SoftValue<K,V>(key, value, this.rq)); return oldValue == null ? null : oldValue.get(); } - + @SuppressWarnings("unchecked") public synchronized void putAll(Map map) { throw new RuntimeException("Not implemented"); } - + public synchronized V get(Object key) { checkReferences(); SoftValue<K,V> value = this.internalMap.get(key); @@ -106,10 +106,10 @@ public class SoftValueSortedMap<K,V> imp } public synchronized boolean containsKey(Object key) { - checkReferences(); + checkReferences(); return this.internalMap.containsKey(key); } - + public synchronized boolean containsValue(Object value) { /* checkReferences(); return internalMap.containsValue(value);*/ @@ -125,22 +125,22 @@ public class SoftValueSortedMap<K,V> imp checkReferences(); return internalMap.lastKey(); } - + public synchronized SoftValueSortedMap<K,V> headMap(K key) { checkReferences(); return new SoftValueSortedMap<K,V>(this.internalMap.headMap(key)); } - + public synchronized SoftValueSortedMap<K,V> tailMap(K key) { checkReferences(); return new SoftValueSortedMap<K,V>(this.internalMap.tailMap(key)); } - + public synchronized SoftValueSortedMap<K,V> subMap(K fromKey, K toKey) { checkReferences(); return new SoftValueSortedMap<K,V>(this.internalMap.subMap(fromKey, toKey)); } - + public synchronized boolean isEmpty() { checkReferences(); return this.internalMap.isEmpty();
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/util/Strings.java URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/util/Strings.java?rev=942184&r1=942183&r2=942184&view=diff ============================================================================== --- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/util/Strings.java (original) +++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/util/Strings.java Fri May 7 19:17:48 2010 @@ -25,7 +25,7 @@ package org.apache.hadoop.hbase.util; public class Strings { public final static String DEFAULT_SEPARATOR = "="; public final static String DEFAULT_KEYVALUE_SEPARATOR = ", "; - + /** * Append to a StringBuilder a key/value. * Uses default separators. Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/util/Threads.java URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/util/Threads.java?rev=942184&r1=942183&r2=942184&view=diff ============================================================================== --- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/util/Threads.java (original) +++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/util/Threads.java Fri May 7 19:17:48 2010 @@ -29,7 +29,7 @@ import org.apache.hadoop.util.Reflection */ public class Threads { protected static final Log LOG = LogFactory.getLog(Threads.class); - + /** * Utility method that sets name, daemon status and starts passed thread. * @param t @@ -40,7 +40,7 @@ public class Threads { final String name) { return setDaemonThreadRunning(t, name, null); } - + /** * Utility method that sets name, daemon status and starts passed thread. * @param t Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/util/VersionInfo.java URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/util/VersionInfo.java?rev=942184&r1=942183&r2=942184&view=diff ============================================================================== --- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/util/VersionInfo.java (original) +++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/util/VersionInfo.java Fri May 7 19:17:48 2010 @@ -27,7 +27,7 @@ import org.apache.hadoop.hbase.VersionAn public class VersionInfo { private static Package myPackage; private static VersionAnnotation version; - + static { myPackage = VersionAnnotation.class.getPackage(); version = myPackage.getAnnotation(VersionAnnotation.class); @@ -40,7 +40,7 @@ public class VersionInfo { static Package getPackage() { return myPackage; } - + /** * Get the hbase version. * @return the hbase version string, eg. "0.6.3-dev" @@ -48,7 +48,7 @@ public class VersionInfo { public static String getVersion() { return version != null ? version.version() : "Unknown"; } - + /** * Get the subversion revision number for the root directory * @return the revision number, eg. "451451" @@ -56,7 +56,7 @@ public class VersionInfo { public static String getRevision() { return version != null ? version.revision() : "Unknown"; } - + /** * The date that hbase was compiled. * @return the compilation date in unix date format @@ -64,7 +64,7 @@ public class VersionInfo { public static String getDate() { return version != null ? version.date() : "Unknown"; } - + /** * The user that compiled hbase. * @return the username of the user @@ -72,7 +72,7 @@ public class VersionInfo { public static String getUser() { return version != null ? version.user() : "Unknown"; } - + /** * Get the subversion URL for the root hbase directory. * @return the url @@ -80,7 +80,7 @@ public class VersionInfo { public static String getUrl() { return version != null ? version.url() : "Unknown"; } - + /** * @param args */ Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/util/Writables.java URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/util/Writables.java?rev=942184&r1=942183&r2=942184&view=diff ============================================================================== --- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/util/Writables.java (original) +++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/util/Writables.java Fri May 7 19:17:48 2010 @@ -36,7 +36,7 @@ import org.apache.hadoop.io.WritableUtil public class Writables { /** * @param w - * @return The bytes of <code>w</code> gotten by running its + * @return The bytes of <code>w</code> gotten by running its * {...@link Writable#write(java.io.DataOutput)} method. * @throws IOException * @see #getWritable(byte[], Writable) @@ -119,7 +119,7 @@ public class Writables { throws IOException { return (HRegionInfo)getWritable(bytes, new HRegionInfo()); } - + /** * @param bytes * @return A HRegionInfo instance built out of passed <code>bytes</code> @@ -184,7 +184,7 @@ public class Writables { } return Bytes.toString(c.getValue()); } - + /** * @param c * @return Cell as a long. Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java?rev=942184&r1=942183&r2=942184&view=diff ============================================================================== --- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java (original) +++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWrapper.java Fri May 7 19:17:48 2010 @@ -105,7 +105,7 @@ public class ZooKeeperWrapper implements "master"); String stateZNodeName = conf.get("zookeeper.znode.state", "shutdown"); - + rootRegionZNode = getZNode(parentZNode, rootServerZNodeName); outOfSafeModeZNode = getZNode(parentZNode, outOfSafeModeZNodeName); rsZNode = getZNode(parentZNode, rsZNodeName); @@ -195,31 +195,31 @@ public class ZooKeeperWrapper implements } return sb.toString(); } - + /** * Gets the statistics from the given server. Uses a 1 minute timeout. - * + * * @param server The server to get the statistics from. * @return The array of response strings. * @throws IOException When the socket communication fails. */ - public String[] getServerStats(String server) + public String[] getServerStats(String server) throws IOException { return getServerStats(server, 1 * 60 * 1000); } - + /** * Gets the statistics from the given server. - * + * * @param server The server to get the statistics from. * @param timeout The socket timeout to use. * @return The array of response strings. * @throws IOException When the socket communication fails. */ - public String[] getServerStats(String server, int timeout) + public String[] getServerStats(String server, int timeout) throws IOException { String[] sp = server.split(":"); - Socket socket = new Socket(sp[0], + Socket socket = new Socket(sp[0], sp.length > 1 ? Integer.parseInt(sp[1]) : 2181); socket.setSoTimeout(timeout); PrintWriter out = new PrintWriter(socket.getOutputStream(), true); @@ -307,7 +307,7 @@ public class ZooKeeperWrapper implements public HServerAddress readMasterAddress(Watcher watcher) { return readAddress(masterElectionZNode, watcher); } - + /** * Watch the state of the cluster, up or down * @param watcher Watcher to set on cluster state node @@ -321,7 +321,7 @@ public class ZooKeeperWrapper implements LOG.warn("Failed to check on ZNode " + clusterStateZNode, e); } } - + /** * Set the cluster state, up or down * @param up True to write the node, false to delete it @@ -334,7 +334,7 @@ public class ZooKeeperWrapper implements try { if(up) { byte[] data = Bytes.toBytes("up"); - zooKeeper.create(clusterStateZNode, data, + zooKeeper.create(clusterStateZNode, data, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); LOG.debug("State node wrote in ZooKeeper"); } else { @@ -575,7 +575,7 @@ public class ZooKeeperWrapper implements return false; } - + /** * Write in ZK this RS startCode and address. * Ensures that the full path exists. @@ -622,7 +622,7 @@ public class ZooKeeperWrapper implements return false; } - + /** * Scans the regions servers directory * @return A list of server addresses @@ -641,7 +641,7 @@ public class ZooKeeperWrapper implements } return addresses; } - + /** * Method used to make sure the region server directory is empty. * @@ -659,7 +659,7 @@ public class ZooKeeperWrapper implements LOG.warn("Failed to delete " + rsZNode + " znodes in ZooKeeper: " + e); } } - + private boolean checkExistenceOf(String path) { Stat stat = null; try { @@ -684,7 +684,7 @@ public class ZooKeeperWrapper implements LOG.warn("Failed to close connection with ZooKeeper"); } } - + private String getZNode(String parentZNode, String znodeName) { return znodeName.charAt(0) == ZNODE_PATH_SEPARATOR ? znodeName : joinPath(parentZNode, znodeName); @@ -701,6 +701,6 @@ public class ZooKeeperWrapper implements public String getMasterElectionZNode() { return masterElectionZNode; } - - + + }