directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r719009 - in /directory: apacheds/branches/apacheds-mina2/protocol-ldap/src/main/java/org/apache/directory/server/ldap/ apacheds/branches/apacheds-mina2/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/ installers/b...
Date Wed, 19 Nov 2008 16:47:36 GMT
Author: elecharny
Date: Wed Nov 19 08:47:35 2008
New Revision: 719009

URL: http://svn.apache.org/viewvc?rev=719009&view=rev
Log:
o Added the ipBackLog, tcpBacklog and udpBacklog parameters 
o Used the ipAddress and backlog parameters to configure the server network layer (it will
fix DIRSERVER-1280 and let users install multi-homed LDAP servers)
o Renamed startLDAP0 to startNetwork, for clarity sake.

Modified:
    directory/apacheds/branches/apacheds-mina2/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapService.java
    directory/apacheds/branches/apacheds-mina2/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/AbstractProtocolService.java
    directory/installers/branches/installers-mina2/apacheds-noarch/src/main/java/org/apache/directory/server/Service.java

Modified: directory/apacheds/branches/apacheds-mina2/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mina2/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapService.java?rev=719009&r1=719008&r2=719009&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mina2/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapService.java
(original)
+++ directory/apacheds/branches/apacheds-mina2/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapService.java
Wed Nov 19 08:47:35 2008
@@ -71,6 +71,7 @@
 import org.apache.directory.shared.ldap.message.control.PersistentSearchControl;
 import org.apache.directory.shared.ldap.message.control.SubentriesControl;
 import org.apache.directory.shared.ldap.message.extended.NoticeOfDisconnect;
+import org.apache.directory.shared.ldap.util.StringTools;
 import org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder;
 import org.apache.mina.core.filterchain.IoFilterChainBuilder;
 import org.apache.mina.core.future.WriteFuture;
@@ -323,7 +324,7 @@
         
         // Inject the codec into the chain
         ((DefaultIoFilterChainBuilder)chain).addLast( "codec", 
-        		new ProtocolCodecFilter( this.getProtocolCodecFactory() ) );
+                new ProtocolCodecFilter( this.getProtocolCodecFactory() ) );
 
         /*
          * The server is now initialized, we can
@@ -332,7 +333,7 @@
          */ 
         installDefaultHandlers();      
 
-        startLDAP0( getTcpPort(), chain );
+        startNetwork( getIpAddress(), getTcpPort(), getTcpBacklog(), chain );
         
         started = true;
         
@@ -418,9 +419,15 @@
     }
 
 
