commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jfcl...@apache.org
Subject svn commit: r165124 - in /jakarta/commons/proper/daemon/trunk/src/native/unix/native: arguments.c arguments.h jsvc-unix.c
Date Thu, 28 Apr 2005 09:36:03 GMT
Author: jfclere
Date: Thu Apr 28 02:36:02 2005
New Revision: 165124

URL: http://svn.apache.org/viewcvs?rev=165124&view=rev
Log:
Allow to use a parameter value for the maximum waiting time.
The minimum supported is 10, default behaviour is to return without waiting for the JVM to
start.
The value are rounded to by 10% of the value because the logic makes only 10 waiting loops.


Modified:
    jakarta/commons/proper/daemon/trunk/src/native/unix/native/arguments.c
    jakarta/commons/proper/daemon/trunk/src/native/unix/native/arguments.h
    jakarta/commons/proper/daemon/trunk/src/native/unix/native/jsvc-unix.c

Modified: jakarta/commons/proper/daemon/trunk/src/native/unix/native/arguments.c
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/daemon/trunk/src/native/unix/native/arguments.c?rev=165124&r1=165123&r2=165124&view=diff
==============================================================================
--- jakarta/commons/proper/daemon/trunk/src/native/unix/native/arguments.c (original)
+++ jakarta/commons/proper/daemon/trunk/src/native/unix/native/arguments.c Thu Apr 28 02:36:02
2005
@@ -43,7 +43,7 @@
     args->help=false;           /* Don't display help */
     args->chck=false;           /* Don't do a check-only startup */
     args->stop=false;           /* Stop a running jsvc */
-    args->wait=false;           /* Wait until jsvc has started the JVM */
+    args->wait=0;               /* Wait until jsvc has started the JVM */
     args->install=false;        /* Don't install as a service */
     args->remove=false;         /* Don't remove the installed service */
     args->service=false;        /* Don't run as a service */
@@ -116,7 +116,13 @@
             log_debug_flag=true;
 
         } else if (strcmp(argv[x],"-wait")==0) {
-            args->wait=true;
+            temp=optional(argc,argv,x++);
+            if (temp!=NULL)
+                args->wait=atoi(temp);
+            if (args->wait<10) {
+                log_error("Invalid wait time specified (min=10)");
+                return(NULL);
+            }
 
         } else if (strcmp(argv[x],"-stop")==0) {
             args->stop=true;
@@ -256,7 +262,7 @@
 
         log_debug("| Stop:            %s",IsTrueFalse(args->stop));
 
-        log_debug("| Wait:            %s",IsTrueFalse(args->wait));
+        log_debug("| Wait:            %d",args->wait);
 
         log_debug("| Run as service:  %s",IsYesNo(args->service));
 

Modified: jakarta/commons/proper/daemon/trunk/src/native/unix/native/arguments.h
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/daemon/trunk/src/native/unix/native/arguments.h?rev=165124&r1=165123&r2=165124&view=diff
==============================================================================
--- jakarta/commons/proper/daemon/trunk/src/native/unix/native/arguments.h (original)
+++ jakarta/commons/proper/daemon/trunk/src/native/unix/native/arguments.h Thu Apr 28 02:36:02
2005
@@ -53,8 +53,8 @@
     bool chck;
     /** Stop running jsvc */
     bool stop;
-    /** Wait until service started */
-    bool wait;
+    /** number of seconds to until service started */
+    int wait;
     /** Install as a service (win32) */
     bool install;
     /** Remove when installed as a service (win32) */

Modified: jakarta/commons/proper/daemon/trunk/src/native/unix/native/jsvc-unix.c
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/daemon/trunk/src/native/unix/native/jsvc-unix.c?rev=165124&r1=165123&r2=165124&view=diff
==============================================================================
--- jakarta/commons/proper/daemon/trunk/src/native/unix/native/jsvc-unix.c (original)
+++ jakarta/commons/proper/daemon/trunk/src/native/unix/native/jsvc-unix.c Thu Apr 28 02:36:02
2005
@@ -368,8 +368,9 @@
     bool havejvm=false;
     int fd;
     char buff[80];
-    int i, status;
+    int i, status, waittime;
     log_debug("wait_child %d", pid);
+    waittime = args->wait/10;
     while (count>0) {
         sleep(1);
         /* check if the controler is still running */
@@ -406,10 +407,10 @@
                 }
             }
         }
-        sleep(5);
+        sleep(waittime);
         count--;
     }
-    return(1); /* It takes more than a minute to start, something must be wrong */
+    return(1); /* It takes more than the wait time to start, something must be wrong */
 }
 
 /*
@@ -649,7 +650,7 @@
         }
         /* If we're in the parent process */
         if (pid!=0) {
-            if (args->wait==true)
+            if (args->wait>=10)
                 return(wait_child(args,pid));
             else
                 return(0);



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


Mime
View raw message