From 58f585f6056b4990b010d84337ed2e91b27f2e33 Mon Sep 17 00:00:00 2001 From: Jonathan Ellis Date: Sun, 15 Nov 2009 08:06:32 +0000 Subject: [PATCH] minor cleanup. patch by jbellis git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@836337 13f79535-47bb-0310-9956-ffa450edef68 --- .../cassandra/service/StorageProxy.java | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/java/org/apache/cassandra/service/StorageProxy.java b/src/java/org/apache/cassandra/service/StorageProxy.java index 461d9ac48e..c8e1365680 100644 --- a/src/java/org/apache/cassandra/service/StorageProxy.java +++ b/src/java/org/apache/cassandra/service/StorageProxy.java @@ -17,6 +17,7 @@ */ package org.apache.cassandra.service; +import java.io.IOError; import java.io.IOException; import java.util.*; import java.util.concurrent.TimeUnit; @@ -169,13 +170,20 @@ public class StorageProxy implements StorageProxyMBean // Get all the targets and stick them in an array MessagingService.instance().sendRR(message, primaryNodes.toArray(new InetAddress[primaryNodes.size()]), quorumResponseHandler); - if (!quorumResponseHandler.get()) - throw new UnavailableException(); + try + { + if (!quorumResponseHandler.get()) + throw new UnavailableException(); + } + catch (DigestMismatchException e) + { + throw new AssertionError(e); + } if (primaryNodes.size() < endpointMap.size()) // Do we need to bother with Hinted Handoff? { for (Map.Entry e : endpointMap.entrySet()) { - if (e.getKey() != e.getValue()) // Hinted Handoff to target + if (!e.getKey().equals(e.getValue())) // Hinted Handoff to target { MessagingService.instance().sendOneWay(message, e.getValue()); } @@ -186,7 +194,7 @@ public class StorageProxy implements StorageProxyMBean { throw new UnavailableException(); } - catch (Exception e) + catch (IOException e) { throw new RuntimeException("error writing key " + rm.key(), e); } @@ -300,7 +308,7 @@ public class StorageProxy implements StorageProxyMBean * a specific set of column names from a given column family. */ public static List readProtocol(List commands, int consistency_level) - throws IOException, TimeoutException, InvalidRequestException, UnavailableException + throws IOException, TimeoutException, UnavailableException { long startTime = System.currentTimeMillis(); @@ -449,7 +457,7 @@ public class StorageProxy implements StorageProxyMBean * one of the other replicas (in the same data center if possible) till we get the data. In the event we get * the data we perform consistency checks and figure out if any repairs need to be done to the replicas. */ - private static List weakReadLocal(List commands) throws IOException + private static List weakReadLocal(List commands) { List rows = new ArrayList(); List> futures = new ArrayList>(); @@ -569,7 +577,7 @@ public class StorageProxy implements StorageProxyMBean { endPoint = tokenMetadata.getSuccessor(endPoint); // TODO move this into the Strategies & modify for RackAwareStrategy } while (!FailureDetector.instance().isAlive(endPoint)); - int maxResults = endPoint == wrapEndpoint ? rawCommand.maxResults : rawCommand.maxResults - allKeys.size(); + int maxResults = endPoint.equals(wrapEndpoint) ? rawCommand.maxResults : rawCommand.maxResults - allKeys.size(); command = new RangeCommand(command.table, command.columnFamily, command.startWith, command.stopAt, maxResults); } while (!endPoint.equals(startEndpoint));