directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r421262 - in /directory/branches/apacheds/optimization: server-installers/src/main/installers/ server-jndi/src/main/java/org/apache/directory/server/configuration/ server-main/ server-main/src/main/java/org/apache/directory/server/
Date Wed, 12 Jul 2006 13:01:17 GMT
Author: akarasulu
Date: Wed Jul 12 06:01:17 2006
New Revision: 421262

URL: http://svn.apache.org/viewvc?rev=421262&view=rev
Log:
added synchPeriodMillis configuration property to control the synch period

Modified:
    directory/branches/apacheds/optimization/server-installers/src/main/installers/server.xml
    directory/branches/apacheds/optimization/server-jndi/src/main/java/org/apache/directory/server/configuration/MutableServerStartupConfiguration.java
    directory/branches/apacheds/optimization/server-jndi/src/main/java/org/apache/directory/server/configuration/ServerStartupConfiguration.java
    directory/branches/apacheds/optimization/server-main/server.xml
    directory/branches/apacheds/optimization/server-main/src/main/java/org/apache/directory/server/Service.java

Modified: directory/branches/apacheds/optimization/server-installers/src/main/installers/server.xml
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/server-installers/src/main/installers/server.xml?rev=421262&r1=421261&r2=421262&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/server-installers/src/main/installers/server.xml
(original)
+++ directory/branches/apacheds/optimization/server-installers/src/main/installers/server.xml
Wed Jul 12 06:01:17 2006
@@ -52,6 +52,13 @@
       </list>
     </property>-->
 
+    <!-- the number of milliseconds before issuing a synch (flush to disk)  -->
+    <!-- which writes out dirty pages back to disk.  To turn off synchs all -->
+    <!-- together simply set this value to <= 0.  Make sure you turn on     -->
+    <!-- synchOnWrite for all partitions if you do choose to do this or else-->
+    <!-- writes may never persist to disk.                                  -->
+    <property name="synchPeriodMillis"><value>15000</value></property>
+
     <!-- limits searches by non-admin users to a max time of 15000          -->
     <!-- milliseconds and has a default value of 10000                      -->
     <property name="maxTimeLimit"><value>15000</value></property>

Modified: directory/branches/apacheds/optimization/server-jndi/src/main/java/org/apache/directory/server/configuration/MutableServerStartupConfiguration.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/server-jndi/src/main/java/org/apache/directory/server/configuration/MutableServerStartupConfiguration.java?rev=421262&r1=421261&r2=421262&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/server-jndi/src/main/java/org/apache/directory/server/configuration/MutableServerStartupConfiguration.java
(original)
+++ directory/branches/apacheds/optimization/server-jndi/src/main/java/org/apache/directory/server/configuration/MutableServerStartupConfiguration.java
Wed Jul 12 06:01:17 2006
@@ -41,6 +41,12 @@
     }
 
 
