[jboss-cvs] JBoss Messaging SVN: r7398 - trunk/src/main/org/jboss/messaging/core/asyncio/impl.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jun 18 21:56:22 EDT 2009


Author: clebert.suconic at jboss.com
Date: 2009-06-18 21:56:22 -0400 (Thu, 18 Jun 2009)
New Revision: 7398

Modified:
   trunk/src/main/org/jboss/messaging/core/asyncio/impl/TimedBuffer.java
Log:
JBMESSAGING-1662 - disabling native timers

Modified: trunk/src/main/org/jboss/messaging/core/asyncio/impl/TimedBuffer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/asyncio/impl/TimedBuffer.java	2009-06-18 22:34:33 UTC (rev 7397)
+++ trunk/src/main/org/jboss/messaging/core/asyncio/impl/TimedBuffer.java	2009-06-19 01:56:22 UTC (rev 7398)
@@ -52,9 +52,6 @@
    // Attributes ----------------------------------------------------
 
    private TimedBufferObserver bufferObserver;
-   
-   // Some kernels don't have good resolutions on timers.. I've set this to disabled.. we may decide later
-   private static final boolean USE_NATIVE_TIMERS = false;
 
    // This is used to pause and resume the timer
    // This is a reusable Latch, that uses java.util.concurrent base classes
@@ -114,14 +111,6 @@
       }
       // Setting the interval for nano-sleeps
 
-      // We are keeping this disabled for now until we figure out what to do.
-      // I've found a few problems with nano-sleep depending on the version of the kernel:
-      // http://fixunix.com/unix/552033-problem-nanosleep.html
-      if (USE_NATIVE_TIMERS)
-      {
-         AsynchronousFileImpl.setNanoSleepInterval((int)timeout);
-      }
-
       buffer = ChannelBuffers.buffer(bufferSize);
       buffer.clear();
       bufferLimit = 0;
@@ -382,11 +371,6 @@
 
       public void run()
       {
-         if (USE_NATIVE_TIMERS)
-         {
-            Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
-         }
-
          while (!closed)
          {
             try
@@ -409,20 +393,11 @@
        */
       private void sleep()
       {
-         if (USE_NATIVE_TIMERS)
+         long time = System.nanoTime() + timeout;
+         while (time > System.nanoTime())
          {
-            // The time is passed on the constructor.
-            // I'm avoiding the long on the calling stack, to avoid performance hits here
-            AsynchronousFileImpl.nanoSleep();
+            Thread.yield();
          }
-         else
-         {
-            long time = System.nanoTime() + timeout;
-            while (time > System.nanoTime())
-            {
-               Thread.yield();
-            }
-         }
       }
 
       public void close()




More information about the jboss-cvs-commits mailing list