# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: /Users/oleksiys/Projects/Glassfish/v3/core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/monitor # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: MonitorableEmbeddedHttp.java --- MonitorableEmbeddedHttp.java Base (BASE) +++ MonitorableEmbeddedHttp.java Locally Modified (Based On LOCAL) @@ -62,6 +62,8 @@ super(grizzlyServiceListener); this.monitoring = monitoring; this.listenerName = listenerName; + + keepAliveStats = createKeepAliveStats(); } @Override Index: MonitorableEmbeddedHttps.java --- MonitorableEmbeddedHttps.java Base (BASE) +++ MonitorableEmbeddedHttps.java Locally Modified (Based On LOCAL) @@ -61,6 +61,8 @@ super(grizzlyServiceListener); this.monitoring = monitoring; this.listenerName = listenerName; + + keepAliveStats = createKeepAliveStats(); } @Override Index: MonitorableKeepAliveStats.java --- MonitorableKeepAliveStats.java Base (BASE) +++ MonitorableKeepAliveStats.java Locally Modified (Based On LOCAL) @@ -51,7 +51,13 @@ public MonitorableKeepAliveStats(GrizzlyMonitoring grizzlyMonitoring, String listenerName) { this.grizzlyMonitoring = grizzlyMonitoring; this.listenerName = listenerName; + + if (grizzlyMonitoring != null) { + // Set initial monitoring values + setMaxKeepAliveRequests(getMaxKeepAliveRequests()); + setKeepAliveTimeoutInSeconds(getKeepAliveTimeoutInSeconds()); } + } @Override public boolean isEnabled() { @@ -59,6 +65,18 @@ } @Override + public void setMaxKeepAliveRequests(int maxKeepAliveRequests) { + super.setMaxKeepAliveRequests(maxKeepAliveRequests); + grizzlyMonitoring.getKeepAliveProbeProvider().setMaxCountRequestsEvent(listenerName, maxKeepAliveRequests); + } + + @Override + public void setKeepAliveTimeoutInSeconds(int timeout) { + super.setKeepAliveTimeoutInSeconds(timeout); + grizzlyMonitoring.getKeepAliveProbeProvider().setTimeoutInSecondsEvent(listenerName, timeout); + } + + @Override public void incrementCountConnections() { // super.incrementCountConnections(); grizzlyMonitoring.getKeepAliveProbeProvider().incrementCountConnectionsEvent(listenerName); Index: probes/KeepAliveProbeProvider.java --- probes/KeepAliveProbeProvider.java Base (BASE) +++ probes/KeepAliveProbeProvider.java Locally Modified (Based On LOCAL) @@ -47,21 +47,37 @@ */ @ProbeProvider (moduleProviderName="glassfish", moduleName="kernel", probeProviderName="connections-keep-alive") public class KeepAliveProbeProvider { + @Probe(name="setMaxCountRequestsEvent") + public void setMaxCountRequestsEvent( + @ProbeParam("listenerName") String listenerName, + @ProbeParam("maxRequests") int max) {} + + @Probe(name="setTimeoutInSecondsEvent") + public void setTimeoutInSecondsEvent( + @ProbeParam("listenerName") String listenerName, + @ProbeParam("timeoutInSeconds") int timeoutInSeconds) {} + @Probe(name="incrementCountConnectionsEvent") - public void incrementCountConnectionsEvent(@ProbeParam("listenerName") String listenerName) {} + public void incrementCountConnectionsEvent( + @ProbeParam("listenerName") String listenerName) {} @Probe(name="decrementCountConnectionsEvent") - public void decrementCountConnectionsEvent(@ProbeParam("listenerName") String listenerName) {} + public void decrementCountConnectionsEvent( + @ProbeParam("listenerName") String listenerName) {} @Probe(name="incrementCountFlushesEvent") - public void incrementCountFlushesEvent(@ProbeParam("listenerName") String listenerName) {} + public void incrementCountFlushesEvent( + @ProbeParam("listenerName") String listenerName) {} @Probe(name="incrementCountHitsEvent") - public void incrementCountHitsEvent(@ProbeParam("listenerName") String listenerName) {} + public void incrementCountHitsEvent( + @ProbeParam("listenerName") String listenerName) {} @Probe(name="incrementCountRefusalsEvent") - public void incrementCountRefusalsEvent(@ProbeParam("listenerName") String listenerName) {} + public void incrementCountRefusalsEvent( + @ProbeParam("listenerName") String listenerName) {} @Probe(name="incrementCountTimeoutsEvent") - public void incrementCountTimeoutsEvent(@ProbeParam("listenerName") String listenerName) {} + public void incrementCountTimeoutsEvent( + @ProbeParam("listenerName") String listenerName) {} } Index: stats/KeepAliveStatsProvider.java --- stats/KeepAliveStatsProvider.java Base (BASE) +++ stats/KeepAliveStatsProvider.java Locally Modified (Based On LOCAL) @@ -55,47 +55,78 @@ public class KeepAliveStatsProvider { private final String name; - private final CountStatisticImpl keepAliveConnectionsCount = new CountStatisticImpl("KeepAliveConnectionsCount", "count", "Number of connections in keep-alive mode"); - private final CountStatisticImpl flushesCount = new CountStatisticImpl("FlushesCount", "count", "Number of keep-alive connections that were closed"); - private final CountStatisticImpl hitsCount = new CountStatisticImpl("HitsCount", "count", "Number of requests received by connections in keep-alive mode"); - private final CountStatisticImpl refusalsCount = new CountStatisticImpl("RefusalsCount", "count", "Number of keep-alive connections that were rejected"); - private final CountStatisticImpl timeoutsCount = new CountStatisticImpl("TimeoutsCount", "count", "Number of keep-alive connections that timed out"); + private final CountStatisticImpl maxRequestsCount = new CountStatisticImpl("MaxRequests", "count", "Maximum number of requests allowed on a single keep-alive connection"); + private final CountStatisticImpl timeoutInSeconds = new CountStatisticImpl("SecondsTimeouts", "seconds", "Keep-alive timeout value in seconds"); + private final CountStatisticImpl keepAliveConnectionsCount = new CountStatisticImpl("CountConnections", "count", "Number of connections in keep-alive mode"); + private final CountStatisticImpl flushesCount = new CountStatisticImpl("CountFlushes", "count", "Number of keep-alive connections that were closed"); + private final CountStatisticImpl hitsCount = new CountStatisticImpl("CountHits", "count", "Number of requests received by connections in keep-alive mode"); + private final CountStatisticImpl refusalsCount = new CountStatisticImpl("CountRefusals", "count", "Number of keep-alive connections that were rejected"); + private final CountStatisticImpl timeoutsCount = new CountStatisticImpl("CountTimeouts", "count", "Number of keep-alive connections that timed out"); public KeepAliveStatsProvider(String name) { this.name = name; } - @ManagedAttribute(id = "keepaliveconnections") + @ManagedAttribute(id = "maxrequests") + @Description("Maximum number of requests allowed on a single keep-alive connection") + public CountStatistic getMaxKeepAliveRequestsCount() { + return maxRequestsCount; + } + + @ManagedAttribute(id = "secondstimeouts") + @Description("Keep-alive timeout value in seconds") + public CountStatistic getKeepAliveTimeoutInSeconds() { + return timeoutInSeconds; + } + + @ManagedAttribute(id = "countconnections") @Description("Number of connections in keep-alive mode") public CountStatistic getKeepAliveConnectionsCount() { return keepAliveConnectionsCount; } - @ManagedAttribute(id = "flushes") + @ManagedAttribute(id = "countflushes") @Description("Number of keep-alive connections that were closed") public CountStatistic getFlushesCount() { return flushesCount; } - @ManagedAttribute(id = "hits") + @ManagedAttribute(id = "counthits") @Description("Number of requests received by connections in keep-alive mode") public CountStatistic getHitsCount() { return hitsCount; } - @ManagedAttribute(id = "refusals") + @ManagedAttribute(id = "countrefusals") @Description("Number of keep-alive connections that were rejected") public CountStatistic getRefusalsCount() { return refusalsCount; } - @ManagedAttribute(id = "timeouts") + @ManagedAttribute(id = "counttimeouts") @Description("Number of keep-alive connections that timed out") public CountStatistic getTimeoutsCount() { return timeoutsCount; } + @ProbeListener("glassfish:kernel:connections-keep-alive:setMaxCountRequestsEvent") + public void setMaxCountRequestsEvent( + @ProbeParam("listenerName") String listenerName, + @ProbeParam("maxRequests") int max) { + if (name.equals(listenerName)) { + maxRequestsCount.setCount(max); + } + } + @ProbeListener("glassfish:kernel:connections-keep-alive:setTimeoutInSecondsEvent") + public void setTimeoutInSecondsEvent( + @ProbeParam("listenerName") String listenerName, + @ProbeParam("timeoutInSeconds") int timeoutInSeconds) { + if (name.equals(listenerName)) { + this.timeoutInSeconds.setCount(timeoutInSeconds); + } + } + @ProbeListener("glassfish:kernel:connections-keep-alive:incrementCountConnectionsEvent") public void incrementCountConnectionsEvent(@ProbeParam("listenerName") String listenerName) { if (name.equals(listenerName)) {