Permalink
Browse files

Merge remote branch 'trunk/master' into li-r1008

  • Loading branch information...
2 parents 75922bc + 2b0efa0 commit 5bf107a36354280ad888feac0bc222a99a4f9711 @afeinberg afeinberg committed Feb 2, 2010
@@ -18,7 +18,6 @@
import static voldemort.cluster.failuredetector.FailureDetectorUtils.create;
-import java.io.StringReader;
import java.net.URI;
import java.util.Collection;
import java.util.concurrent.TimeUnit;
@@ -35,7 +34,6 @@
import voldemort.client.protocol.RequestFormatFactory;
import voldemort.client.protocol.RequestFormatType;
-import voldemort.cluster.Cluster;
import voldemort.cluster.Node;
import voldemort.cluster.failuredetector.ClientStoreVerifier;
import voldemort.cluster.failuredetector.FailureDetector;
@@ -18,13 +18,11 @@
import static voldemort.cluster.failuredetector.FailureDetectorUtils.create;
-import java.io.StringReader;
import java.net.URI;
import java.util.Collection;
import java.util.concurrent.TimeUnit;
import voldemort.client.protocol.RequestFormatType;
-import voldemort.cluster.Cluster;
import voldemort.cluster.Node;
import voldemort.cluster.failuredetector.ClientStoreVerifier;
import voldemort.cluster.failuredetector.FailureDetector;
@@ -11,9 +11,9 @@
private int rebalancingClientTimeoutSeconds = 7 * 24 * 60 * 60;
private boolean deleteAfterRebalancingEnabled;
- public static String MaxParallelRebalancingString = "max.parallel.rebalancing";
- public static String RebalancingClientTimeoutSeconds = "rebalancing.client.timeout.seconds";
- public static String EnableDeleteAfterRebalancing = "enable.delete.after.rebalancing";
+ public static final String MaxParallelRebalancingString = "max.parallel.rebalancing";
+ public static final String RebalancingClientTimeoutSeconds = "rebalancing.client.timeout.seconds";
+ public static final String EnableDeleteAfterRebalancing = "enable.delete.after.rebalancing";
public RebalanceClientConfig(Properties properties) {
super(properties);
@@ -135,6 +135,6 @@ public int hashCode() {
}
public int compareTo(Node other) {
- return new Integer(this.id).compareTo(other.getId());
+ return Integer.valueOf(this.id).compareTo(other.getId());
}
}
@@ -57,12 +57,12 @@ protected AbstractFailureDetector(FailureDetectorConfig failureDetectorConfig) {
nodeStatusMap = new ConcurrentHashMap<Node, NodeStatus>();
for(Node node: failureDetectorConfig.getNodes()) {
- nodeStatusMap.put(node, createNodeStatus(node, failureDetectorConfig.getTime()
- .getMilliseconds()));
+ nodeStatusMap.put(node, createNodeStatus(failureDetectorConfig.getTime()
+ .getMilliseconds()));
}
}
- private NodeStatus createNodeStatus(Node node, long currTime) {
+ private NodeStatus createNodeStatus(long currTime) {
NodeStatus nodeStatus = new NodeStatus();
nodeStatus.setLastChecked(currTime);
nodeStatus.setStartMillis(currTime);
@@ -216,7 +216,7 @@ protected NodeStatus getNodeStatus(Node node) {
if(nodeStatus == null) {
logger.warn("creating new node status for node " + node + " for failure detector.");
- nodeStatus = createNodeStatus(node, failureDetectorConfig.getTime().getMilliseconds());
+ nodeStatus = createNodeStatus(failureDetectorConfig.getTime().getMilliseconds());
nodeStatusMap.put(node, nodeStatus);
}
@@ -10,7 +10,6 @@
import voldemort.cluster.Cluster;
import voldemort.cluster.Node;
import voldemort.store.metadata.MetadataStore;
-import voldemort.versioning.Occured;
import voldemort.versioning.Version;
import voldemort.versioning.Versioned;
@@ -230,7 +230,6 @@ public void stop() {
executors.shutdownNow();
}
- @SuppressWarnings("cast")
private void rebalanceStore(String storeName,
AdminClient adminClient,
RebalancePartitionsInfo stealInfo)
@@ -249,7 +248,7 @@ private void rebalanceStore(String storeName,
voldemortConfig.getAdminSocketTimeout(),
TimeUnit.SECONDS);
- rebalanceStatusList.remove((Object) new Integer(asyncId));
+ rebalanceStatusList.remove((Object) asyncId);
if(stealInfo.getDeletePartitionsList().size() > 0) {
adminClient.deletePartitions(stealInfo.getDonorId(),
@@ -210,7 +210,6 @@ public static void main(String[] args) throws IOException {
}
}
- @SuppressWarnings("unchecked")
public void build() throws IOException {
logger.info("Building store " + storeDefinition.getName() + " for "
+ cluster.getNumberOfNodes() + " with " + numChunks + " chunks per node.");
@@ -321,6 +320,7 @@ public KeyValuePair toObject(byte[] bytes) {
private CompressionStrategy valueCompressor;
private CompressionStrategy keyCompressor;
+ @SuppressWarnings("unchecked")
public JsonObjectIterator(JsonReader reader, StoreDefinition storeDefinition) {
SerializerFactory factory = new DefaultSerializerFactory();
@@ -98,7 +98,7 @@
private final StoreDefinition storeDef;
private final FailureDetector failureDetector;
- private RoutingStrategy routingStrategy;
+ private volatile RoutingStrategy routingStrategy;
/**
* Create a RoutedStoreClient
@@ -307,7 +307,7 @@ public static String createReadOnlyIndex(Cluster cluster,
// make a temp dir
File dataDir = new File(baseDir + File.separatorChar + "read-only-temp-index-"
- + new Integer((int) (Math.random() * 1000)));
+ + ((int) (Math.random() * 1000)));
// build and open store
JsonStoreBuilder storeBuilder = new JsonStoreBuilder(jsonReader,
cluster,
@@ -356,7 +356,7 @@ public static int getMissingPartitionsSize(Cluster orig, Cluster updated) {
SortedSet<Integer> bPartitonSet = new TreeSet<Integer>(nodeB.getPartitionIds());
for(int p: nodeA.getPartitionIds()) {
- if(!bPartitonSet.contains(new Integer(p))) {
+ if(!bPartitonSet.contains(p)) {
diffPartition++;
}
}
@@ -72,7 +72,7 @@ public void doOperation(int id) throws Exception {
private static class StringResourceFactory implements ResourceFactory<Integer, String> {
public String create(Integer key) {
- return new String(key + "-val");
+ return key + "-val";
}
public void destroy(Integer key, String obj) {}
@@ -91,7 +91,7 @@ public void passivateObject(Object k, Object v) {}
public void destroyObject(Object k, Object v) {}
public Object makeObject(Object k) {
- return new String(k + "-val");
+ return k + "-val";
}
public boolean validateObject(Object k, Object v) {
@@ -11,7 +11,7 @@
return new ResourceFactory<String, String>() {
public String create(String key) throws Exception {
- return new String("resource");
+ return "resource";
}
public void destroy(String key, String obj) throws Exception {}
@@ -14,7 +14,7 @@
*/
public class PausableStorageConfiguration implements StorageConfiguration {
- private final String TYPE_NAME = "pausable";
+ private static final String TYPE_NAME = "pausable";
public PausableStorageConfiguration(@SuppressWarnings("unused") VoldemortConfig config) {}
@@ -4,8 +4,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
import junit.framework.TestCase;
import voldemort.Attempt;
@@ -134,6 +134,7 @@ public static ReadOnlyStorageEngineTestInstance create(SearchStrategy strategy,
File nodeDir = TestUtils.createTempDir(baseDir);
@SuppressWarnings("unchecked")
Serializer<String> keySerializer = (Serializer<String>) new DefaultSerializerFactory().getSerializer(keySerDef);
+ @SuppressWarnings("unchecked")
Serializer<String> valueSerializer = (Serializer<String>) new DefaultSerializerFactory().getSerializer(valueSerDef);
Map<Integer, Store<String, String>> nodeStores = Maps.newHashMap();
for(int i = 0; i < numNodes; i++) {

0 comments on commit 5bf107a

Please sign in to comment.