-    private void startLDAP0( int port, IoFilterChainBuilder chainBuilder )
+    private void startNetwork( String hostname, int port,int backlog, IoFilterChainBuilder
chainBuilder )
         throws Exception
     {
+        if ( backlog < 0 ) 
+        {
+            // Set the baclog to the default value when it's below 0
+            backlog = 50;
+        }
+
         PartitionNexus nexus = getDirectoryService().getPartitionNexus();
 
         for ( ExtendedOperationHandler h : extendedOperationHandlers )
@@ -434,41 +441,51 @@
 
         try
         {
-        	// First, create the acceptor with the configured number of threads (if defined)
-        	int nbTcpThreads = getNbTcpThreads();
-        	SocketAcceptor acceptor;
-        	
-        	if ( nbTcpThreads > 0 )
-        	{
-        		acceptor = new NioSocketAcceptor( nbTcpThreads );
-        	}
-        	else
-        	{
-        		acceptor = new NioSocketAcceptor();
-        	}
-        		
-        	setSocketAcceptor( acceptor );
-        	
-        	// Now, configure the acceptor
+            // First, create the acceptor with the configured number of threads (if defined)
+            int nbTcpThreads = getNbTcpThreads();
+            SocketAcceptor acceptor;
+            
+            if ( nbTcpThreads > 0 )
+            {
+                acceptor = new NioSocketAcceptor( nbTcpThreads );
+            }
+            else
+            {
+                acceptor = new NioSocketAcceptor();
+            }
+            
+            setSocketAcceptor( acceptor );
+            
+            // Set the service backlog
+            acceptor.setBacklog( backlog );
+                
+            // Now, configure the acceptor
             // Disable the disconnection of the clients on unbind
-        	acceptor.setCloseOnDeactivation( false );
-        	
-        	// Allow the port to be reused even if the socket is in TIME_WAIT state
-        	acceptor.setReuseAddress( true );
-        	
-        	// No Nagle's algorithm
-        	acceptor.getSessionConfig().setTcpNoDelay( true );
-        	
-        	// Inject the chain
-        	acceptor.setFilterChainBuilder( chainBuilder );
-        	
-        	// Inject the protocol handler
-        	acceptor.setHandler( getHandler() );
-        	
-        	// Bind to the configured address
-        	acceptor.bind( new InetSocketAddress( port ) );
-        	
-        	// We are done !
+            acceptor.setCloseOnDeactivation( false );
+            
+            // Allow the port to be reused even if the socket is in TIME_WAIT state
+            acceptor.setReuseAddress( true );
+            
+            // No Nagle's algorithm
+            acceptor.getSessionConfig().setTcpNoDelay( true );
+            
+            // Inject the chain
+            acceptor.setFilterChainBuilder( chainBuilder );
+            
+            // Inject the protocol handler
+            acceptor.setHandler( getHandler() );
+            
+            // Bind to the configured address
+            if ( StringTools.isEmpty( hostname ) )
+            {
+                acceptor.bind( new InetSocketAddress( port ) );
+            }
+            else
+            {
+                acceptor.bind( new InetSocketAddress( hostname, port ) );
+            }
+            
+            // We are done !
             started = true;
 
             if ( LOG.isInfoEnabled() )

Modified: directory/apacheds/branches/apacheds-mina2/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/AbstractProtocolService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mina2/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/AbstractProtocolService.java?rev=719009&r1=719008&r2=719009&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mina2/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/AbstractProtocolService.java
(original)
+++ directory/apacheds/branches/apacheds-mina2/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/AbstractProtocolService.java
Wed Nov 19 08:47:35 2008
@@ -41,6 +41,8 @@
     private boolean enabled;
     private String serviceId;
     private String serviceName;
+    
+    /** The server IP address */
     private String ipAddress;
     
     /** The service's port, if there is only one (TCP or UDP) */
@@ -75,6 +77,15 @@
      **/
     private int nbUdpThreads;
     
+    /** The backlog for all the transport services */
+    private int ipBacklog;
+    
+    /** The backlog for the TCP transport services */
+    private int tcpBacklog;
+    
+    /** The backlog for the UDP transport services */
+    private int udpBacklog;
+    
     /** directory service core where protocol data is backed */
     private DirectoryService directoryService;
 
@@ -337,4 +348,52 @@
 	{
 		this.nbUdpThreads = nbUdpThreads;
 	}
+
+
+	/**
+	 * @return the ipBacklog
+	 */
+	public int getIpBacklog() {
+		return ipBacklog;
+	}
+
+
+	/**
+	 * @param ipBacklog the ipBacklog to set
+	 */
+	public void setIpBacklog(int ipBacklog) {
+		this.ipBacklog = ipBacklog;
+	}
+
+
+	/**
+	 * @return the tcpBacklog
+	 */
+	public int getTcpBacklog() {
+		return tcpBacklog;
+	}
+
+
+	/**
+	 * @param tcpBacklog the tcpBacklog to set
+	 */
+	public void setTcpBacklog(int tcpBacklog) {
+		this.tcpBacklog = tcpBacklog;
+	}
+
+
+	/**
+	 * @return the udpBacklog
+	 */
+	public int getUdpBacklog() {
+		return udpBacklog;
+	}
+
+
+	/**
+	 * @param udpBacklog the udpBacklog to set
+	 */
+	public void setUdpBacklog(int udpBacklog) {
+		this.udpBacklog = udpBacklog;
+	}
 }

Modified: directory/installers/branches/installers-mina2/apacheds-noarch/src/main/java/org/apache/directory/server/Service.java
URL: http://svn.apache.org/viewvc/directory/installers/branches/installers-mina2/apacheds-noarch/src/main/java/org/apache/directory/server/Service.java?rev=719009&r1=719008&r2=719009&view=diff
==============================================================================
--- directory/installers/branches/installers-mina2/apacheds-noarch/src/main/java/org/apache/directory/server/Service.java
(original)
+++ directory/installers/branches/installers-mina2/apacheds-noarch/src/main/java/org/apache/directory/server/Service.java
Wed Nov 19 08:47:35 2008
@@ -27,6 +27,7 @@
 import org.apache.directory.server.configuration.ApacheDS;
 import org.apache.directory.server.core.DefaultDirectoryService;
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.dns.DnsServer;
 import org.apache.directory.server.kerberos.kdc.KdcServer;
 import org.apache.directory.server.ldap.LdapService;
 import org.apache.directory.server.ntp.NtpServer;
@@ -55,6 +56,9 @@
     /** The NTP server instance */
     private NtpServer ntpServer;
     
+    /** The DNS server instance */
+    private DnsServer dnsServer;
+    
     /** The Kerberos server instance */
     private KdcServer kdcServer;
     
@@ -63,15 +67,21 @@
 
     public void init( InstallationLayout install, String[] args ) throws Exception
     {
-    	// Initialize the LDAP server
-    	initLdap( install, args );
+        // Initialize the LDAP server
+        initLdap( install, args );
         
         // Initialize the NTP server
         initNtp( install, args );
         
-        //initDns( install, args );
+        // Initialize the DNS server (Not ready yet)
+        // initDns( install, args );
+        
+        // Initialize the DHCP server (Not ready yet)
         //initDhcp( install, args );
         
+        // Initialize the ChangePwd server (Not ready yet)
+        //initChangePwd( install, args );
+        
         // Initialize the Kerberos server
         initKerberos( install, args );
     }
@@ -82,8 +92,9 @@
      */
     private void initLdap( InstallationLayout install, String[] args ) throws Exception
     {
-    	LOG.info( "Starting the LDAP server" );
-    	
+        System.out.println( "Starting the LDAP server" );
+        LOG.info( "Starting the LDAP server" );
+        
         printBannerLDAP();
         long startTime = System.currentTimeMillis();
 
@@ -127,6 +138,8 @@
         {
             LOG.info( "LDAP server: started in {} milliseconds", ( System.currentTimeMillis()
- startTime ) + "" );
         }
+
+        System.out.println( "LDAP server started" );
     }
 
     
@@ -135,27 +148,29 @@
      */
     private void initNtp( InstallationLayout install, String[] args ) throws Exception
     {
-    	if ( factory == null )
-    	{
-    		return;
-    	}
+        if ( factory == null )
+        {
+            return;
+        }
 
-    	try
-    	{
+        try
+        {
             ntpServer = ( NtpServer ) factory.getBean( "ntpServer" );
-    	}
-    	catch ( Exception e )
-    	{
-        	LOG.info( "Cannot find any reference to the NTP Server in the server.xml file :
the server won't be started" );
-        	return;
-    	}
-    	
-    	LOG.info( "Starting the NTP server" );
-    	
+        }
+        catch ( Exception e )
+        {
+            LOG.info( "Cannot find any reference to the NTP Server in the server.xml file
: the server won't be started" );
+            return;
+        }
+        
+        System.out.println( "Starting the NTP server" );
+        LOG.info( "Starting the NTP server" );
+        
         printBannerNTP();
         long startTime = System.currentTimeMillis();
 
         ntpServer.start();
+        System.out.println( "NTP Server started" );
 
         if ( LOG.isInfoEnabled() )
         {
@@ -163,36 +178,72 @@
         }
     }
 
-    
 
-    
+    /**
+     * Initialize the DNS server
+     */
+    private void initDns( InstallationLayout install, String[] args ) throws Exception
+    {
+        if ( factory == null )
+        {
+            return;
+        }
+
+        try
+        {
+            dnsServer = ( DnsServer ) factory.getBean( "dnsServer" );
+        }
+        catch ( Exception e )
+        {
+            LOG.info( "Cannot find any reference to the DNS Server in the server.xml file
: the server won't be started" );
+            return;
+        }
+        
+        System.out.println( "Starting the DNS server" );
+        LOG.info( "Starting the DNS server" );
+        
+        printBannerDNS();
+        long startTime = System.currentTimeMillis();
+
+        dnsServer.start();
+        System.out.println( "DNS Server started" );
+
+        if ( LOG.isInfoEnabled() )
+        {
+            LOG.info( "DNS server: started in {} milliseconds", ( System.currentTimeMillis()
- startTime ) + "" );
+        }
+    }
+
+
     /**
      * Initialize the KERBEROS server
      */
     private void initKerberos( InstallationLayout install, String[] args ) throws Exception
     {
-    	if ( factory == null )
-    	{
-    		return;
-    	}
+        if ( factory == null )
+        {
+            return;
+        }
 
-    	try
-    	{
+        try
+        {
             kdcServer = ( KdcServer ) factory.getBean( "kdcServer" );
-    	}
-    	catch ( Exception e )
-    	{
-        	LOG.info( "Cannot find any reference to the Kerberos Server in the server.xml file
: the server won't be started" );
-        	return;
-    	}
-    	
-    	LOG.info( "Starting the Kerberos server" );
-    	
+        }
+        catch ( Exception e )
+        {
+            LOG.info( "Cannot find any reference to the Kerberos Server in the server.xml
file : the server won't be started" );
+            return;
+        }
+        
+        System.out.println( "Starting the Kerberos server" );
+        LOG.info( "Starting the Kerberos server" );
+        
         printBannerKERBEROS();
         long startTime = System.currentTimeMillis();
 
         kdcServer.start();
 
+        System.out.println( "Kerberos server started" );
         if ( LOG.isInfoEnabled() )
         {
             LOG.info( "Kerberos server: started in {} milliseconds", ( System.currentTimeMillis()
- startTime ) + "" );
@@ -285,7 +336,7 @@
     }
 
     public static final String BANNER_LDAP = 
-    	  "           _                     _          ____  ____   \n"
+          "           _                     _          ____  ____   \n"
         + "          / \\   _ __    ___  ___| |__   ___|  _ \\/ ___|  \n"
         + "         / _ \\ | '_ \\ / _` |/ __| '_ \\ / _ \\ | | \\___ \\  \n"
         + "        / ___ \\| |_) | (_| | (__| | | |  __/ |_| |___) | \n"
@@ -294,21 +345,30 @@
 
 
     public static final String BANNER_NTP =
-  	    "           _                     _          _   _ _____ _ __    \n"
-      + "          / \\   _ __    ___  ___| |__   ___| \\ | |_  __| '_ \\   \n"
-      + "         / _ \\ | '_ \\ / _` |/ __| '_ \\ / _ \\ .\\| | | | | |_) |  \n"
-      + "        / ___ \\| |_) | (_| | (__| | | |  __/ |\\  | | | | .__/   \n"
-      + "       /_/   \\_\\ .__/ \\__,_|\\___|_| |_|\\___|_| \\_| |_| |_|      \n"
-      + "               |_|                                              \n";
+          "           _                     _          _   _ _____ _ __    \n"
+        + "          / \\   _ __    ___  ___| |__   ___| \\ | |_  __| '_ \\   \n"
+        + "         / _ \\ | '_ \\ / _` |/ __| '_ \\ / _ \\ .\\| | | | | |_) |  \n"
+        + "        / ___ \\| |_) | (_| | (__| | | |  __/ |\\  | | | | .__/   \n"
+        + "       /_/   \\_\\ .__/ \\__,_|\\___|_| |_|\\___|_| \\_| |_| |_|      \n"
+        + "               |_|                                              \n";
 
 
     public static final String BANNER_KERBEROS = 
-  	    "           _                     _          _  __ ____  _ _     \n"
-      + "          / \\   _ __    ___  ___| |__   ___| |/ /|  _ \\| ' \\    \n"
-      + "         / _ \\ | '_ \\ / _` |/ __| '_ \\ / _ \\ ' / | |_) ) |) |   \n"
-      + "        / ___ \\| |_) | (_| | (__| | | |  __/ . \\ | .  /| |_) )  \n"
-      + "       /_/   \\_\\ .__/ \\__,_|\\___|_| |_|\\___|_|\\_\\|_|\\_\\|_.__/   \n"
-      + "               |_|                                              \n";
+          "           _                     _          _  __ ____   ___    \n"
+        + "          / \\   _ __    ___  ___| |__   ___| |/ /|  _ \\ / __|   \n"
+        + "         / _ \\ | '_ \\ / _` |/ __| '_ \\ / _ \\ ' / | | | / /      \n"
+        + "        / ___ \\| |_) | (_| | (__| | | |  __/ . \\ | |_| \\ \\__    \n"
+        + "       /_/   \\_\\ .__/ \\__,_|\\___|_| |_|\\___|_|\\_\\|____/ \\___|   \n"
+        + "               |_|                                              \n";
+
+
+    public static final String BANNER_DNS =
+          "           _                     _          ____  _   _ ____    \n"
+        + "          / \\   _ __    ___  ___| |__   ___|  _ \\| \\ | / ___|   \n"
+        + "         / _ \\ | '_ \\ / _` |/ __| '_ \\ / _ \\ | | |  \\| \\__  \\   \n"
+        + "        / ___ \\| |_) | (_| | (__| | | |  __/ |_| | . ' |___) |  \n"
+        + "       /_/   \\_\\ .__/ \\__,_|\\___|_| |_|\\___|____/|_|\\__|____/   \n"
+        + "               |_|                                              \n";
 
 
     /**
@@ -336,4 +396,13 @@
     {
         System.out.println( BANNER_KERBEROS );
     }
+
+
+    /**
+     * Print the DNS banner
+     */
+    public static void printBannerDNS()
+    {
+        System.out.println( BANNER_DNS );
+    }
 }



Mime
View raw message