cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdusba...@apache.org
Subject svn commit: r953347 - in /cassandra/trunk/src/java/org/apache/cassandra/streaming: IncomingStreamReader.java StreamInManager.java
Date Thu, 10 Jun 2010 15:30:13 GMT
Author: gdusbabek
Date: Thu Jun 10 15:30:12 2010
New Revision: 953347

URL: http://svn.apache.org/viewvc?rev=953347&view=rev
Log:
rename getStreamContext. patch by gdusbabek, reviewed by jbellis. CASSANDRA-956

Modified:
    cassandra/trunk/src/java/org/apache/cassandra/streaming/IncomingStreamReader.java
    cassandra/trunk/src/java/org/apache/cassandra/streaming/StreamInManager.java

Modified: cassandra/trunk/src/java/org/apache/cassandra/streaming/IncomingStreamReader.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/streaming/IncomingStreamReader.java?rev=953347&r1=953346&r2=953347&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/streaming/IncomingStreamReader.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/streaming/IncomingStreamReader.java Thu
Jun 10 15:30:12 2010
@@ -40,7 +40,8 @@ public class IncomingStreamReader
     {
         this.socketChannel = socketChannel;
         InetSocketAddress remoteAddress = (InetSocketAddress)socketChannel.socket().getRemoteSocketAddress();
-        pendingFile = StreamInManager.getStreamContext(remoteAddress.getAddress());
+        // this is the part where we are assuming files come in order from a particular host.
+        pendingFile = StreamInManager.getNextIncomingFile(remoteAddress.getAddress());
         StreamInManager.activeStreams.put(remoteAddress.getAddress(), pendingFile);
         assert pendingFile != null;
         streamStatus = StreamInManager.getStreamStatus(remoteAddress.getAddress());

Modified: cassandra/trunk/src/java/org/apache/cassandra/streaming/StreamInManager.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/streaming/StreamInManager.java?rev=953347&r1=953346&r2=953347&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/streaming/StreamInManager.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/streaming/StreamInManager.java Thu Jun 10
15:30:12 2010
@@ -42,11 +42,18 @@ class StreamInManager
 
     public static final Multimap<InetAddress, PendingFile> activeStreams = Multimaps.synchronizedMultimap(HashMultimap.<InetAddress,
PendingFile>create());
 
-    public synchronized static PendingFile getStreamContext(InetAddress key)
+    /**
+     * gets the next file to be received given a host key.
+     * @param key
+     * @return next file to receive.
+     * @throws IndexOutOfBoundsException if you are unfortunate enough to call this on an
empty context. 
+     */
+    public synchronized static PendingFile getNextIncomingFile(InetAddress key)
     {        
         List<PendingFile> context = ctxBag_.get(key);
         if ( context == null )
             throw new IllegalStateException("Streaming context has not been set for " + key);
+        // will thrown an IndexOutOfBoundsException if nothing is there.
         PendingFile pendingFile = context.remove(0);
         if ( context.isEmpty() )
             ctxBag_.remove(key);



Mime
View raw message