Skip to content

Commit 1d1feb1

Browse files
mugdha273fl4via
authored andcommitted
[UNDERTOW-2474]-Create a default constant for UndertowOptions.ENABLE_STATISTICS
1 parent 9d639b9 commit 1d1feb1

File tree

7 files changed

+13
-7
lines changed

7 files changed

+13
-7
lines changed

core/src/main/java/io/undertow/UndertowOptions.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,18 @@ public class UndertowOptions {
249249
*/
250250
public static final Option<Boolean> ENABLE_HTTP2 = Option.simple(UndertowOptions.class, "ENABLE_HTTP2", Boolean.class);
251251

252+
/**
253+
* Default value of {@link #ENABLE_STATISTICS} option.
254+
*/
255+
public static final boolean DEFAULT_ENABLE_STATISTICS = false;
256+
252257
/**
253258
* If connector level statistics should be enabled. This has a slight performance impact, but allows statistics such
254259
* as bytes sent/recevied to be monitored.
255260
*
256261
* If this is passed to the client then client statistics will be enabled.
257-
*
262+
* <p>
263+
* Defaults to {@link #DEFAULT_ENABLE_STATISTICS}
258264
*/
259265
public static final Option<Boolean> ENABLE_STATISTICS = Option.simple(UndertowOptions.class, "ENABLE_STATISTICS", Boolean.class);
260266

core/src/main/java/io/undertow/client/ajp/AjpClientProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ private void handleConnected(StreamConnection connection, ClientCallback<ClientC
113113

114114
final ClientStatisticsImpl clientStatistics;
115115
//first we set up statistics, if required
116-
if (options.get(UndertowOptions.ENABLE_STATISTICS, false)) {
116+
if (options.get(UndertowOptions.ENABLE_STATISTICS, UndertowOptions.DEFAULT_ENABLE_STATISTICS)) {
117117
clientStatistics = new ClientStatisticsImpl();
118118
connection.getSinkChannel().setConduit(new BytesSentStreamSinkConduit(connection.getSinkChannel().getConduit(), new ByteActivityCallback() {
119119
@Override

core/src/main/java/io/undertow/client/http/HttpClientConnection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public void handleEvent(StreamSourceConduit channel) {
150150
HttpClientConnection(final StreamConnection connection, final OptionMap options, final ByteBufferPool bufferPool) {
151151

152152
//first we set up statistics, if required
153-
if(options.get(UndertowOptions.ENABLE_STATISTICS, false)) {
153+
if(options.get(UndertowOptions.ENABLE_STATISTICS, UndertowOptions.DEFAULT_ENABLE_STATISTICS)) {
154154
clientStatistics = new ClientStatisticsImpl();
155155
connection.getSinkChannel().setConduit(new BytesSentStreamSinkConduit(connection.getSinkChannel().getConduit(), new ByteActivityCallback() {
156156
@Override

core/src/main/java/io/undertow/client/http2/Http2ClearClientProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public void handleEvent(StreamConnection channel) {
207207

208208
final ClientStatisticsImpl clientStatistics;
209209
//first we set up statistics, if required
210-
if (options.get(UndertowOptions.ENABLE_STATISTICS, false)) {
210+
if (options.get(UndertowOptions.ENABLE_STATISTICS, UndertowOptions.DEFAULT_ENABLE_STATISTICS)) {
211211
clientStatistics = new ClientStatisticsImpl();
212212
channel.getSinkChannel().setConduit(new BytesSentStreamSinkConduit(channel.getSinkChannel().getConduit(), new ByteActivityCallback() {
213213
@Override

core/src/main/java/io/undertow/client/http2/Http2ClientProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ private static Http2ClientConnection createHttp2Channel(StreamConnection connect
155155

156156
final ClientStatisticsImpl clientStatistics;
157157
//first we set up statistics, if required
158-
if (options.get(UndertowOptions.ENABLE_STATISTICS, false)) {
158+
if (options.get(UndertowOptions.ENABLE_STATISTICS, UndertowOptions.DEFAULT_ENABLE_STATISTICS)) {
159159
clientStatistics = new ClientStatisticsImpl();
160160
connection.getSinkChannel().setConduit(new BytesSentStreamSinkConduit(connection.getSinkChannel().getConduit(), new ByteActivityCallback() {
161161
@Override

core/src/main/java/io/undertow/client/http2/Http2PriorKnowledgeClientProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ private void handleConnected(final StreamConnection connection, final ClientCall
113113

114114
final ClientStatisticsImpl clientStatistics;
115115
//first we set up statistics, if required
116-
if (options.get(UndertowOptions.ENABLE_STATISTICS, false)) {
116+
if (options.get(UndertowOptions.ENABLE_STATISTICS, UndertowOptions.DEFAULT_ENABLE_STATISTICS)) {
117117
clientStatistics = new ClientStatisticsImpl();
118118
connection.getSinkChannel().setConduit(new BytesSentStreamSinkConduit(connection.getSinkChannel().getConduit(), new ByteActivityCallback() {
119119
@Override

core/src/main/java/io/undertow/server/protocol/http2/Http2OpenListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public Http2OpenListener(final ByteBufferPool pool, final OptionMap undertowOpti
109109
this.bufferSize = buf.getBuffer().remaining();
110110
buf.close();
111111
connectorStatistics = new ConnectorStatisticsImpl();
112-
statisticsEnabled = undertowOptions.get(UndertowOptions.ENABLE_STATISTICS, false);
112+
statisticsEnabled = undertowOptions.get(UndertowOptions.ENABLE_STATISTICS, UndertowOptions.DEFAULT_ENABLE_STATISTICS);
113113
this.protocol = protocol;
114114
}
115115

0 commit comments

Comments
 (0)