directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r414541 - in /directory/branches/apacheds/nocodec-experiment/protocol-ldap/src/main/java/org/apache/directory/server/ldap: LdapProtocolProvider.java LdapProviderMonitor.java
Date Thu, 15 Jun 2006 10:33:45 GMT
Author: akarasulu
Date: Thu Jun 15 03:33:45 2006
New Revision: 414541

URL: http://svn.apache.org/viewvc?rev=414541&view=rev
Log:
start measuring req/s

Removed:
    directory/branches/apacheds/nocodec-experiment/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProviderMonitor.java
Modified:
    directory/branches/apacheds/nocodec-experiment/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolProvider.java

Modified: directory/branches/apacheds/nocodec-experiment/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolProvider.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/nocodec-experiment/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolProvider.java?rev=414541&r1=414540&r2=414541&view=diff
==============================================================================
--- directory/branches/apacheds/nocodec-experiment/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolProvider.java
(original)
+++ directory/branches/apacheds/nocodec-experiment/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolProvider.java
Thu Jun 15 03:33:45 2006
@@ -72,6 +72,7 @@
     public static final String SERVICE_NAME = "ldap";
     /** a map of the default request object class name to the handler class name */
     private static final Map DEFAULT_HANDLERS;
+    protected static int counter;
 
     static
     {
@@ -102,6 +103,27 @@
     // C O N S T R U C T O R S
     // ------------------------------------------------------------------------
 
+    
+    class RateDumper implements Runnable
+    {
+        public void run()
+        {
+            while( true )
+            {
+                try
+                {
+                    Thread.sleep( 1000 );
+                }
+                catch ( InterruptedException e )
+                {
+                    e.printStackTrace();
+                }
+                System.out.println( "req/s thru-put: " + counter );
+                counter = 0;
+            }
+        }
+    }
+    
 
     /**
      * Creates a MINA LDAP protocol provider.
@@ -109,8 +131,11 @@
      * @param env environment properties used to configure the provider and
      * underlying codec providers if any
      */
-    public LdapProtocolProvider(Hashtable env) throws LdapNamingException
+    public LdapProtocolProvider( Hashtable env ) throws LdapNamingException
     {
+        Thread t = new Thread( new RateDumper() );
+        t.start();
+        
         Hashtable copy = ( Hashtable ) env.clone();
         copy.put( Context.PROVIDER_URL, "" );
         SessionRegistry.releaseSingleton();
@@ -170,6 +195,9 @@
      */
     public LdapProtocolProvider() throws LdapNamingException
     {
+        Thread t = new Thread( new RateDumper() );
+        t.start();
+        
         SessionRegistry.releaseSingleton();
         new SessionRegistry( null );
 
@@ -298,7 +326,6 @@
                     byte b5 = input.get( 5 );
                     if ( b5 == 0x60 )
                     {
-                        System.out.println( "bind request" );
                         BindRequestImpl br = new BindRequestImpl(1);
                         br.setCredentials( "secret".getBytes() );
                         br.setName( new LdapDN() );
@@ -308,7 +335,6 @@
                     }
                     else if ( b5 == 0x63 )
                     {
-                        System.out.println( "search request" );
                         SearchRequestImpl sr = new SearchRequestImpl( 2 );
                         sr.setBase( new LdapDN() );
                         sr.setDerefAliases( DerefAliasesEnum.DEREFALWAYS );
@@ -321,7 +347,6 @@
                     }
                     else if ( b5 == 0x42 )
                     {
-                        System.out.println( "unbind request" );
                         UnbindRequestImpl ur = new UnbindRequestImpl( 3 );
                         req = ur;
                     }
@@ -331,6 +356,7 @@
                     }
                     
                     output.write( req );
+                    LdapProtocolProvider.counter++;
                 }
 
                 public void dispose( IoSession session ) throws Exception



Mime
View raw message