ninja-simplify & remove dead allocation
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e983ef13 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e983ef13 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e983ef13 Branch: refs/heads/cassandra-2.0 Commit: e983ef13b0cc4c16aad2c63590f3e42e6bc2d732 Parents: 558483d Author: Dave Brosius <dbros...@mebigfatguy.com> Authored: Fri Oct 18 21:41:00 2013 -0400 Committer: Dave Brosius <dbros...@mebigfatguy.com> Committed: Fri Oct 18 21:41:00 2013 -0400 ---------------------------------------------------------------------- .../org/apache/cassandra/service/StorageService.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/e983ef13/src/java/org/apache/cassandra/service/StorageService.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java index 11393c6..bde54a7 100644 --- a/src/java/org/apache/cassandra/service/StorageService.java +++ b/src/java/org/apache/cassandra/service/StorageService.java @@ -395,7 +395,6 @@ public class StorageService extends NotificationBroadcasterSupport implements IE // make magic happen Gossiper.instance.doShadowRound(); - Collection<Token> tokens = new ArrayList<Token>(); UUID hostId = null; // now that we've gossiped at least once, we should be able to find the node we're replacing if (Gossiper.instance.getEndpointStateForEndpoint(DatabaseDescriptor.getReplaceAddress())== null) @@ -405,16 +404,17 @@ public class StorageService extends NotificationBroadcasterSupport implements IE { if (Gossiper.instance.getEndpointStateForEndpoint(DatabaseDescriptor.getReplaceAddress()).getApplicationState(ApplicationState.TOKENS) == null) throw new RuntimeException("Could not find tokens for " + DatabaseDescriptor.getReplaceAddress() + " to replace"); - tokens = TokenSerializer.deserialize(getPartitioner(), new DataInputStream(new ByteArrayInputStream(getApplicationStateValue(DatabaseDescriptor.getReplaceAddress(), ApplicationState.TOKENS)))); + Collection<Token> tokens = TokenSerializer.deserialize(getPartitioner(), new DataInputStream(new ByteArrayInputStream(getApplicationStateValue(DatabaseDescriptor.getReplaceAddress(), ApplicationState.TOKENS)))); + + SystemTable.setLocalHostId(hostId); // use the replacee's host Id as our own so we receive hints, etc + MessagingService.instance().shutdown(); + Gossiper.instance.resetEndpointStateMap(); // clean up since we have what we need + return tokens; } catch (IOException e) { throw new RuntimeException(e); } - SystemTable.setLocalHostId(hostId); // use the replacee's host Id as our own so we receive hints, etc - MessagingService.instance().shutdown(); - Gossiper.instance.resetEndpointStateMap(); // clean up since we have what we need - return tokens; } public synchronized void initClient() throws IOException, ConfigurationException