activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1233184 - in /activemq/activemq-apollo/trunk/apollo-leveldb/src: main/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/RecordLog.scala test/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/LevelDBStoreTest.scala
Date Thu, 19 Jan 2012 05:32:25 GMT
Author: chirino
Date: Thu Jan 19 05:32:25 2012
New Revision: 1233184

URL: http://svn.apache.org/viewvc?rev=1233184&view=rev
Log:
Remove un-needed assertion code.

Modified:
    activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/RecordLog.scala
    activemq/activemq-apollo/trunk/apollo-leveldb/src/test/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/LevelDBStoreTest.scala

Modified: activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/RecordLog.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/RecordLog.scala?rev=1233184&r1=1233183&r2=1233184&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/RecordLog.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/RecordLog.scala
Thu Jan 19 05:32:25 2012
@@ -87,19 +87,6 @@ case class RecordLog(directory: File, lo
     (checksum.getValue & 0xFFFFFFFF).toInt
   }
 
-  var write_thread:Thread = _
-  def is_write_thread_executing = if(write_thread==null) {
-    write_thread = Thread.currentThread()
-    true
-  } else {
-    write_thread eq Thread.currentThread() 
-  }
-
-  def assert_on_write_thread = if ( !is_write_thread_executing) {
-    val current: Thread = Thread.currentThread()
-    throw new Exception("current: "+current.getName+", expected: "+write_thread.getName)
-  }
-  
   class LogAppender(file:File, position:Long) extends LogReader(file, position) {
 
     override def open = new RandomAccessFile(file, "rw")
@@ -113,7 +100,6 @@ case class RecordLog(directory: File, lo
     val flushed_offset = new AtomicLong(0)
 
     def append_position = {
-      assert_on_write_thread
       position+append_offset
     }
 
@@ -127,10 +113,9 @@ case class RecordLog(directory: File, lo
     val write_buffer = new DataByteArrayOutputStream((BUFFER_SIZE)+BUFFER_SIZE)
 
     def force = {
-      // only need to update the file metadata if the file size changes..
-      assert_on_write_thread
       flush
       if(sync) {
+        // only need to update the file metadata if the file size changes..
         channel.force(append_offset > logSize)
       }
     }
@@ -139,7 +124,6 @@ case class RecordLog(directory: File, lo
      * returns the offset position of the data record.
      */
     def append(id:Byte, data: Buffer): Long = this.synchronized {
-      assert_on_write_thread
       val record_position = append_position
       val data_length = data.length
       val total_length = LOG_HEADER_SIZE + data_length
@@ -184,7 +168,6 @@ case class RecordLog(directory: File, lo
     }
 
     def flush = this.synchronized {
-      assert_on_write_thread
       if( write_buffer.position() > 0 ) {
         val buffer = write_buffer.toBuffer.toByteBuffer
         val pos = append_offset-buffer.remaining
@@ -197,18 +180,6 @@ case class RecordLog(directory: File, lo
       }
     }
 
-//    override def read(record_position: Long, length: Int) = this.synchronized {
-//      super.read(record_position, length)
-//    }
-//
-//    override def read(record_position: Long) = this.synchronized {
-//      super.read(record_position)
-//    }
-//
-//    override def check(record_position: Long) = this.synchronized {
-//      super.check(record_position)
-//    }
-
     override def check_read_flush(end_offset:Int) = {
       if( flushed_offset.get() < end_offset )  {
         this.synchronized {
@@ -360,7 +331,6 @@ case class RecordLog(directory: File, lo
   }
 
   def create_appender(position: Long): Any = {
-    assert_on_write_thread
     log_mutex.synchronized {
       if(current_appender!=null) {
         log_infos += position -> new LogInfo(current_appender.file, current_appender.position,
current_appender.append_offset)
@@ -416,7 +386,6 @@ case class RecordLog(directory: File, lo
     } finally {
       current_appender.flush
       log_mutex.synchronized {
-        assert_on_write_thread
         if ( current_appender.append_offset >= logSize ) {
           current_appender.release()
           on_log_rotate()

Modified: activemq/activemq-apollo/trunk/apollo-leveldb/src/test/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/LevelDBStoreTest.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-leveldb/src/test/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/LevelDBStoreTest.scala?rev=1233184&r1=1233183&r2=1233184&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-leveldb/src/test/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/LevelDBStoreTest.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-leveldb/src/test/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/LevelDBStoreTest.scala
Thu Jan 19 05:32:25 2012
@@ -18,7 +18,6 @@ package org.apache.activemq.apollo.broke
 
 import dto.LevelDBStoreDTO
 import org.apache.activemq.apollo.broker.store.{Store, StoreFunSuiteSupport}
-import org.apache.activemq.apollo.util.FileSupport._
 
 /**
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>



Mime
View raw message