directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r415075 - in /directory/sandbox/akarasulu/mina-profiling: client/ server/ server/src/main/assembly/ server/src/main/java/org/apache/mina/performance/test/server/
Date Sat, 17 Jun 2006 22:19:00 GMT
Author: akarasulu
Date: Sat Jun 17 15:18:59 2006
New Revision: 415075

URL: http://svn.apache.org/viewvc?rev=415075&view=rev
Log:
adding manifest, server starter shellscript, log4j setup and the server classes; also corrected
messed up client.sh script

Added:
    directory/sandbox/akarasulu/mina-profiling/server/log4j.properties
    directory/sandbox/akarasulu/mina-profiling/server/server.sh   (with props)
    directory/sandbox/akarasulu/mina-profiling/server/src/main/assembly/
    directory/sandbox/akarasulu/mina-profiling/server/src/main/assembly/main.xml
    directory/sandbox/akarasulu/mina-profiling/server/src/main/java/org/apache/mina/performance/test/server/TestServer.java
    directory/sandbox/akarasulu/mina-profiling/server/src/main/java/org/apache/mina/performance/test/server/TestServerHandler.java
Modified:
    directory/sandbox/akarasulu/mina-profiling/client/client.sh
    directory/sandbox/akarasulu/mina-profiling/server/pom.xml

Modified: directory/sandbox/akarasulu/mina-profiling/client/client.sh
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/mina-profiling/client/client.sh?rev=415075&r1=415074&r2=415075&view=diff
==============================================================================
--- directory/sandbox/akarasulu/mina-profiling/client/client.sh (original)
+++ directory/sandbox/akarasulu/mina-profiling/client/client.sh Sat Jun 17 15:18:59 2006
@@ -6,4 +6,4 @@
   mvn clean assembly:assembly
 fi
 
-java -Dlog4j.configuration=file://$(pwd)/log4j.properties -jar client-1.0-SNAPSHOT-app.jar
$@
+java -Dlog4j.configuration=file://$(pwd)/log4j.properties -jar target/client-1.0-SNAPSHOT-app.jar
$@

Added: directory/sandbox/akarasulu/mina-profiling/server/log4j.properties
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/mina-profiling/server/log4j.properties?rev=415075&view=auto
==============================================================================
--- directory/sandbox/akarasulu/mina-profiling/server/log4j.properties (added)
+++ directory/sandbox/akarasulu/mina-profiling/server/log4j.properties Sat Jun 17 15:18:59
2006
@@ -0,0 +1,6 @@
+log4j.rootCategory=WARN, stdout
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n
+

Modified: directory/sandbox/akarasulu/mina-profiling/server/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/mina-profiling/server/pom.xml?rev=415075&r1=415074&r2=415075&view=diff
==============================================================================
--- directory/sandbox/akarasulu/mina-profiling/server/pom.xml (original)
+++ directory/sandbox/akarasulu/mina-profiling/server/pom.xml Sat Jun 17 15:18:59 2006
@@ -13,4 +13,38 @@
   <url>http://directory.apache.org</url>
   <dependencies>
   </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <configuration>
+          <archive>
+            <manifest>
+              <mainClass>
+                org.apache.mina.performance.test.server.TestServer
+              </mainClass>
+            </manifest>
+          </archive>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <configuration>
+          <archive>
+            <manifest>
+              <mainClass>
+                org.apache.mina.performance.test.server.TestServer
+              </mainClass>
+            </manifest>
+          </archive>
+          <descriptor>src/main/assembly/main.xml</descriptor>
+          <classifier>app</classifier>
+          <appendAssemblyId>false</appendAssemblyId>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
 </project>

Added: directory/sandbox/akarasulu/mina-profiling/server/server.sh
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/mina-profiling/server/server.sh?rev=415075&view=auto
==============================================================================
--- directory/sandbox/akarasulu/mina-profiling/server/server.sh (added)
+++ directory/sandbox/akarasulu/mina-profiling/server/server.sh Sat Jun 17 15:18:59 2006
@@ -0,0 +1,9 @@
+#!/bin/sh
+if [ -e target/server-1.0-SNAPSHOT-app.jar ] ; then
+  echo server uber jar exists
+else
+  echo server uber jar not found need to build it
+  mvn clean assembly:assembly
+fi
+
+java -Dlog4j.configuration=file://$(pwd)/log4j.properties -jar target/server-1.0-SNAPSHOT-app.jar
$@

Propchange: directory/sandbox/akarasulu/mina-profiling/server/server.sh
------------------------------------------------------------------------------
    svn:executable = *

