Author: nextgens
Date: 2008-02-15 07:52:50 +0000 (Fri, 15 Feb 2008)
New Revision: 17923

Modified:
   trunk/freenet/src/freenet/support/PooledExecutor.java
   trunk/freenet/src/freenet/support/io/NativeThread.java
Log:
Fix the build and introduce compatibility with older freenet-ext builds

Modified: trunk/freenet/src/freenet/support/PooledExecutor.java
===================================================================
--- trunk/freenet/src/freenet/support/PooledExecutor.java       2008-02-15 
07:44:34 UTC (rev 17922)
+++ trunk/freenet/src/freenet/support/PooledExecutor.java       2008-02-15 
07:52:50 UTC (rev 17923)
@@ -14,12 +14,20 @@
 public class PooledExecutor implements Executor {

        private final ArrayList[] runningThreads /* <MyThread> */ = new 
ArrayList[NativeThread.JAVA_PRIO_RANGE];
-       private final ArrayList[] waitingThreads /* <MyThread> */ = new 
ArrayList[NativeThread.JAVA_PRIO_RANGE];
-       long[] threadCounter;
+       private final ArrayList[] waitingThreads /* <MyThread> */ = new 
ArrayList[runningThreads.length];
+       long[] threadCounter = new long[runningThreads.length];
        private long jobCount;
        private long jobMisses;
        private static boolean logMINOR;

+       public PooledExecutor() {
+               for(int i=0; i<runningThreads.length; i++) {
+                       runningThreads[i] = new ArrayList();
+                       waitingThreads[i] = new ArrayList();
+                       threadCounter[i] = 0;
+               }
+       }
+       
        /** Maximum time a thread will wait for a job */
        static final int TIMEOUT = 5*60*1000;


Modified: trunk/freenet/src/freenet/support/io/NativeThread.java
===================================================================
--- trunk/freenet/src/freenet/support/io/NativeThread.java      2008-02-15 
07:44:34 UTC (rev 17922)
+++ trunk/freenet/src/freenet/support/io/NativeThread.java      2008-02-15 
07:52:50 UTC (rev 17923)
@@ -4,6 +4,7 @@

 package freenet.support.io;

+import freenet.node.NodeStarter;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.InputStream;
@@ -23,7 +24,7 @@
        public static final boolean HAS_ENOUGH_NICE_LEVELS;

        static {
-               _loadNative = 
"Linux".equalsIgnoreCase(System.getProperty("os.name"));
+               _loadNative = 
"Linux".equalsIgnoreCase(System.getProperty("os.name")) && 
NodeStarter.extBuildNumber > 18;
                if(_loadNative) {
                        //System.loadLibrary("NativeThread");
                        loadNative();


Reply via email to