cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r915575 [1/3] - in /incubator/cassandra/trunk: ./ contrib/word_count/src/ interface/thrift/gen-java/org/apache/cassandra/thrift/ src/java/org/apache/cassandra/auth/ src/java/org/apache/cassandra/avro/ src/java/org/apache/cassandra/cache/ sr...
Date Tue, 23 Feb 2010 23:07:03 GMT
Author: jbellis
Date: Tue Feb 23 23:07:01 2010
New Revision: 915575

URL: http://svn.apache.org/viewvc?rev=915575&view=rev
Log:
merge r915463 from 0.6 manually by running rat on trunk

Modified:
    incubator/cassandra/trunk/   (props changed)
    incubator/cassandra/trunk/contrib/word_count/src/WordCount.java
    incubator/cassandra/trunk/contrib/word_count/src/WordCountSetup.java
    incubator/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java   (props changed)
    incubator/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java   (props changed)
    incubator/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java   (props changed)
    incubator/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java   (props changed)
    incubator/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java   (props changed)
    incubator/cassandra/trunk/src/java/org/apache/cassandra/auth/AllowAllAuthenticator.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/auth/IAuthenticator.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/auth/SimpleAuthenticator.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/avro/AvroValidation.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/avro/KeyspaceNotDefinedException.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/avro/RecordFactory.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/AbstractCache.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/IAggregatableCacheProvider.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/InstrumentedCache.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/JMXAggregatingCache.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/JMXAggregatingCacheMBean.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/JMXInstrumentedCache.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/JMXInstrumentedCacheMBean.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/commitlog/CommitLogExecutorService.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/AbstractBounds.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/Bounds.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilyInputFormat.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/hadoop/ColumnFamilySplit.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/io/DeletionService.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/io/SSTableDeletingReference.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/io/util/FileDataInput.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/io/util/MappedFileDataInput.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/net/IncomingTcpConnection.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/net/OutboundTcpConnection.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/service/EmbeddedCassandraService.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/streaming/CompletedFileStatus.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/streaming/PendingFile.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/streaming/StreamCompletionHandler.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/streaming/StreamFinishedVerbHandler.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/streaming/StreamIn.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/streaming/StreamInitiateDoneVerbHandler.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/streaming/StreamInitiateVerbHandler.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/streaming/StreamRequestMessage.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/streaming/StreamRequestMetadata.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/thrift/ThriftGlue.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/tools/NodeCmd.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/LatencyTracker.java
    incubator/cassandra/trunk/test/unit/org/apache/cassandra/dht/BoundsTest.java
    incubator/cassandra/trunk/test/unit/org/apache/cassandra/dht/RangeIntersectionTest.java

Propchange: incubator/cassandra/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 23 23:07:01 2010
@@ -1,5 +1,5 @@
 /incubator/cassandra/branches/cassandra-0.3:774578-796573
 /incubator/cassandra/branches/cassandra-0.4:810145-834239,834349-834350
 /incubator/cassandra/branches/cassandra-0.5:888872-910752
-/incubator/cassandra/branches/cassandra-0.6:911237-915432
+/incubator/cassandra/branches/cassandra-0.6:911237-915432,915463
 /incubator/cassandra/trunk:749219-888871

Modified: incubator/cassandra/trunk/contrib/word_count/src/WordCount.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/contrib/word_count/src/WordCount.java?rev=915575&r1=915574&r2=915575&view=diff
==============================================================================
--- incubator/cassandra/trunk/contrib/word_count/src/WordCount.java (original)
+++ incubator/cassandra/trunk/contrib/word_count/src/WordCount.java Tue Feb 23 23:07:01 2010
@@ -117,4 +117,4 @@
         }
         return 0;
     }
-}
\ No newline at end of file
+}

Modified: incubator/cassandra/trunk/contrib/word_count/src/WordCountSetup.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/contrib/word_count/src/WordCountSetup.java?rev=915575&r1=915574&r2=915575&view=diff
==============================================================================
--- incubator/cassandra/trunk/contrib/word_count/src/WordCountSetup.java (original)
+++ incubator/cassandra/trunk/contrib/word_count/src/WordCountSetup.java Tue Feb 23 23:07:01 2010
@@ -1,61 +1,61 @@
-import java.util.Arrays;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cassandra.db.*;
-import org.apache.cassandra.service.StorageProxy;
-import org.apache.cassandra.service.StorageService;
-import org.apache.cassandra.thrift.ConsistencyLevel;
-
-public class WordCountSetup
-{
-    private static final Logger logger = Logger.getLogger(WordCountSetup.class);
-
-    public static final int TEST_COUNT = 4;
-
-    public static void main(String[] args) throws Exception
-    {
-        StorageService.instance.initClient();
-        logger.info("Sleeping " + WordCount.RING_DELAY);
-        Thread.sleep(WordCount.RING_DELAY);
-        assert !StorageService.instance.getLiveNodes().isEmpty();
-
-        RowMutation rm;
-        ColumnFamily cf;
-        byte[] columnName;
-
-        // text0: no rows
-
-        // text1: 1 row, 1 word
-        columnName = "text1".getBytes();
-        rm = new RowMutation(WordCount.KEYSPACE, "Key0");
-        cf = ColumnFamily.create(WordCount.KEYSPACE, WordCount.COLUMN_FAMILY);
-        cf.addColumn(new Column(columnName, "word1".getBytes(), 0));
-        rm.add(cf);
-        StorageProxy.mutateBlocking(Arrays.asList(rm), ConsistencyLevel.ONE);
-        logger.info("added text1");
-
-        // text2: 1 row, 2 words
-        columnName = "text2".getBytes();
-        rm = new RowMutation(WordCount.KEYSPACE, "Key0");
-        cf = ColumnFamily.create(WordCount.KEYSPACE, WordCount.COLUMN_FAMILY);
-        cf.addColumn(new Column(columnName, "word1 word2".getBytes(), 0));
-        rm.add(cf);
-        StorageProxy.mutateBlocking(Arrays.asList(rm), ConsistencyLevel.ONE);
-        logger.info("added text2");
-
-        // text3: 1000 rows, 1 word
-        columnName = "text3".getBytes();
-        for (int i = 0; i < 1000; i++)
-        {
-            rm = new RowMutation(WordCount.KEYSPACE, "Key" + i);
-            cf = ColumnFamily.create(WordCount.KEYSPACE, WordCount.COLUMN_FAMILY);
-            cf.addColumn(new Column(columnName, "word1".getBytes(), 0));
-            rm.add(cf);
-            StorageProxy.mutateBlocking(Arrays.asList(rm), ConsistencyLevel.ONE);
-        }
-        logger.info("added text3");
-
-        System.exit(0);
-    }
-}
+import java.util.Arrays;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cassandra.db.*;
+import org.apache.cassandra.service.StorageProxy;
+import org.apache.cassandra.service.StorageService;
+import org.apache.cassandra.thrift.ConsistencyLevel;
+
+public class WordCountSetup
+{
+    private static final Logger logger = Logger.getLogger(WordCountSetup.class);
+
+    public static final int TEST_COUNT = 4;
+
+    public static void main(String[] args) throws Exception
+    {
+        StorageService.instance.initClient();
+        logger.info("Sleeping " + WordCount.RING_DELAY);
+        Thread.sleep(WordCount.RING_DELAY);
+        assert !StorageService.instance.getLiveNodes().isEmpty();
+
+        RowMutation rm;
+        ColumnFamily cf;
+        byte[] columnName;
+
+        // text0: no rows
+
+        // text1: 1 row, 1 word
+        columnName = "text1".getBytes();
+        rm = new RowMutation(WordCount.KEYSPACE, "Key0");
+        cf = ColumnFamily.create(WordCount.KEYSPACE, WordCount.COLUMN_FAMILY);
+        cf.addColumn(new Column(columnName, "word1".getBytes(), 0));
+        rm.add(cf);
+        StorageProxy.mutateBlocking(Arrays.asList(rm), ConsistencyLevel.ONE);
+        logger.info("added text1");
+
+        // text2: 1 row, 2 words
+        columnName = "text2".getBytes();
+        rm = new RowMutation(WordCount.KEYSPACE, "Key0");
+        cf = ColumnFamily.create(WordCount.KEYSPACE, WordCount.COLUMN_FAMILY);
+        cf.addColumn(new Column(columnName, "word1 word2".getBytes(), 0));
+        rm.add(cf);
+        StorageProxy.mutateBlocking(Arrays.asList(rm), ConsistencyLevel.ONE);
+        logger.info("added text2");
+
+        // text3: 1000 rows, 1 word
+        columnName = "text3".getBytes();
+        for (int i = 0; i < 1000; i++)
+        {
+            rm = new RowMutation(WordCount.KEYSPACE, "Key" + i);
+            cf = ColumnFamily.create(WordCount.KEYSPACE, WordCount.COLUMN_FAMILY);
+            cf.addColumn(new Column(columnName, "word1".getBytes(), 0));
+            rm.add(cf);
+            StorageProxy.mutateBlocking(Arrays.asList(rm), ConsistencyLevel.ONE);
+        }
+        logger.info("added text3");
+
+        System.exit(0);
+    }
+}

