even though I haven't used distributed testing in a long time.. this is cool.

peter


On Fri, 9 Jul 2004 01:20:00 +0100, Sebastian Bazley <[EMAIL PROTECTED]> wrote:
> Thanks for the patch.
> 
> I've taken the liberty of rearranging the patch slightly - instead of adding
> a new option to start the server, I've added a new property to define the
> RMI port to be used.
> 
> This allows the port to be defined either on the command line -
> using -Jserver_port=2010 - or in the server's jmeter.properties file.
> 
> Hope that's OK.
> 
> I'll upload the patched sources shortly.
> 
> BTW,  normally it is better to create a Bugzilla issue and attach the patch
> file(s) to that.
> It is easy for e-mails containing patches to get overlooked, and/or for the
> attachment to be lost.
> 
> S.
> 
> 
> ----- Original Message -----
> From: "Freeman, Michael" <[EMAIL PROTECTED]>
> To: "JMeter Developers List" <[EMAIL PROTECTED]>
> Sent: Thursday, July 08, 2004 5:53 PM
> Subject: [PATCH] Enhancement RMIPORT
> 
> Hey
>    Never submitted a patch before so hope this is right. I used the latest
> jmeter from the CVS repository. I use this so Jmeter can use different port
> numbers for remote testing. I found it useful others may not.
> 
> The user adds a :portnumber to the servers indicated in jmeter.properties
> e.g localhost:2010
> 
> In jmeter-server.bat or equivalent rmiregistry 2010
> 
> Then remove the -s option and use -y 2010. (I just picked -y because
> everything else seemed used)
> 
> Is doesn't effect normal operation. You can still use -s etc
> 
> Patch
> 
> --- JMeter.java.orig 2004-07-08 11:29:04.000000000 +0100
> +++ JMeter.java 2004-07-08 13:44:44.000000000 +0100
> @@ -90,6 +90,8 @@
>      private static final int SYSTEM_PROPERTY = 'D';
>      private static final int LOGLEVEL = 'L';
>      private static final int REMOTE_OPT = 'r';
> +    private static final int RMI_PORT = 'y';
> +    public static final int DEFAULT_RMI_PORT = 1099;
> 
>      /**
>       * Define the understood options. Each CLOptionDescriptor contains:
> @@ -140,6 +142,11 @@
>                  SERVER_OPT,
>                  "run the JMeter server"),
>              new CLOptionDescriptor(
> +                "rmiport",
> +                CLOptionDescriptor.ARGUMENT_REQUIRED,
> +                RMI_PORT,
> +                "bind to registry on specified port"),
> +            new CLOptionDescriptor(
>                  "proxyHost",
>                  CLOptionDescriptor.ARGUMENT_REQUIRED,
>                  PROXY_HOST,
> @@ -266,6 +273,11 @@
>                      JMeterUtils.getResourceFileAsText(
>                          "org/apache/jmeter/help.txt"));
>              }
> +            else if (parser.getArgumentById(RMI_PORT) != null)
> +            {
> +
> startServer(Integer.parseInt(parser.getArgumentById(RMI_PORT).getArgument())
> );
> +                startBSH();
> +            }
>              else if (parser.getArgumentById(SERVER_OPT) != null)
>              {
>                  startServer();
> @@ -438,9 +450,13 @@
> 
>      public void startServer()
>      {
> +        startServer(DEFAULT_RMI_PORT);
> +    }
> +     public void startServer(int port)
> +    {
>          try
>          {
> -            new RemoteJMeterEngineImpl();
> +            new RemoteJMeterEngineImpl(port);
>              while (true)
>              {
>                  Thread.sleep(Long.MAX_VALUE);
> --- RemoteJMeterEngineImpl.java.orig 2004-07-08 11:31:20.000000000 +0100
> +++ RemoteJMeterEngineImpl.java 2004-07-08 13:53:10.000000000 +0100
> @@ -1,4 +1,4 @@
> -// $Header:
> /home/cvspublic/jakarta-jmeter/src/core/org/apache/jmeter/engine/RemoteJMete
> rEngineImpl.java,v 1.16 2004/02/12 23:59:01 sebb Exp $
> +// $Header:
> /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/engine/RemoteJMeterEngin
> eImpl.java,v 1.16 2004/02/12 23:59:01 sebb Exp $
>  /*
>   * Copyright 2001-2004 The Apache Software Foundation.
>   *
> @@ -21,6 +21,8 @@
>  import java.net.InetAddress;
>  import java.rmi.Naming;
>  import java.rmi.RemoteException;
> +import java.rmi.registry.Registry;
> +import java.rmi.registry.LocateRegistry;
> 
>  import org.apache.jorphan.collections.HashTree;
>  import org.apache.jorphan.logging.LoggingManager;
> @@ -34,19 +36,31 @@
>      extends java.rmi.server.UnicastRemoteObject
>      implements RemoteJMeterEngine
>  {
> +    public static final int DEFAULT_RMI_PORT = 1099;
>      transient private static Logger log =
> LoggingManager.getLoggerForClass();
>      JMeterEngine backingEngine;
> 
>      public RemoteJMeterEngineImpl() throws RemoteException
>      {
> +    init(DEFAULT_RMI_PORT);
> +    }
> +    public RemoteJMeterEngineImpl(int port) throws RemoteException
> +     {
> +        init(port);
> +    }
> +
> +    protected void init(int port) throws RemoteException
> +    {
>      log.info("Starting backing engine");
>   log.debug("This = "+ this);
>          try
>          {
> +            Registry reg = LocateRegistry.getRegistry(port);
>              backingEngine =
>                  new StandardJMeterEngine(
>                      InetAddress.getLocalHost().getHostName());
> -            Naming.rebind("JMeterEngine", this);
> +            reg.rebind("JMeterEngine", this);
> +            log.info("Bound to registry on port " + port);
>          }
>          catch(Exception ex){
>   log.error(
> 
> 
> ----------------------------------------------------------------------------
> ----
> 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to