tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 51587] New: Implement status and uptime commands
Date Fri, 29 Jul 2011 21:39:46 GMT

             Bug #: 51587
           Summary: Implement status and uptime commands
           Product: Tomcat 7
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Catalina
    Classification: Unclassified

In Tomcat HowTo wiki it is mentioned that it would be nice to have "status" and
"uptime" commands in Tomcat. [1]


My thoughts on implementing it are the following:

1. Create a Listener class "TomcatStatusListener" and add it to server.xml.

2. The class will implement a non-daemon waiting loop, like the one implemented
in StandardServer.await.  One of issues in StandardServer.await is that it
starts listening on a port only after Tomcat startup completes. If it fails to
open the port (e.g. another Tomcat instance is running) it shuts down Tomcat,
but I think that it happens too late. (*)
The listener can start listening on the port earlier.

(*) existing workarounds are using CATALINA_PID setting in and configuring o.a.c.s.EXIT_ON_INIT_FAILURE system

3. The control port and shutdown command for the listener can be read from the
StandardServer object.

After that the await behaviour of the server can be disabled by
programmatically changing StandardServer.port to a negative value. I think that
there is some undocumented code for the value of -2 there already,  or we can
add some additional explicit flag to the StandardServer object.

Note, that when shutting down Tomcat the port number is being read from port
attribute on the Server element. The code wouldn't look for the listener
implementations, so there would not be much sense in specifying a different
port on the Listener element.

4. Implement additional commands, "status" and "uptime" in the listener.

The "status" command can print the value of StandardServer.getStateName().

It might be done that the output of the "status" command were enhanceable. E.g.
some structured data (status, uptime, start date) - compare with comment 7 in
bug 49395.

It is up to the other side of control port connection to interpret the value
and print a more human-friendly message. E.g.:

Tomcat Status: STARTED, 13:0:14, 2011-07-30T11:51
Running. Started on July 20, 2011 11:51. Uptime 13 day(s) 0 hour(s) 14

5. If shutdown is implemented by the listener, it would be possible to initiate
shutdown before Tomcat fully starts up.

6. If there is no such listener in server.xml, the behaviour remains the same
as earlier with await loop being run by StandardServer.

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message