You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2007/06/16 06:28:54 UTC

svn commit: r547859 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2: engine/AxisServer.java transport/SimpleAxis2Server.java

Author: dims
Date: Fri Jun 15 21:28:51 2007
New Revision: 547859

URL: http://svn.apache.org/viewvc?view=rev&rev=547859
Log:
add a parameter in the constructor for the user to take a decision on whether deploying a service should start the server

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java?view=diff&rev=547859&r1=547858&r2=547859
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java Fri Jun 15 21:28:51 2007
@@ -31,10 +31,22 @@
 
     protected ConfigurationContext configContext;
     protected ListenerManager listenerManager;
+    private boolean startOnDeploy;
+    private boolean started = false;
 
-    public AxisServer() throws Exception {
+    /**
+     * @param startOnDeploy - Should the server be started automatically when the first service is deployed
+     * @throws Exception
+     */
+    public AxisServer(boolean startOnDeploy) throws Exception {
+        this.startOnDeploy = startOnDeploy;
     }
 
+    /**
+     * Users extending this class can override this method to supply a custom ConfigurationContext
+     * @return
+     * @throws AxisFault
+     */
     protected ConfigurationContext createDefaultConfigurationContext() throws AxisFault {
         return ConfigurationContextFactory.createConfigurationContextFromFileSystem(null);
     }
@@ -47,6 +59,7 @@
     public void start()throws AxisFault {
         listenerManager = new ListenerManager();
         listenerManager.startSystem(getConfigurationContext());
+        started = true;
     }
 
     /**
@@ -58,8 +71,15 @@
         AxisConfiguration axisConfig = getConfigurationContext().getAxisConfiguration();
         AxisService service = AxisService.createService(serviceClassName,axisConfig);
         axisConfig.addService(service);
+        if(!started && startOnDeploy){
+            start();
+        }
     }
 
+    /**
+     * Stop the server, automatically terminates the listener manager as well.
+     * @throws AxisFault
+     */
     public void stop() throws AxisFault{
         if(configContext!=null){
             configContext.terminate();

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java?view=diff&rev=547859&r1=547858&r2=547859
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java Fri Jun 15 21:28:51 2007
@@ -43,9 +43,10 @@
     public SimpleAxis2Server (
             String repoLocation,
             String confLocation) throws Exception {
-       configContext = ConfigurationContextFactory
-                    .createConfigurationContextFromFileSystem(repoLocation,
-                                                              confLocation);
+        super(false);
+        configContext = ConfigurationContextFactory
+                .createConfigurationContextFromFileSystem(repoLocation,
+                        confLocation);
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Re: svn commit: r547859 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2: engine/AxisServer.java transport/SimpleAxis2Server.java

Posted by Glen Daniels <gl...@thoughtcraft.com>.
Hi Deepal, all:

Deepal Jayasinghe wrote:
> hmm , what is the use of deploying a service to a server which is not
> running ?
> 
> For me it is so obvious deploying service mean deploy the service to a
> running system.

I like dims' change, it seems like a good compromise.  There are 
definitely times when you do not want to start the server until your 
whole network of N services are all successfully deployed.  Having a 
boolean parameter will make sure that people are aware of how they are 
(implicitly or explicitly) starting/stopping the server, which I think 
is entirely reasonable even for "easy" uses of multi-threaded server 
code. :)

+1 also for spelling fixes and JavaDoc, and eventually a test case!

--Glen

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Re: svn commit: r547859 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2: engine/AxisServer.java transport/SimpleAxis2Server.java

Posted by Davanum Srinivas <da...@gmail.com>.
Deepal,

In our AxisServlet, we call initConfigContext which calls
WarBasedAxisConfigurator which deploys all the services and then
ListenerManager is started all in "init(ServletConfig config)" method.
Is this wrong then? Should we start a thread to load all the services
separately and kick off this thread from "init(ServletConfig config)"?
How come this has been working fine so far? so long?

thanks,
dims

On 6/16/07, Deepal Jayasinghe <de...@opensource.lk> wrote:
> hmm , what is the use of deploying a service to a server which is not
> running ?
>
> For me it is so obvious deploying service mean deploy the service to a
> running system.
>
>
> -Deepal
>
> dims@apache.org wrote:
> > Author: dims
> > Date: Fri Jun 15 21:28:51 2007
> > New Revision: 547859
> >
> > URL: http://svn.apache.org/viewvc?view=rev&rev=547859
> > Log:
> > add a parameter in the constructor for the user to take a decision on whether deploying a service should start the server
> >
> > Modified:
> >     webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java
> >     webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java
> >
> > Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java
> > URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java?view=diff&rev=547859&r1=547858&r2=547859
> > ==============================================================================
> > --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java (original)
> > +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java Fri Jun 15 21:28:51 2007
> > @@ -31,10 +31,22 @@
> >
> >      protected ConfigurationContext configContext;
> >      protected ListenerManager listenerManager;
> > +    private boolean startOnDeploy;
> > +    private boolean started = false;
> >
> > -    public AxisServer() throws Exception {
> > +    /**
> > +     * @param startOnDeploy - Should the server be started automatically when the first service is deployed
> > +     * @throws Exception
> > +     */
> > +    public AxisServer(boolean startOnDeploy) throws Exception {
> > +        this.startOnDeploy = startOnDeploy;
> >      }
> >
> > +    /**
> > +     * Users extending this class can override this method to supply a custom ConfigurationContext
> > +     * @return
> > +     * @throws AxisFault
> > +     */
> >      protected ConfigurationContext createDefaultConfigurationContext() throws AxisFault {
> >          return ConfigurationContextFactory.createConfigurationContextFromFileSystem(null);
> >      }
> > @@ -47,6 +59,7 @@
> >      public void start()throws AxisFault {
> >          listenerManager = new ListenerManager();
> >          listenerManager.startSystem(getConfigurationContext());
> > +        started = true;
> >      }
> >
> >      /**
> > @@ -58,8 +71,15 @@
> >          AxisConfiguration axisConfig = getConfigurationContext().getAxisConfiguration();
> >          AxisService service = AxisService.createService(serviceClassName,axisConfig);
> >          axisConfig.addService(service);
> > +        if(!started && startOnDeploy){
> > +            start();
> > +        }
> >      }
> >
> > +    /**
> > +     * Stop the server, automatically terminates the listener manager as well.
> > +     * @throws AxisFault
> > +     */
> >      public void stop() throws AxisFault{
> >          if(configContext!=null){
> >              configContext.terminate();
> >
> > Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java
> > URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java?view=diff&rev=547859&r1=547858&r2=547859
> > ==============================================================================
> > --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java (original)
> > +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java Fri Jun 15 21:28:51 2007
> > @@ -43,9 +43,10 @@
> >      public SimpleAxis2Server (
> >              String repoLocation,
> >              String confLocation) throws Exception {
> > -       configContext = ConfigurationContextFactory
> > -                    .createConfigurationContextFromFileSystem(repoLocation,
> > -                                                              confLocation);
> > +        super(false);
> > +        configContext = ConfigurationContextFactory
> > +                .createConfigurationContextFromFileSystem(repoLocation,
> > +                        confLocation);
> >      }
> >
> >      /**
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-cvs-help@ws.apache.org
> >
> >
> >
> >
>
> --
> Thanks,
> Deepal
> ................................................................
> "The highest tower is built one brick at a time"
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-cvs-help@ws.apache.org
>
>


-- 
Davanum Srinivas :: http://davanum.wordpress.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Re: svn commit: r547859 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2: engine/AxisServer.java transport/SimpleAxis2Server.java

Posted by Glen Daniels <gl...@thoughtcraft.com>.
Hi Deepal, all:

Deepal Jayasinghe wrote:
> hmm , what is the use of deploying a service to a server which is not
> running ?
> 
> For me it is so obvious deploying service mean deploy the service to a
> running system.

I like dims' change, it seems like a good compromise.  There are 
definitely times when you do not want to start the server until your 
whole network of N services are all successfully deployed.  Having a 
boolean parameter will make sure that people are aware of how they are 
(implicitly or explicitly) starting/stopping the server, which I think 
is entirely reasonable even for "easy" uses of multi-threaded server 
code. :)

+1 also for spelling fixes and JavaDoc, and eventually a test case!

--Glen

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Re: svn commit: r547859 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2: engine/AxisServer.java transport/SimpleAxis2Server.java

Posted by Deepal Jayasinghe <de...@opensource.lk>.
hmm , what is the use of deploying a service to a server which is not
running ?

For me it is so obvious deploying service mean deploy the service to a
running system.


-Deepal

dims@apache.org wrote:
> Author: dims
> Date: Fri Jun 15 21:28:51 2007
> New Revision: 547859
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=547859
> Log:
> add a parameter in the constructor for the user to take a decision on whether deploying a service should start the server
>
> Modified:
>     webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java
>     webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java
>
> Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java
> URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java?view=diff&rev=547859&r1=547858&r2=547859
> ==============================================================================
> --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java (original)
> +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java Fri Jun 15 21:28:51 2007
> @@ -31,10 +31,22 @@
>  
>      protected ConfigurationContext configContext;
>      protected ListenerManager listenerManager;
> +    private boolean startOnDeploy;
> +    private boolean started = false;
>  
> -    public AxisServer() throws Exception {
> +    /**
> +     * @param startOnDeploy - Should the server be started automatically when the first service is deployed
> +     * @throws Exception
> +     */
> +    public AxisServer(boolean startOnDeploy) throws Exception {
> +        this.startOnDeploy = startOnDeploy;
>      }
>  
> +    /**
> +     * Users extending this class can override this method to supply a custom ConfigurationContext
> +     * @return
> +     * @throws AxisFault
> +     */
>      protected ConfigurationContext createDefaultConfigurationContext() throws AxisFault {
>          return ConfigurationContextFactory.createConfigurationContextFromFileSystem(null);
>      }
> @@ -47,6 +59,7 @@
>      public void start()throws AxisFault {
>          listenerManager = new ListenerManager();
>          listenerManager.startSystem(getConfigurationContext());
> +        started = true;
>      }
>  
>      /**
> @@ -58,8 +71,15 @@
>          AxisConfiguration axisConfig = getConfigurationContext().getAxisConfiguration();
>          AxisService service = AxisService.createService(serviceClassName,axisConfig);
>          axisConfig.addService(service);
> +        if(!started && startOnDeploy){
> +            start();
> +        }
>      }
>  
> +    /**
> +     * Stop the server, automatically terminates the listener manager as well.
> +     * @throws AxisFault
> +     */
>      public void stop() throws AxisFault{
>          if(configContext!=null){
>              configContext.terminate();
>
> Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java
> URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java?view=diff&rev=547859&r1=547858&r2=547859
> ==============================================================================
> --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java (original)
> +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java Fri Jun 15 21:28:51 2007
> @@ -43,9 +43,10 @@
>      public SimpleAxis2Server (
>              String repoLocation,
>              String confLocation) throws Exception {
> -       configContext = ConfigurationContextFactory
> -                    .createConfigurationContextFromFileSystem(repoLocation,
> -                                                              confLocation);
> +        super(false);
> +        configContext = ConfigurationContextFactory
> +                .createConfigurationContextFromFileSystem(repoLocation,
> +                        confLocation);
>      }
>  
>      /**
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-cvs-help@ws.apache.org
>
>
>
>   

-- 
Thanks,
Deepal
................................................................
"The highest tower is built one brick at a time"



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Re: svn commit: r547859 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2: engine/AxisServer.java transport/SimpleAxis2Server.java

Posted by Deepal Jayasinghe <de...@opensource.lk>.
hmm , what is the use of deploying a service to a server which is not
running ?

For me it is so obvious deploying service mean deploy the service to a
running system.


-Deepal

dims@apache.org wrote:
> Author: dims
> Date: Fri Jun 15 21:28:51 2007
> New Revision: 547859
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=547859
> Log:
> add a parameter in the constructor for the user to take a decision on whether deploying a service should start the server
>
> Modified:
>     webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java
>     webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java
>
> Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java
> URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java?view=diff&rev=547859&r1=547858&r2=547859
> ==============================================================================
> --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java (original)
> +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisServer.java Fri Jun 15 21:28:51 2007
> @@ -31,10 +31,22 @@
>  
>      protected ConfigurationContext configContext;
>      protected ListenerManager listenerManager;
> +    private boolean startOnDeploy;
> +    private boolean started = false;
>  
> -    public AxisServer() throws Exception {
> +    /**
> +     * @param startOnDeploy - Should the server be started automatically when the first service is deployed
> +     * @throws Exception
> +     */
> +    public AxisServer(boolean startOnDeploy) throws Exception {
> +        this.startOnDeploy = startOnDeploy;
>      }
>  
> +    /**
> +     * Users extending this class can override this method to supply a custom ConfigurationContext
> +     * @return
> +     * @throws AxisFault
> +     */
>      protected ConfigurationContext createDefaultConfigurationContext() throws AxisFault {
>          return ConfigurationContextFactory.createConfigurationContextFromFileSystem(null);
>      }
> @@ -47,6 +59,7 @@
>      public void start()throws AxisFault {
>          listenerManager = new ListenerManager();
>          listenerManager.startSystem(getConfigurationContext());
> +        started = true;
>      }
>  
>      /**
> @@ -58,8 +71,15 @@
>          AxisConfiguration axisConfig = getConfigurationContext().getAxisConfiguration();
>          AxisService service = AxisService.createService(serviceClassName,axisConfig);
>          axisConfig.addService(service);
> +        if(!started && startOnDeploy){
> +            start();
> +        }
>      }
>  
> +    /**
> +     * Stop the server, automatically terminates the listener manager as well.
> +     * @throws AxisFault
> +     */
>      public void stop() throws AxisFault{
>          if(configContext!=null){
>              configContext.terminate();
>
> Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java
> URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java?view=diff&rev=547859&r1=547858&r2=547859
> ==============================================================================
> --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java (original)
> +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/SimpleAxis2Server.java Fri Jun 15 21:28:51 2007
> @@ -43,9 +43,10 @@
>      public SimpleAxis2Server (
>              String repoLocation,
>              String confLocation) throws Exception {
> -       configContext = ConfigurationContextFactory
> -                    .createConfigurationContextFromFileSystem(repoLocation,
> -                                                              confLocation);
> +        super(false);
> +        configContext = ConfigurationContextFactory
> +                .createConfigurationContextFromFileSystem(repoLocation,
> +                        confLocation);
>      }
>  
>      /**
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-cvs-help@ws.apache.org
>
>
>
>   

-- 
Thanks,
Deepal
................................................................
"The highest tower is built one brick at a time"



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org