Propchange: incubator/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 23 23:07:01 2010
@@ -1,6 +1,6 @@
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/Cassandra.java:774578-796573
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/Cassandra.java:810145-834239,834349-834350
 /incubator/cassandra/branches/cassandra-0.5/interface/gen-java/org/apache/cassandra/service/Cassandra.java:888872-903502
-/incubator/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:911237-915432
+/incubator/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:911237-915432,915463
 /incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java:749219-768588
 /incubator/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Cassandra.java:749219-904544

Propchange: incubator/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 23 23:07:01 2010
@@ -1,7 +1,7 @@
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/column_t.java:774578-792198
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/Column.java:810145-834239,834349-834350
 /incubator/cassandra/branches/cassandra-0.5/interface/gen-java/org/apache/cassandra/service/Column.java:888872-903502
-/incubator/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:911237-915432
+/incubator/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:911237-915432,915463
 /incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Column.java:749219-794428
 /incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/column_t.java:749219-768588
 /incubator/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/Column.java:749219-904544

Propchange: incubator/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 23 23:07:01 2010
@@ -1,6 +1,6 @@
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:774578-796573
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:810145-834239,834349-834350
 /incubator/cassandra/branches/cassandra-0.5/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:888872-903502
-/incubator/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:911237-915432
+/incubator/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:911237-915432,915463
 /incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:749219-768588
 /incubator/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/InvalidRequestException.java:749219-904544

Propchange: incubator/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 23 23:07:01 2010
@@ -1,5 +1,5 @@
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:774578-796573
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:810145-834239,834349-834350
 /incubator/cassandra/branches/cassandra-0.5/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:888872-903502
-/incubator/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:911237-915432
+/incubator/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/NotFoundException.java:911237-915432,915463
 /incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:749219-768588

Propchange: incubator/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 23 23:07:01 2010
@@ -1,7 +1,7 @@
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/superColumn_t.java:774578-792198
 /incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/SuperColumn.java:810145-834239,834349-834350
 /incubator/cassandra/branches/cassandra-0.5/interface/gen-java/org/apache/cassandra/service/SuperColumn.java:888872-903502
-/incubator/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:911237-915432
+/incubator/cassandra/branches/cassandra-0.6/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:911237-915432,915463
 /incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/SuperColumn.java:749219-794428
 /incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/superColumn_t.java:749219-768588
 /incubator/cassandra/trunk/interface/thrift/gen-java/org/apache/cassandra/thrift/SuperColumn.java:749219-904544

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/auth/AllowAllAuthenticator.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/auth/AllowAllAuthenticator.java?rev=915575&r1=915574&r2=915575&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/auth/AllowAllAuthenticator.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/auth/AllowAllAuthenticator.java Tue Feb 23 23:07:01 2010
@@ -1,4 +1,25 @@
 package org.apache.cassandra.auth;
+/*
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ */
+
 
 import org.apache.cassandra.thrift.AuthenticationException;
 import org.apache.cassandra.thrift.AuthenticationRequest;

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/auth/IAuthenticator.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/auth/IAuthenticator.java?rev=915575&r1=915574&r2=915575&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/auth/IAuthenticator.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/auth/IAuthenticator.java Tue Feb 23 23:07:01 2010
@@ -1,4 +1,25 @@
 package org.apache.cassandra.auth;
+/*
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ */
+
 
 import org.apache.cassandra.thrift.AuthenticationException;
 import org.apache.cassandra.thrift.AuthenticationRequest;

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/auth/SimpleAuthenticator.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/auth/SimpleAuthenticator.java?rev=915575&r1=915574&r2=915575&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/auth/SimpleAuthenticator.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/auth/SimpleAuthenticator.java Tue Feb 23 23:07:01 2010
@@ -1,4 +1,25 @@
 package org.apache.cassandra.auth;
+/*
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ */
+
 
 import java.io.*;
 import java.security.MessageDigest;

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/avro/AvroValidation.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/avro/AvroValidation.java?rev=915575&r1=915574&r2=915575&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/avro/AvroValidation.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/avro/AvroValidation.java Tue Feb 23 23:07:01 2010
@@ -1,4 +1,25 @@
 package org.apache.cassandra.avro;
+/*
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ */
+
 
 import java.util.Arrays;
 import org.apache.avro.util.Utf8;

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java?rev=915575&r1=915574&r2=915575&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java Tue Feb 23 23:07:01 2010
@@ -1,4 +1,25 @@
 package org.apache.cassandra.avro;
