You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ha...@apache.org on 2001/12/29 02:35:22 UTC

cvs commit: jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/test TestClient.java

hammant     01/12/28 17:35:22

  Modified:    armi/src/java/org/apache/commons/armi/test TestClient.java
  Added:       armi     LICENSE PROPOSAL README.txt
  Log:
  License, proposal and readme added.  Performance test better
  
  Revision  Changes    Path
  1.1                  jakarta-commons-sandbox/armi/LICENSE
  
  Index: LICENSE
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  
  
  
  1.1                  jakarta-commons-sandbox/armi/PROPOSAL
  
  Index: PROPOSAL
  ===================================================================
  --------------------------------------------------------------------------
    JAKARTA COMMONS  -  ALTERNATE (TO) REMOTE METHOD INVOCATION - "ARMI"
  --------------------------------------------------------------------------
  
  Abstract:
  
  The ARMI package provides an alternative to Java's RMI.  Apart from simply 
  being an alternative it provides the following features:
  
  1) Any interface publishing
  
    - no forcing of extension of java.rmi.Remote
    - no forced declarations of "throws RemoteException"
    
  2) Multiple transports
  
    - Plain Sockets / ObjectStream
    - via RMI
    - Piped with same VM / ObjectStream
    - Direct within same VM
    - SOAP (planned)
    - CORBA (planned)
    - Plain sockets / custom messaging (planned)
    - JMS (planned)
    
  3) Speed  
  
    - Using the ARMI over RMI transport as a baseline.  Measuring 100,000 
      method invocations after discarding the first for the purposes of 
      timing, ObjStream over sockets is three times faster, ObjStream over 
      Pipe is eleven times faster, Direct is a thousand times faster. Granted
      there could be less of an advantage if compared to a proper RMI solution
      (not layered), or one that is in the same VM with different threads.
  
  4) Interface/Impl separated design.
  
    - ARMI can be build easily into any application or application framework.  
      Individual aspects can be reimplemented (overridden) as the need arises.
  
  Limitations:
  
  1) Pass by value only.
  
    - Unlike proper RMI, ARMI only currently supports "pass by value".  If 
      an argument or return type were another ARMI published service, then 
      it could not currently be handled by ARMI. (to fix).
      
  2) Generated "stubs" have to be in the client VM.
  
    - Later we will allow server to pass forward implementation class
      definitions as opposed to just newInstance() them as at present.
  
  Initial commiters:
  
  Paul Hammant (hammant)
  
  
  
  1.1                  jakarta-commons-sandbox/armi/README.txt
  
  Index: README.txt
  ===================================================================
  --------------------------------------------------------------------------
    JAKARTA  COMMONS  -  ALTERNATE (TO) REMOTE METHOD INVOCATION - "ARMI"
  --------------------------------------------------------------------------
  
  o Building
  
  To build, you must have ant installed.  Just type 'ant' -- the default
  target will compile the classes (no jars at present)
  
  o Demonstration of transport (see test package)
  
  To test ObjectStream over Socket transport:
  
    In DOS shell #1 - "ant -buildfile test.xml test1-serve"
    In DOS shell #2 - "ant -buildfile test.xml test1-client" 
    
  To test ObjectStream Piped transport
  
    In DOS shell #1 - "ant -buildfile test.xml test2"
    
  To test (Armi over) RMI transport:  
  
    In DOS shell #1 - "ant -buildfile test.xml test3-serve"
    In DOS shell #2 - "ant -buildfile test.xml test3-client" 
    
  To test Direct transport
  
    In DOS shell #1 - "ant -buildfile test.xml test4"  
  
  o Use in your application
  
  To-be-advised
  
  
  1.2       +12 -14    jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/test/TestClient.java
  
  Index: TestClient.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/test/TestClient.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestClient.java	28 Dec 2001 18:08:39 -0000	1.1
  +++ TestClient.java	29 Dec 2001 01:35:22 -0000	1.2
  @@ -1,8 +1,8 @@
   
   /*
  - * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/test/TestClient.java,v 1.1 2001/12/28 18:08:39 hammant Exp $
  - * $Revision: 1.1 $
  - * $Date: 2001/12/28 18:08:39 $
  + * $Header: /home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/test/TestClient.java,v 1.2 2001/12/29 01:35:22 hammant Exp $
  + * $Revision: 1.2 $
  + * $Date: 2001/12/29 01:35:22 $
    *
    * ====================================================================
    *
  @@ -77,7 +77,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public class TestClient {
   
  @@ -110,25 +110,23 @@
   
           System.out.println("CLT: " + ti.hello4((float) 1.3, 2.1));
   
  +        ti.testSpeed(); // to ignore for timing
           long start = System.currentTimeMillis();
  -        for (int i = 0; i < 1000; i++) {
  +        for (int i = 0; i < 100000; i++) {
               ti.testSpeed();
           }
           long end = System.currentTimeMillis();
  -        System.out.println("Total time take for 1000 simple calls (millis) = " + (end - start));
  +        System.out.println("Total time take for 100,000 simple calls (millis) = " + (end - start));
   
  +        String rv = ti.testSpeed2("toIgnoreForTiming");
           start = System.currentTimeMillis();
  -        for (int i = 0; i < 1000; i++) {
  -            String rv = ti.testSpeed2("qwerty");
  +        for (int i = 0; i < 100000; i++) {
  +            rv = ti.testSpeed2("qwerty");
           }
           end = System.currentTimeMillis();
  -        System.out.println("Total time take for 1000 retval/param calls (millis) = " + (end - start));
  +        System.out.println("Total time take for 100,000 retval/param calls (millis) = " + (end - start));
  +
   
       }
   
  -    //public static void main(String[] args) throws Exception {
  -    //    ArmiHostContext arhc = new PlainSocketArmiHostContext("127.0.0.1",1234);
  -    //    TestInterface ti = (TestInterface) ArmiFactory.getDefaultArmiFactory().lookup(arhc,"Hello",TestInterface.class);
  -    //    new TestClient(ti);
  -    //}
   }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>