+    public void setSynchPeriodMillis( long synchPeriodMillis )
+    {
+        super.setSynchPeriodMillis( synchPeriodMillis );
+    }
+    
+    
     public void setAccessControlEnabled( boolean accessControlEnabled )
     {
         super.setAccessControlEnabled( accessControlEnabled );

Modified: directory/branches/apacheds/optimization/server-jndi/src/main/java/org/apache/directory/server/configuration/ServerStartupConfiguration.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/server-jndi/src/main/java/org/apache/directory/server/configuration/ServerStartupConfiguration.java?rev=421262&r1=421261&r2=421262&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/server-jndi/src/main/java/org/apache/directory/server/configuration/ServerStartupConfiguration.java
(original)
+++ directory/branches/apacheds/optimization/server-jndi/src/main/java/org/apache/directory/server/configuration/ServerStartupConfiguration.java
Wed Jul 12 06:01:17 2006
@@ -42,7 +42,10 @@
 {
     private static final long serialVersionUID = -7138616822614155454L;
 
+    private static final long DEFAULT_SYNC_PERIOD_MILLIS = 20000;
+
     private boolean enableNetworking = true;
+    private long synchPeriodMillis = DEFAULT_SYNC_PERIOD_MILLIS;
     private int ldapPort = 389;
     private int ldapsPort = 636;
     private File ldapsCertificateFile = new File( this.getWorkingDirectory().getPath() +
File.separator
@@ -293,5 +296,17 @@
 
         this.ldifFilters.clear();
         this.ldifFilters.addAll( filters );
+    }
+
+
+    protected void setSynchPeriodMillis( long synchPeriodMillis )
+    {
+        this.synchPeriodMillis = synchPeriodMillis;
+    }
+
+
+    public long getSynchPeriodMillis()
+    {
+        return synchPeriodMillis;
     }
 }

Modified: directory/branches/apacheds/optimization/server-main/server.xml
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/server-main/server.xml?rev=421262&r1=421261&r2=421262&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/server-main/server.xml (original)
+++ directory/branches/apacheds/optimization/server-main/server.xml Wed Jul 12 06:01:17 2006
@@ -52,6 +52,13 @@
       </list>
     </property>-->
 
+    <!-- the number of milliseconds before issuing a synch (flush to disk)  -->
+    <!-- which writes out dirty pages back to disk.  To turn off synchs all -->
+    <!-- together simply set this value to <= 0.  Make sure you turn on     -->
+    <!-- synchOnWrite for all partitions if you do choose to do this or else-->
+    <!-- writes may never persist to disk.                                  -->
+    <property name="synchPeriodMillis"><value>15000</value></property>
+
     <!-- limits searches by non-admin users to a max time of 15000          -->
     <!-- milliseconds and has a default value of 10000                      -->
     <property name="maxTimeLimit"><value>15000</value></property>

Modified: directory/branches/apacheds/optimization/server-main/src/main/java/org/apache/directory/server/Service.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/server-main/src/main/java/org/apache/directory/server/Service.java?rev=421262&r1=421261&r2=421262&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/server-main/src/main/java/org/apache/directory/server/Service.java
(original)
+++ directory/branches/apacheds/optimization/server-main/src/main/java/org/apache/directory/server/Service.java
Wed Jul 12 06:01:17 2006
@@ -49,6 +49,7 @@
     private Properties env;
     private Thread workerThread = null;
     private SynchWorker worker = new SynchWorker();
+    private MutableServerStartupConfiguration cfg;
     private boolean startNoWait = false;
 
 
@@ -56,7 +57,6 @@
     {
         printBanner();
         long startTime = System.currentTimeMillis();
-        MutableServerStartupConfiguration cfg;
 
         if ( install != null )
         {
@@ -92,8 +92,11 @@
         env.putAll( cfg.toJndiEnvironment() );
         new InitialDirContext( env );
 
-        workerThread = new Thread( worker, "SynchWorkerThread" );
-
+        if ( cfg.getSynchPeriodMillis() > 0 )
+        {
+            workerThread = new Thread( worker, "SynchWorkerThread" );
+        }
+        
         if ( log.isInfoEnabled() )
         {
             log.info( "server: started in {} milliseconds", ( System.currentTimeMillis()
- startTime ) + "" );
@@ -110,23 +113,29 @@
 
     public void start()
     {
-        workerThread.start();
+        if ( workerThread != null )
+        {
+            workerThread.start();
+        }
         return;
     }
 
 
     public void stop( String[] args ) throws Exception
     {
-        worker.stop = true;
-        synchronized ( worker.lock )
+        if ( workerThread != null )
         {
-            worker.lock.notify();
-        }
-
-        while ( startNoWait && workerThread.isAlive() )
-        {
-            log.info( "Waiting for SynchWorkerThread to die." );
-            workerThread.join( 500 );
+            worker.stop = true;
+            synchronized ( worker.lock )
+            {
+                worker.lock.notify();
+            }
+    
+            while ( startNoWait && workerThread.isAlive() )
+            {
+                log.info( "Waiting for SynchWorkerThread to die." );
+                workerThread.join( 500 );
+            }
         }
 
         env.putAll( new ShutdownConfiguration().toJndiEnvironment() );
@@ -138,6 +147,7 @@
     {
     }
 
+    
     class SynchWorker implements Runnable
     {
         Object lock = new Object();
@@ -152,7 +162,7 @@
                 {
                     try
                     {
-                        lock.wait( 20000 );
+                        lock.wait( cfg.getSynchPeriodMillis() );
                     }
                     catch ( InterruptedException e )
                     {



Mime
View raw message