+/*
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ */
+
 
 import java.io.IOException;
 import java.nio.ByteBuffer;

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/avro/KeyspaceNotDefinedException.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/avro/KeyspaceNotDefinedException.java?rev=915575&r1=915574&r2=915575&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/avro/KeyspaceNotDefinedException.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/avro/KeyspaceNotDefinedException.java Tue Feb 23 23:07:01 2010
@@ -1,4 +1,25 @@
 package org.apache.cassandra.avro;
+/*
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ */
+
 
 import org.apache.avro.util.Utf8;
 

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/avro/RecordFactory.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/avro/RecordFactory.java?rev=915575&r1=915574&r2=915575&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/avro/RecordFactory.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/avro/RecordFactory.java Tue Feb 23 23:07:01 2010
@@ -1,4 +1,25 @@
 package org.apache.cassandra.avro;
+/*
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ */
+
 
 import java.nio.ByteBuffer;
 import org.apache.avro.generic.GenericArray;
@@ -105,4 +126,4 @@
     {
         return newUnavailableException(new Utf8(why));
     }
-}
\ No newline at end of file
+}

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/AbstractCache.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/AbstractCache.java?rev=915575&r1=915574&r2=915575&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/AbstractCache.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/AbstractCache.java Tue Feb 23 23:07:01 2010
@@ -1,22 +1,43 @@
-package org.apache.cassandra.cache;
-
-import java.lang.management.ManagementFactory;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-public class AbstractCache
-{
-    static void registerMBean(Object cache, String table, String name)
-    {
-        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
-        try
-        {
-            String mbeanName = "org.apache.cassandra.db:type=Caches,keyspace=" + table + ",cache=" + name;
-            mbs.registerMBean(cache, new ObjectName(mbeanName));
-        }
-        catch (Exception e)
-        {
-            throw new RuntimeException(e);
-        }
-    }
-}
+package org.apache.cassandra.cache;
+/*
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ */
+
+
+import java.lang.management.ManagementFactory;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+public class AbstractCache
+{
+    static void registerMBean(Object cache, String table, String name)
+    {
+        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+        try
+        {
+            String mbeanName = "org.apache.cassandra.db:type=Caches,keyspace=" + table + ",cache=" + name;
+            mbs.registerMBean(cache, new ObjectName(mbeanName));
+        }
+        catch (Exception e)
+        {
+            throw new RuntimeException(e);
+        }
+    }
+}

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/IAggregatableCacheProvider.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/IAggregatableCacheProvider.java?rev=915575&r1=915574&r2=915575&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/IAggregatableCacheProvider.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/IAggregatableCacheProvider.java Tue Feb 23 23:07:01 2010
@@ -1,7 +1,28 @@
-package org.apache.cassandra.cache;
-
-public interface IAggregatableCacheProvider<K, V>
-{
-    public InstrumentedCache<K, V> getCache();
-    public long getObjectCount();
-}
+package org.apache.cassandra.cache;
+/*
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ */
+
+
+public interface IAggregatableCacheProvider<K, V>
+{
+    public InstrumentedCache<K, V> getCache();
+    public long getObjectCount();
+}

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/InstrumentedCache.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/InstrumentedCache.java?rev=915575&r1=915574&r2=915575&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/InstrumentedCache.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/InstrumentedCache.java Tue Feb 23 23:07:01 2010
@@ -1,85 +1,106 @@
-package org.apache.cassandra.cache;
-
-import java.util.concurrent.atomic.AtomicLong;
-
-import com.reardencommerce.kernel.collections.shared.evictable.ConcurrentLinkedHashMap;
-
-public class InstrumentedCache<K, V>
-{
-    private int capacity;
-    private final ConcurrentLinkedHashMap<K, V> map;
-    private final AtomicLong requests = new AtomicLong(0);
-    private final AtomicLong hits = new AtomicLong(0);
-    long lastRequests, lastHits;
-
-    public InstrumentedCache(int capacity)
-    {
-        this.capacity = capacity;
-        map = ConcurrentLinkedHashMap.create(ConcurrentLinkedHashMap.EvictionPolicy.SECOND_CHANCE, capacity);
-    }
-
-    public void put(K key, V value)
-    {
-        map.put(key, value);
-    }
-
-    public V get(K key)
-    {
-        V v = map.get(key);
-        requests.incrementAndGet();
-        if (v != null)
-            hits.incrementAndGet();
-        return v;
-    }
-
-    public V getInternal(K key)
-    {
-        return map.get(key);
-    }
-
-    public void remove(K key)
-    {
-        map.remove(key);
-    }
-
-    public int getCapacity()
-    {
-        return capacity;
-    }
-
-    public void setCapacity(int capacity)
-    {
-        map.setCapacity(capacity);
-        this.capacity = capacity;
-     }
-
-    public int getSize()
-    {
-        return map.size();
-    }
-
-    public long getHits()
-    {
-        return hits.get();
-    }
-
-    public long getRequests()
-    {
-        return requests.get();
-    }
-
-    public double getRecentHitRate()
-    {
-        long r = requests.get();
-        long h = hits.get();
-        try
-        {
-            return ((double)(h - lastHits)) / (r - lastRequests);
-        }
-        finally
-        {
-            lastRequests = r;
-            lastHits = h;
-        }
-    }
-}
+package org.apache.cassandra.cache;
+/*
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ */
+
+
+import java.util.concurrent.atomic.AtomicLong;
+
+import com.reardencommerce.kernel.collections.shared.evictable.ConcurrentLinkedHashMap;
+
+public class InstrumentedCache<K, V>
+{
+    private int capacity;
+    private final ConcurrentLinkedHashMap<K, V> map;
+    private final AtomicLong requests = new AtomicLong(0);
+    private final AtomicLong hits = new AtomicLong(0);
+    long lastRequests, lastHits;
+
+    public InstrumentedCache(int capacity)
+    {
+        this.capacity = capacity;
+        map = ConcurrentLinkedHashMap.create(ConcurrentLinkedHashMap.EvictionPolicy.SECOND_CHANCE, capacity);
+    }
+
+    public void put(K key, V value)
+    {
+        map.put(key, value);
+    }
+
+    public V get(K key)
+    {
+        V v = map.get(key);
+        requests.incrementAndGet();
+        if (v != null)
+            hits.incrementAndGet();
+        return v;
+    }
+
+    public V getInternal(K key)
+    {
+        return map.get(key);
+    }
+
+    public void remove(K key)
+    {
+        map.remove(key);
+    }
+
+    public int getCapacity()
+    {
+        return capacity;
+    }
+
+    public void setCapacity(int capacity)
+    {
+        map.setCapacity(capacity);
+        this.capacity = capacity;
+     }
+
+    public int getSize()
+    {
+        return map.size();
+    }
+
+    public long getHits()
+    {
+        return hits.get();
+    }
+
+    public long getRequests()
+    {
+        return requests.get();
+    }
+
+    public double getRecentHitRate()
+    {
+        long r = requests.get();
+        long h = hits.get();
+        try
+        {
+            return ((double)(h - lastHits)) / (r - lastRequests);
+        }
+        finally
+        {
+            lastRequests = r;
+            lastHits = h;
+        }
+    }
+}

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/JMXAggregatingCache.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/JMXAggregatingCache.java?rev=915575&r1=915574&r2=915575&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/JMXAggregatingCache.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/JMXAggregatingCache.java Tue Feb 23 23:07:01 2010
@@ -1,78 +1,99 @@
-package org.apache.cassandra.cache;
-
-public class JMXAggregatingCache implements JMXAggregatingCacheMBean
-{
-    private final Iterable<IAggregatableCacheProvider> cacheProviders;
-
-    public JMXAggregatingCache(Iterable<IAggregatableCacheProvider> caches, String table, String name)
-    {
-        this.cacheProviders = caches;
-        AbstractCache.registerMBean(this, table, name);
-    }
-
-    public int getCapacity()
-    {
-        int capacity = 0;
-        for (IAggregatableCacheProvider cacheProvider : cacheProviders)
-        {
-            capacity += cacheProvider.getCache().getCapacity();
-        }
-        return capacity;
-    }
-
-    public void setCapacity(int capacity)
-    {
-        long totalObjects = 0;
-        for (IAggregatableCacheProvider cacheProvider : cacheProviders)
-        {
-            totalObjects += cacheProvider.getObjectCount();
-        }
-        for (IAggregatableCacheProvider cacheProvider : cacheProviders)
-        {
-            double ratio = ((double)cacheProvider.getObjectCount()) / totalObjects;
-            cacheProvider.getCache().setCapacity((int)(capacity * ratio));
-        }
-    }
-
-    public int getSize()
-    {
-        int size = 0;
-        for (IAggregatableCacheProvider cacheProvider : cacheProviders)
-        {
-            size += cacheProvider.getCache().getSize();
-        }
-        return size;
-    }
-
-    public long getRequests()
-    {
-        long requests = 0;
-        for (IAggregatableCacheProvider cacheProvider : cacheProviders)
-        {
-            requests += cacheProvider.getCache().getRequests();
-        }
-        return requests;
-    }
-
-    public long getHits()
-    {
-        long hits = 0;
-        for (IAggregatableCacheProvider cacheProvider : cacheProviders)
-        {
-            hits += cacheProvider.getCache().getHits();
-        }
-        return hits;
-    }
-
-    public double getRecentHitRate()
-    {
-        int n = 0;
-        double rate = 0;
-        for (IAggregatableCacheProvider cacheProvider : cacheProviders)
-        {
-            rate += cacheProvider.getCache().getRecentHitRate();
-            n++;
-        }
-        return rate / n;
-    }
-}
+package org.apache.cassandra.cache;
+/*
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ */
+
+
+public class JMXAggregatingCache implements JMXAggregatingCacheMBean
+{
+    private final Iterable<IAggregatableCacheProvider> cacheProviders;
+
+    public JMXAggregatingCache(Iterable<IAggregatableCacheProvider> caches, String table, String name)
+    {
+        this.cacheProviders = caches;
+        AbstractCache.registerMBean(this, table, name);
+    }
+
+    public int getCapacity()
+    {
+        int capacity = 0;
+        for (IAggregatableCacheProvider cacheProvider : cacheProviders)
+        {
+            capacity += cacheProvider.getCache().getCapacity();
+        }
+        return capacity;
+    }
+
+    public void setCapacity(int capacity)
+    {
+        long totalObjects = 0;
+        for (IAggregatableCacheProvider cacheProvider : cacheProviders)
+        {
+            totalObjects += cacheProvider.getObjectCount();
+        }
+        for (IAggregatableCacheProvider cacheProvider : cacheProviders)
+        {
+            double ratio = ((double)cacheProvider.getObjectCount()) / totalObjects;
+            cacheProvider.getCache().setCapacity((int)(capacity * ratio));
+        }
+    }
+
+    public int getSize()
+    {
+        int size = 0;
+        for (IAggregatableCacheProvider cacheProvider : cacheProviders)
+        {
+            size += cacheProvider.getCache().getSize();
+        }
+        return size;
+    }
+
+    public long getRequests()
+    {
+        long requests = 0;
+        for (IAggregatableCacheProvider cacheProvider : cacheProviders)
+        {
+            requests += cacheProvider.getCache().getRequests();
+        }
+        return requests;
+    }
+
+    public long getHits()
+    {
+        long hits = 0;
+        for (IAggregatableCacheProvider cacheProvider : cacheProviders)
+        {
+            hits += cacheProvider.getCache().getHits();
+        }
+        return hits;
+    }
+
+    public double getRecentHitRate()
+    {
+        int n = 0;
+        double rate = 0;
+        for (IAggregatableCacheProvider cacheProvider : cacheProviders)
+        {
+            rate += cacheProvider.getCache().getRecentHitRate();
+            n++;
+        }
+        return rate / n;
+    }
+}

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/JMXAggregatingCacheMBean.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/JMXAggregatingCacheMBean.java?rev=915575&r1=915574&r2=915575&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/JMXAggregatingCacheMBean.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/JMXAggregatingCacheMBean.java Tue Feb 23 23:07:01 2010
@@ -1,12 +1,33 @@
-package org.apache.cassandra.cache;
-
-public interface JMXAggregatingCacheMBean
-{
-    public int getCapacity();
-    public void setCapacity(int capacity);
-    public int getSize();
-
-    public long getRequests();
-    public long getHits();
-    public double getRecentHitRate();
-}
\ No newline at end of file
+package org.apache.cassandra.cache;
+/*
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ */
+
+
+public interface JMXAggregatingCacheMBean
+{
+    public int getCapacity();
+    public void setCapacity(int capacity);
+    public int getSize();
+
+    public long getRequests();
+    public long getHits();
+    public double getRecentHitRate();
+}

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/JMXInstrumentedCache.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/JMXInstrumentedCache.java?rev=915575&r1=915574&r2=915575&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/JMXInstrumentedCache.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/JMXInstrumentedCache.java Tue Feb 23 23:07:01 2010
@@ -1,10 +1,31 @@
-package org.apache.cassandra.cache;
-
-public class JMXInstrumentedCache<K, V> extends InstrumentedCache<K, V> implements JMXInstrumentedCacheMBean
-{
-    public JMXInstrumentedCache(String table, String name, int capacity)
-    {
-        super(capacity);
-        AbstractCache.registerMBean(this, table, name);
-    }
-}
\ No newline at end of file
+package org.apache.cassandra.cache;
+/*
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ */
+
+
+public class JMXInstrumentedCache<K, V> extends InstrumentedCache<K, V> implements JMXInstrumentedCacheMBean
+{
+    public JMXInstrumentedCache(String table, String name, int capacity)
+    {
+        super(capacity);
+        AbstractCache.registerMBean(this, table, name);
+    }
+}

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/JMXInstrumentedCacheMBean.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/JMXInstrumentedCacheMBean.java?rev=915575&r1=915574&r2=915575&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/JMXInstrumentedCacheMBean.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/JMXInstrumentedCacheMBean.java Tue Feb 23 23:07:01 2010
@@ -1,21 +1,42 @@
-package org.apache.cassandra.cache;
-
-public interface JMXInstrumentedCacheMBean
-{
-    public int getCapacity();
-    public void setCapacity(int capacity);
-    public int getSize();
-
-    /** total request count since cache creation */
-    public long getRequests();
-
-    /** total cache hit count since cache creation */
-    public long getHits();
-
-    /**
-     * hits / requests since the last time getHitRate was called.  serious telemetry apps should not use this,
-     * and should instead track the deltas from getHits / getRequests themselves, since those will not be
-     * affected by multiple users calling it.  Provided for convenience only.
-     */
-    public double getRecentHitRate();
-}
+package org.apache.cassandra.cache;
+/*
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ */
+
+
+public interface JMXInstrumentedCacheMBean
+{
+    public int getCapacity();
+    public void setCapacity(int capacity);
+    public int getSize();
+
+    /** total request count since cache creation */
+    public long getRequests();
+
+    /** total cache hit count since cache creation */
+    public long getHits();
+
+    /**
+     * hits / requests since the last time getHitRate was called.  serious telemetry apps should not use this,
+     * and should instead track the deltas from getHits / getRequests themselves, since those will not be
+     * affected by multiple users calling it.  Provided for convenience only.
+     */
+    public double getRecentHitRate();
+}

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java?rev=915575&r1=915574&r2=915575&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java Tue Feb 23 23:07:01 2010
@@ -1,4 +1,25 @@
 package org.apache.cassandra.concurrent;
