Bug 58827 - Review/remove references to JSR77 StateManageable
Summary: Review/remove references to JSR77 StateManageable
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 9
Classification: Unclassified
Component: Catalina (show other bugs)
Version: unspecified
Hardware: PC All
: P2 minor (vote)
Target Milestone: -----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-08 15:05 UTC by Konstantin Kolinko
Modified: 2016-02-02 00:33 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Kolinko 2016-01-08 15:05:49 UTC
Inspired by a recent javadoc fix commit r1723681.

     /**
-     * Support for "stateManageable" JSR77
+     * @return support for "stateManageable" JSR77
      */
     public boolean isStateManageable() {
         return true;

     /**
-     * JSR 77. Always return false.
+     * @return JSR 77. Always return <code>false</code>.
      */
     public boolean isStateManageable() {
         return false;
     }

The above methods are implemented by StandardContext and StandardWrapper respectively.

JSR77:
https://jcp.org/en/jsr/detail?id=77

I have not read JSR77 in detail, just a quick review.

 reviewed ch.77.5 State Management

A StateManageable object is defined as implementing the following properties:

state: int
startTime: long

methods:

start()
startRecursive()
stop()

and sending events when a state changes.

The state is defined as 5 states coded by integer values,
0 STARTING
1 RUNNING
2 STOPPING
3 STOPPED
4 FAILED

Actual implementation in Tomcat:

StandardWrapper: - Tomcat 6
========================

    public boolean isEventProvider() {
        return false;
    }
   
    public boolean isStateManageable() {
        return false;
    }
   
    public boolean isStatisticsProvider() {
        return false;
    }

The "eventProvider", "stateManageable", "statisticsProvider" properties exposed to JMX.

The methods start(), stop() are implemented, but are our internal methods -- they are not exposed to JMX.

There is no implementation of getState(), getStartTime(), startRecursive().

StandardWrapper - Tomcat 7
=======
The "eventProvider", "stateManageable", "statisticsProvider" properties exposed to JMX.

Methods isEventProvider(), isStatisticsProvider() are declared as deprecated.

StandardWrapper - Tomcat 8, 9
=======
"stateManageable" is exposed to JMX.

Methods isEventProvider(), isStatisticsProvider() and their JMX properties removed.

StandardContext - Tomcat 6
============
StandardContext implements all the above properties / methods, although "startRecursive" is not exposed to JMX.

[[[
    public int getState() {
        if( started ) {
            return 1; // RUNNING
        }
        if( initialized ) {
            return 0; // starting ?
        }
        if( ! available ) {
            return 4; //FAILED
        }
        // 2 - STOPPING
        return 3; // STOPPED
    }
]]]

StandardContext - Tomcat 7
============
Lifecycle was redefined, the getState() method is defined in Lifecycle interface and now returns a LifecycleState
The "state" property is no longer exposed to JMX.

startRecursive(), isEventProvider(), isStatisticsProvider() methods deprecated. 

StandardContext - Tomcat 7/9
============
isStateManageable()/start()/stop()/getStartTime() are OK.
Deprecated methods are removed.
Comment 1 Konstantin Kolinko 2016-01-08 15:15:54 UTC
Thoughts
=========
1. It may still be possible to support that StateManageable "interface"  -- I think with a custom MBean modeler object that will provide that "state" property, -- but I do not see much point.

Nobody complained since removal of "state" property in Tomcat 7.


2. isStateManageable() can be safely removed from StandardWrapper.

The wrapper did not expose its start/stop methods via JMX, nor the "state" property.


3. isStateManageable() in StandardContext

I think it is OK to keep it,
but update a comment to say that we do not really implement JSR 77.
Comment 2 Mark Thomas 2016-01-12 21:40:37 UTC
My initial reaction was to say fix the JSR77 implementation.

However, having seen that this was broken back in Tomcat 7 and that no-one has complained, my preference would be to mark anything JSR77 related deprecated in 8.0.x and remove it entirely in 9.0.x.
Comment 3 Mark Thomas 2016-02-01 11:11:55 UTC
The remains of the JSR-77 implementation have been removed from 9.0.x.
Comment 4 Mark Thomas 2016-02-02 00:33:06 UTC
And deprecated in 8.0.x for 8.0.32 onwards.