Added: directory/sandbox/akarasulu/mina-profiling/server/src/main/assembly/main.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/mina-profiling/server/src/main/assembly/main.xml?rev=415075&view=auto
==============================================================================
--- directory/sandbox/akarasulu/mina-profiling/server/src/main/assembly/main.xml (added)
+++ directory/sandbox/akarasulu/mina-profiling/server/src/main/assembly/main.xml Sat Jun 17
15:18:59 2006
@@ -0,0 +1,25 @@
+<assembly>
+  <id>apacheds-main</id>
+  <formats>
+    <format>jar</format>
+  </formats>
+  <includeBaseDirectory>false</includeBaseDirectory>
+  <fileSets>
+    <fileSet>
+      <directory>target/classes</directory>
+      <outputDirectory>/</outputDirectory>
+    </fileSet>
+  </fileSets>
+  <dependencySets>
+    <dependencySet>
+      <outputDirectory>/</outputDirectory>
+      <unpack>true</unpack>
+      <scope>runtime</scope>
+      <excludes>
+        <exclude>ant:ant</exclude>
+        <exclude>checkstyle:checkstyle</exclude>
+        <exclude>xerces:xercesImpl</exclude>
+      </excludes>
+    </dependencySet>
+  </dependencySets>
+</assembly>

Added: directory/sandbox/akarasulu/mina-profiling/server/src/main/java/org/apache/mina/performance/test/server/TestServer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/mina-profiling/server/src/main/java/org/apache/mina/performance/test/server/TestServer.java?rev=415075&view=auto
==============================================================================
--- directory/sandbox/akarasulu/mina-profiling/server/src/main/java/org/apache/mina/performance/test/server/TestServer.java
(added)
+++ directory/sandbox/akarasulu/mina-profiling/server/src/main/java/org/apache/mina/performance/test/server/TestServer.java
Sat Jun 17 15:18:59 2006
@@ -0,0 +1,17 @@
+package org.apache.mina.performance.test.server;
+
+
+import java.net.InetSocketAddress;
+
+import org.apache.mina.common.IoAcceptor;
+import org.apache.mina.transport.socket.nio.SocketAcceptor;
+
+
+public class TestServer
+{
+    public static final void main( String[] args ) throws Exception
+    {
+        IoAcceptor acceptor = new SocketAcceptor( 2 );
+        acceptor.bind( new InetSocketAddress( 10389 ), new TestServerHandler() );
+    }
+}

Added: directory/sandbox/akarasulu/mina-profiling/server/src/main/java/org/apache/mina/performance/test/server/TestServerHandler.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/mina-profiling/server/src/main/java/org/apache/mina/performance/test/server/TestServerHandler.java?rev=415075&view=auto
==============================================================================
--- directory/sandbox/akarasulu/mina-profiling/server/src/main/java/org/apache/mina/performance/test/server/TestServerHandler.java
(added)
+++ directory/sandbox/akarasulu/mina-profiling/server/src/main/java/org/apache/mina/performance/test/server/TestServerHandler.java
Sat Jun 17 15:18:59 2006
@@ -0,0 +1,93 @@
+package org.apache.mina.performance.test.server;
+
+
+import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoFilter;
+import org.apache.mina.common.IoHandlerAdapter;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.filter.LoggingFilter;
+
+
+public class TestServerHandler extends IoHandlerAdapter
+{
+    private static final IoFilter LOGGING_FILTER = new LoggingFilter();
+    
+    private static final byte[] BIND_RESP = 
+        new byte[] { 
+            0x30, 0x0c, 0x02, 0x01, 0x01, 0x61, 0x07, 0x0a, 0x01, 0x00, 0x04, 
+            0x00, 0x04, 0x00 };
+    private static final byte[] SEARCH_ENTRY_RESP =
+        new byte[] { 
+            0x30, 0x1f, 0x02, 0x01, 0x02, 0x64, 0x1a, 0x04, 0x00, 0x30, 0x16, 
+            0x30, 0x14, 0x04, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x43, 
+            0x6c, 0x61, 0x73, 0x73, 0x31, 0x05, 0x04, 0x03, 0x74, 0x6f, 0x70 };
+    private static final byte[] SEARCH_DONE_RESP = 
+        new byte[] { 
+            0x30, 0x0c, 0x02, 0x01, 0x02, 0x65, 0x07, 0x0a, 0x01, 0x00, 0x04, 
+            0x00, 0x04, 0x00 };
+    
+    private long counter = 0;
+
+    
+
+    public TestServerHandler()
+    {
+        Thread t = new Thread( new RateDumper() );
+        t.start();
+    }
+    
+    
+    public void sessionCreated( IoSession session ) throws Exception
+    {
+        session.getFilterChain().addLast( "logger", LOGGING_FILTER );
+    }
+    
+    
+    public void messageReceived( IoSession session, Object message ) throws Exception
+    {
+        ByteBuffer buf = ( ByteBuffer ) message;
+        byte b5 = buf.get( 5 );
+        byte[] payload = new byte[buf.remaining()];
+        buf.get( payload );
+        
+        if ( b5 == 0x60 ) // bind request
+        {
+            session.write( ByteBuffer.wrap( BIND_RESP ) );
+        }
+        else if ( b5 == 0x63 ) // search request
+        {
+            session.write( ByteBuffer.wrap( SEARCH_ENTRY_RESP ) );
+            session.write( ByteBuffer.wrap( SEARCH_DONE_RESP ) );
+        }
+        else if ( b5 == 0x42 ) // unbind request
+        {
+            // do nothing
+        }
+        else 
+        {
+            throw new IllegalStateException( "Unknown message type" );
+        }
+        counter++;
+    }
+
+
+    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;
+            }
+        }
+    }
+}



Mime
View raw message