+/*
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ */
+
 
 import java.util.concurrent.*;
 

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/commitlog/CommitLogExecutorService.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/commitlog/CommitLogExecutorService.java?rev=915575&r1=915574&r2=915575&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/commitlog/CommitLogExecutorService.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/commitlog/CommitLogExecutorService.java Tue Feb 23 23:07:01 2010
@@ -1,213 +1,234 @@
-package org.apache.cassandra.db.commitlog;
-
-import java.io.IOException;
-import java.lang.management.ManagementFactory;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.*;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.apache.cassandra.config.DatabaseDescriptor;
-import org.apache.cassandra.utils.WrappedRunnable;
-
-class CommitLogExecutorService extends AbstractExecutorService implements CommitLogExecutorServiceMBean
-{
-    private final BlockingQueue<CheaterFutureTask> queue;
-
-    private volatile long completedTaskCount = 0;
-
-    public CommitLogExecutorService()
-    {
-        this(DatabaseDescriptor.getCommitLogSync() == DatabaseDescriptor.CommitLogSync.batch
-             ? DatabaseDescriptor.getConcurrentWriters()
-             : 1024 * Runtime.getRuntime().availableProcessors());
-    }
-
-    public CommitLogExecutorService(int queueSize)
-    {
-        queue = new LinkedBlockingQueue<CheaterFutureTask>(queueSize);
-        Runnable runnable = new WrappedRunnable()
-        {
-            public void runMayThrow() throws Exception
-            {
-                if (DatabaseDescriptor.getCommitLogSync() == DatabaseDescriptor.CommitLogSync.batch)
-                {
-                    while (true)
-                    {
-                        processWithSyncBatch();
-                        completedTaskCount++;
-                    }
-                }
-                else
-                {
-                    while (true)
-                    {
-                        process();
-                        completedTaskCount++;
-                    }
-                }
-            }
-        };
-        new Thread(runnable, "COMMIT-LOG-WRITER").start();
-
-        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
-        try
-        {
-            mbs.registerMBean(this, new ObjectName("org.apache.cassandra.db:type=Commitlog"));
-        }
-        catch (Exception e)
-        {
-            throw new RuntimeException(e);
-        }
-    }
-
-
-    /**
-     * Get the current number of running tasks
-     */
-    public int getActiveCount()
-    {
-        return 1;
-    }
-
-    /**
-     * Get the number of completed tasks
-     */
-    public long getCompletedTasks()
-    {
-        return completedTaskCount;
-    }
-
-    /**
-     * Get the number of tasks waiting to be executed
-     */
-    public long getPendingTasks()
-    {
-        return queue.size();
-    }
-
-    private void process() throws InterruptedException
-    {
-        queue.take().run();
-    }
-
-    private final ArrayList<CheaterFutureTask> incompleteTasks = new ArrayList<CheaterFutureTask>();
-    private final ArrayList taskValues = new ArrayList(); // TODO not sure how to generify this
-    private void processWithSyncBatch() throws Exception
-    {
-        CheaterFutureTask firstTask = queue.take();
-        if (!(firstTask.getRawCallable() instanceof CommitLog.LogRecordAdder))
-        {
-            firstTask.run();
-            return;
-        }
-
-        // attempt to do a bunch of LogRecordAdder ops before syncing
-        // (this is a little clunky since there is no blocking peek method,
-        //  so we have to break it into firstTask / extra tasks)
-        incompleteTasks.clear();
-        taskValues.clear();
-        long end = System.nanoTime() + (long)(1000000 * DatabaseDescriptor.getCommitLogSyncBatchWindow());
-
-        // it doesn't seem worth bothering future-izing the exception
-        // since if a commitlog op throws, we're probably screwed anyway
-        incompleteTasks.add(firstTask);
-        taskValues.add(firstTask.getRawCallable().call());
-        while (!queue.isEmpty()
-               && queue.peek().getRawCallable() instanceof CommitLog.LogRecordAdder
-               && System.nanoTime() < end)
-        {
-            CheaterFutureTask task = queue.remove();
-            incompleteTasks.add(task);
-            taskValues.add(task.getRawCallable().call());
-        }
-
-        // now sync and set the tasks' values (which allows thread calling get() to proceed)
-        try
-        {
-            CommitLog.instance().sync();
-        }
-        catch (IOException e)
-        {
-            throw new RuntimeException(e);
-        }
-        for (int i = 0; i < incompleteTasks.size(); i++)
-        {
-            incompleteTasks.get(i).set(taskValues.get(i));
-        }
-    }
-
-
-    @Override
-    protected <T> RunnableFuture<T> newTaskFor(Runnable runnable, T value)
-    {
-        return newTaskFor(Executors.callable(runnable, value));
-    }
-
-    @Override
-    protected <T> RunnableFuture<T> newTaskFor(Callable<T> callable)
-    {
-        return new CheaterFutureTask(callable);
-    }
-
-    public void execute(Runnable command)
-    {
-        try
-        {
-            queue.put((CheaterFutureTask)command);
-        }
-        catch (InterruptedException e)
-        {
-            throw new RuntimeException(e);
-        }
-    }
-
-    public boolean isShutdown()
-    {
-        return false;
-    }
-
-    public boolean isTerminated()
-    {
-        return false;
-    }
-
-    // cassandra is crash-only so there's no need to implement the shutdown methods
-    public void shutdown()
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    public List<Runnable> shutdownNow()
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    private static class CheaterFutureTask<V> extends FutureTask<V>
-    {
-        private final Callable rawCallable;
-
-        public CheaterFutureTask(Callable<V> callable)
-        {
-            super(callable);
-            rawCallable = callable;
-        }
-
-        public Callable getRawCallable()
-        {
-            return rawCallable;
-        }
-
-        @Override
-        public void set(V v)
-        {
-            super.set(v);
-        }
-    }
-}
+package org.apache.cassandra.db.commitlog;
+/*
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ */
+
+
+import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.*;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.utils.WrappedRunnable;
+
+class CommitLogExecutorService extends AbstractExecutorService implements CommitLogExecutorServiceMBean
+{
+    private final BlockingQueue<CheaterFutureTask> queue;
+
+    private volatile long completedTaskCount = 0;
+
+    public CommitLogExecutorService()
+    {
+        this(DatabaseDescriptor.getCommitLogSync() == DatabaseDescriptor.CommitLogSync.batch
+             ? DatabaseDescriptor.getConcurrentWriters()
+             : 1024 * Runtime.getRuntime().availableProcessors());
+    }
+
+    public CommitLogExecutorService(int queueSize)
+    {
+        queue = new LinkedBlockingQueue<CheaterFutureTask>(queueSize);
+        Runnable runnable = new WrappedRunnable()
+        {
+            public void runMayThrow() throws Exception
+            {
+                if (DatabaseDescriptor.getCommitLogSync() == DatabaseDescriptor.CommitLogSync.batch)
+                {
+                    while (true)
+                    {
+                        processWithSyncBatch();
+                        completedTaskCount++;
+                    }
+                }
+                else
+                {
+                    while (true)
+                    {
+                        process();
+                        completedTaskCount++;
+                    }
+                }
+            }
+        };
+        new Thread(runnable, "COMMIT-LOG-WRITER").start();
+
+        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+        try
+        {
+            mbs.registerMBean(this, new ObjectName("org.apache.cassandra.db:type=Commitlog"));
+        }
+        catch (Exception e)
+        {
+            throw new RuntimeException(e);
+        }
+    }
+
+
+    /**
+     * Get the current number of running tasks
+     */
+    public int getActiveCount()
+    {
+        return 1;
+    }
+
+    /**
+     * Get the number of completed tasks
+     */
+    public long getCompletedTasks()
+    {
+        return completedTaskCount;
+    }
+
+    /**
+     * Get the number of tasks waiting to be executed
+     */
+    public long getPendingTasks()
+    {
+        return queue.size();
+    }
+
+    private void process() throws InterruptedException
+    {
+        queue.take().run();
+    }
+
+    private final ArrayList<CheaterFutureTask> incompleteTasks = new ArrayList<CheaterFutureTask>();
+    private final ArrayList taskValues = new ArrayList(); // TODO not sure how to generify this
+    private void processWithSyncBatch() throws Exception
+    {
+        CheaterFutureTask firstTask = queue.take();
+        if (!(firstTask.getRawCallable() instanceof CommitLog.LogRecordAdder))
+        {
+            firstTask.run();
+            return;
+        }
+
+        // attempt to do a bunch of LogRecordAdder ops before syncing
+        // (this is a little clunky since there is no blocking peek method,
+        //  so we have to break it into firstTask / extra tasks)
+        incompleteTasks.clear();
+        taskValues.clear();
+        long end = System.nanoTime() + (long)(1000000 * DatabaseDescriptor.getCommitLogSyncBatchWindow());
+
+        // it doesn't seem worth bothering future-izing the exception
+        // since if a commitlog op throws, we're probably screwed anyway
+        incompleteTasks.add(firstTask);
+        taskValues.add(firstTask.getRawCallable().call());
+        while (!queue.isEmpty()
+               && queue.peek().getRawCallable() instanceof CommitLog.LogRecordAdder
+               && System.nanoTime() < end)
+        {
+            CheaterFutureTask task = queue.remove();
+            incompleteTasks.add(task);
+            taskValues.add(task.getRawCallable().call());
+        }
+
+        // now sync and set the tasks' values (which allows thread calling get() to proceed)
+        try
+        {
+            CommitLog.instance().sync();
+        }
+        catch (IOException e)
+        {
+            throw new RuntimeException(e);
+        }
+        for (int i = 0; i < incompleteTasks.size(); i++)
+        {
+            incompleteTasks.get(i).set(taskValues.get(i));
+        }
+    }
+
+
+    @Override
+    protected <T> RunnableFuture<T> newTaskFor(Runnable runnable, T value)
+    {
+        return newTaskFor(Executors.callable(runnable, value));
+    }
+
+    @Override
+    protected <T> RunnableFuture<T> newTaskFor(Callable<T> callable)
+    {
+        return new CheaterFutureTask(callable);
+    }
+
+    public void execute(Runnable command)
+    {
+        try
+        {
+            queue.put((CheaterFutureTask)command);
+        }
+        catch (InterruptedException e)
+        {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public boolean isShutdown()
+    {
+        return false;
+    }
+
+    public boolean isTerminated()
+    {
+        return false;
+    }
+
+    // cassandra is crash-only so there's no need to implement the shutdown methods
+    public void shutdown()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public List<Runnable> shutdownNow()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    private static class CheaterFutureTask<V> extends FutureTask<V>
+    {
+        private final Callable rawCallable;
+
+        public CheaterFutureTask(Callable<V> callable)
+        {
+            super(callable);
+            rawCallable = callable;
+        }
+
+        public Callable getRawCallable()
+        {
+            return rawCallable;
+        }
+
+        @Override
+        public void set(V v)
+        {
+            super.set(v);
+        }
+    }
+}

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java?rev=915575&r1=915574&r2=915575&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java Tue Feb 23 23:07:01 2010
@@ -1,193 +1,214 @@
-package org.apache.cassandra.db.commitlog;
-
-import java.io.File;
-import java.io.IOError;
-import java.io.IOException;
-import java.util.zip.CRC32;
-import java.util.zip.Checksum;
-
-import org.apache.log4j.Logger;
-
-import org.apache.cassandra.config.DatabaseDescriptor;
-import org.apache.cassandra.db.ColumnFamily;
-import org.apache.cassandra.db.RowMutation;
-import org.apache.cassandra.db.Table;
-import org.apache.cassandra.io.util.BufferedRandomAccessFile;
-import org.apache.cassandra.io.util.DataOutputBuffer;
-
-public class CommitLogSegment
-{
-    private static final Logger logger = Logger.getLogger(CommitLogSegment.class);
-
-    private final BufferedRandomAccessFile logWriter;
-    private final CommitLogHeader header;
-
-    public CommitLogSegment(int cfCount)
-    {
-        this.header = new CommitLogHeader(cfCount);
-        String logFile = DatabaseDescriptor.getLogFileLocation() + File.separator + "CommitLog-" + System.currentTimeMillis() + ".log";
-        logger.info("Creating new commitlog segment " + logFile);
-
-        try
-        {
-            logWriter = createWriter(logFile);
-            writeCommitLogHeader(header.toByteArray());
-        }
-        catch (IOException e)
-        {
-            throw new IOError(e);
-        }
-    }
-
-    public void writeHeader() throws IOException
-    {
-        seekAndWriteCommitLogHeader(header.toByteArray());
-    }
-
-    /** writes header at the beginning of the file, then seeks back to current position */
-    void seekAndWriteCommitLogHeader(byte[] bytes) throws IOException
-    {
-        long currentPos = logWriter.getFilePointer();
-        logWriter.seek(0);
-
-        writeCommitLogHeader(bytes);
-
-        logWriter.seek(currentPos);
-    }
-
-    private void writeCommitLogHeader(byte[] bytes) throws IOException
-    {
-        logWriter.writeLong(bytes.length);
-        logWriter.write(bytes);
-        logWriter.sync();
-    }
-
-    private static BufferedRandomAccessFile createWriter(String file) throws IOException
-    {
-        return new BufferedRandomAccessFile(file, "rw", 128 * 1024);
-    }
-
-    public CommitLogSegment.CommitLogContext write(RowMutation rowMutation, Object serializedRow) throws IOException
-    {
-        long currentPosition = -1L;
-        try
-        {
-            currentPosition = logWriter.getFilePointer();
-            CommitLogSegment.CommitLogContext cLogCtx = new CommitLogSegment.CommitLogContext(currentPosition);
-            Table table = Table.open(rowMutation.getTable());
-
-            // update header
-            for (ColumnFamily columnFamily : rowMutation.getColumnFamilies())
-            {
-                int id = table.getColumnFamilyId(columnFamily.name());
-                if (!header.isDirty(id))
-                {
-                    header.turnOn(id, logWriter.getFilePointer());
-                    seekAndWriteCommitLogHeader(header.toByteArray());
-                }
-            }
-
-            // write mutation, w/ checksum
-            Checksum checkum = new CRC32();
-            if (serializedRow instanceof DataOutputBuffer)
-            {
-                DataOutputBuffer buffer = (DataOutputBuffer) serializedRow;
-                logWriter.writeLong(buffer.getLength());
-                logWriter.write(buffer.getData(), 0, buffer.getLength());
-                checkum.update(buffer.getData(), 0, buffer.getLength());
-            }
-            else
-            {
-                assert serializedRow instanceof byte[];
-                byte[] bytes = (byte[]) serializedRow;
-                logWriter.writeLong(bytes.length);
-                logWriter.write(bytes);
-                checkum.update(bytes, 0, bytes.length);
-            }
-            logWriter.writeLong(checkum.getValue());
-
-            return cLogCtx;
-        }
-        catch (IOException e)
-        {
-            if (currentPosition != -1)
-                logWriter.seek(currentPosition);
-            throw e;
-        }
-    }
-
-    public void sync() throws IOException
-    {
-        logWriter.sync();
-    }
-
-    public CommitLogContext getContext()
-    {
-        return new CommitLogContext(logWriter.getFilePointer());
-    }
-
-    public CommitLogHeader getHeader()
-    {
-        return header;
-    }
-
-    public String getPath()
-    {
-        return logWriter.getPath();
-    }
-
-    public long length()
-    {
-        try
-        {
-            return logWriter.length();
-        }
-        catch (IOException e)
-        {
-            throw new IOError(e);
-        }
-    }
-
-    public void close()
-    {
-        try
-        {
-            logWriter.close();
-        }
-        catch (IOException e)
-        {
-            throw new IOError(e);
-        }
-    }
-
-    @Override
-    public String toString()
-    {
-        return "CommitLogSegment(" + logWriter.getPath() + ')';
-    }
-
-    public class CommitLogContext
-    {
-        public final long position;
-
-        public CommitLogContext(long position)
-        {
-            assert position >= 0;
-            this.position = position;
-        }
-
-        public CommitLogSegment getSegment()
-        {
-            return CommitLogSegment.this;
-        }
-
-        @Override
-        public String toString()
-        {
-            return "CommitLogContext(" +
-                   "file='" + logWriter.getPath() + '\'' +
-                   ", position=" + position +
-                   ')';
-        }
-    }
-}
+package org.apache.cassandra.db.commitlog;
+/*
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ */
+
+
+import java.io.File;
+import java.io.IOError;
+import java.io.IOException;
+import java.util.zip.CRC32;
+import java.util.zip.Checksum;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.db.ColumnFamily;
+import org.apache.cassandra.db.RowMutation;
+import org.apache.cassandra.db.Table;
+import org.apache.cassandra.io.util.BufferedRandomAccessFile;
+import org.apache.cassandra.io.util.DataOutputBuffer;
+
+public class CommitLogSegment
+{
+    private static final Logger logger = Logger.getLogger(CommitLogSegment.class);
+
+    private final BufferedRandomAccessFile logWriter;
+    private final CommitLogHeader header;
+
+    public CommitLogSegment(int cfCount)
+    {
+        this.header = new CommitLogHeader(cfCount);
+        String logFile = DatabaseDescriptor.getLogFileLocation() + File.separator + "CommitLog-" + System.currentTimeMillis() + ".log";
+        logger.info("Creating new commitlog segment " + logFile);
+
+        try
+        {
+            logWriter = createWriter(logFile);
+            writeCommitLogHeader(header.toByteArray());
+        }
+        catch (IOException e)
+        {
+            throw new IOError(e);
+        }
+    }
+
+    public void writeHeader() throws IOException
+    {
+        seekAndWriteCommitLogHeader(header.toByteArray());
+    }
+
+    /** writes header at the beginning of the file, then seeks back to current position */
+    void seekAndWriteCommitLogHeader(byte[] bytes) throws IOException
+    {
+        long currentPos = logWriter.getFilePointer();
+        logWriter.seek(0);
+
+        writeCommitLogHeader(bytes);
+
+        logWriter.seek(currentPos);
+    }
+
+    private void writeCommitLogHeader(byte[] bytes) throws IOException
+    {
+        logWriter.writeLong(bytes.length);
+        logWriter.write(bytes);
+        logWriter.sync();
+    }
+
+    private static BufferedRandomAccessFile createWriter(String file) throws IOException
+    {
+        return new BufferedRandomAccessFile(file, "rw", 128 * 1024);
+    }
+
+    public CommitLogSegment.CommitLogContext write(RowMutation rowMutation, Object serializedRow) throws IOException
+    {
+        long currentPosition = -1L;
+        try
+        {
+            currentPosition = logWriter.getFilePointer();
+            CommitLogSegment.CommitLogContext cLogCtx = new CommitLogSegment.CommitLogContext(currentPosition);
+            Table table = Table.open(rowMutation.getTable());
+
+            // update header
+            for (ColumnFamily columnFamily : rowMutation.getColumnFamilies())
+            {
+                int id = table.getColumnFamilyId(columnFamily.name());
+                if (!header.isDirty(id))
+                {
+                    header.turnOn(id, logWriter.getFilePointer());
+                    seekAndWriteCommitLogHeader(header.toByteArray());
+                }
+            }
+
+            // write mutation, w/ checksum
+            Checksum checkum = new CRC32();
+            if (serializedRow instanceof DataOutputBuffer)
+            {
+                DataOutputBuffer buffer = (DataOutputBuffer) serializedRow;
+                logWriter.writeLong(buffer.getLength());
+                logWriter.write(buffer.getData(), 0, buffer.getLength());
+                checkum.update(buffer.getData(), 0, buffer.getLength());
+            }
+            else
+            {
+                assert serializedRow instanceof byte[];
+                byte[] bytes = (byte[]) serializedRow;
+                logWriter.writeLong(bytes.length);
+                logWriter.write(bytes);
+                checkum.update(bytes, 0, bytes.length);
+            }
+            logWriter.writeLong(checkum.getValue());
+
+            return cLogCtx;
+        }
+        catch (IOException e)
+        {
+            if (currentPosition != -1)
+                logWriter.seek(currentPosition);
+            throw e;
+        }
+    }
+
+    public void sync() throws IOException
+    {
+        logWriter.sync();
+    }
+
+    public CommitLogContext getContext()
+    {
+        return new CommitLogContext(logWriter.getFilePointer());
+    }
+
+    public CommitLogHeader getHeader()
+    {
+        return header;
+    }
+
+    public String getPath()
+    {
+        return logWriter.getPath();
+    }
+
+    public long length()
+    {
+        try
+        {
+            return logWriter.length();
+        }
+        catch (IOException e)
+        {
+            throw new IOError(e);
+        }
+    }
+
+    public void close()
+    {
+        try
+        {
+            logWriter.close();
+        }
+        catch (IOException e)
+        {
+            throw new IOError(e);
+        }
+    }
+
+    @Override
+    public String toString()
+    {
+        return "CommitLogSegment(" + logWriter.getPath() + ')';
+    }
+
+    public class CommitLogContext
+    {
+        public final long position;
+
+        public CommitLogContext(long position)
+        {
+            assert position >= 0;
+            this.position = position;
+        }
+
+        public CommitLogSegment getSegment()
+        {
+            return CommitLogSegment.this;
+        }
+
+        @Override
+        public String toString()
+        {
+            return "CommitLogContext(" +
+                   "file='" + logWriter.getPath() + '\'' +
+                   ", position=" + position +
+                   ')';
+        }
+    }
+}

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/AbstractBounds.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/AbstractBounds.java?rev=915575&r1=915574&r2=915575&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/AbstractBounds.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/AbstractBounds.java Tue Feb 23 23:07:01 2010
@@ -1,71 +1,92 @@
-package org.apache.cassandra.dht;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.cassandra.io.ICompactSerializer2;
-
-public abstract class AbstractBounds implements Serializable
-{
-    private static AbstractBoundsSerializer serializer = new AbstractBoundsSerializer();
-
-    public static ICompactSerializer2<AbstractBounds> serializer()
-    {
-        return serializer;
-    }
-
-    private enum Type
-    {
-        RANGE,
-        BOUNDS
-    }
-
-    public final Token left;
-    public final Token right;
-
-    protected transient final IPartitioner partitioner;
-
-    public AbstractBounds(Token left, Token right, IPartitioner partitioner)
-    {
-        this.left = left;
-        this.right = right;
-        this.partitioner = partitioner;
-    }
-
-    @Override
-    public int hashCode()
-    {
-        return toString().hashCode();
-    }
-
-    @Override
-    public abstract boolean equals(Object obj);
-
-    public abstract boolean contains(Token start);
-
-    public abstract Set<AbstractBounds> restrictTo(Range range);
-
-    public abstract List<AbstractBounds> unwrap();
-
-    private static class AbstractBoundsSerializer implements ICompactSerializer2<AbstractBounds>
-    {
-        public void serialize(AbstractBounds range, DataOutput out) throws IOException
-        {
-            out.writeInt(range instanceof Range ? Type.RANGE.ordinal() : Type.BOUNDS.ordinal());
-            Token.serializer().serialize(range.left, out);
-            Token.serializer().serialize(range.right, out);
-        }
-
-        public AbstractBounds deserialize(DataInput in) throws IOException
-        {
-            if (in.readInt() == Type.RANGE.ordinal())
-                return new Range(Token.serializer().deserialize(in), Token.serializer().deserialize(in));
-            return new Bounds(Token.serializer().deserialize(in), Token.serializer().deserialize(in));
-        }
-    }
-}
-
+package org.apache.cassandra.dht;
+/*
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ */
+
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.cassandra.io.ICompactSerializer2;
+
+public abstract class AbstractBounds implements Serializable
+{
+    private static AbstractBoundsSerializer serializer = new AbstractBoundsSerializer();
+
+    public static ICompactSerializer2<AbstractBounds> serializer()
+    {
+        return serializer;
+    }
+
+    private enum Type
+    {
+        RANGE,
+        BOUNDS
+    }
+
+    public final Token left;
+    public final Token right;
+
+    protected transient final IPartitioner partitioner;
+
+    public AbstractBounds(Token left, Token right, IPartitioner partitioner)
+    {
+        this.left = left;
+        this.right = right;
+        this.partitioner = partitioner;
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return toString().hashCode();
+    }
+
+    @Override
+    public abstract boolean equals(Object obj);
+
+    public abstract boolean contains(Token start);
+
+    public abstract Set<AbstractBounds> restrictTo(Range range);
+
+    public abstract List<AbstractBounds> unwrap();
+
+    private static class AbstractBoundsSerializer implements ICompactSerializer2<AbstractBounds>
+    {
+        public void serialize(AbstractBounds range, DataOutput out) throws IOException
+        {
+            out.writeInt(range instanceof Range ? Type.RANGE.ordinal() : Type.BOUNDS.ordinal());
+            Token.serializer().serialize(range.left, out);
+            Token.serializer().serialize(range.right, out);
+        }
+
+        public AbstractBounds deserialize(DataInput in) throws IOException
+        {
+            if (in.readInt() == Type.RANGE.ordinal())
+                return new Range(Token.serializer().deserialize(in), Token.serializer().deserialize(in));
+            return new Bounds(Token.serializer().deserialize(in), Token.serializer().deserialize(in));
+        }
+    }
+}
+



Mime
View raw message