KNOX-890 - Make IdleTimeout Configurable in Knox Gateway Server (make default 5 mins)
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/config/impl/GatewayConfigImpl.java b/gateway-server/src/main/java/org/apache/hadoop/gateway/config/impl/GatewayConfigImpl.java
index 6bc75a9..65ba8ea 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/config/impl/GatewayConfigImpl.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/config/impl/GatewayConfigImpl.java
@@ -639,7 +639,7 @@
@Override
public long getGatewayIdleTimeout() {
- return getLong(GATEWAY_IDLE_TIMEOUT, 0l);
+ return getLong(GATEWAY_IDLE_TIMEOUT, 300000l);
}
@Override
diff --git a/gateway-server/src/test/java/org/apache/hadoop/gateway/config/impl/GatewayConfigImplTest.java b/gateway-server/src/test/java/org/apache/hadoop/gateway/config/impl/GatewayConfigImplTest.java
index 9cf7a39..24b45b1 100644
--- a/gateway-server/src/test/java/org/apache/hadoop/gateway/config/impl/GatewayConfigImplTest.java
+++ b/gateway-server/src/test/java/org/apache/hadoop/gateway/config/impl/GatewayConfigImplTest.java
@@ -191,4 +191,17 @@
assertThat(config.getGraphitePort(), is(32772));
}
+ @Test( timeout = TestUtils.SHORT_TIMEOUT )
+ public void testGatewayIdleTimeout() {
+ GatewayConfigImpl config = new GatewayConfigImpl();
+ long idleTimeout = 0l;
+
+ idleTimeout = config.getGatewayIdleTimeout();
+ assertThat( idleTimeout, is(300000L));
+
+ config.set( GatewayConfigImpl.GATEWAY_IDLE_TIMEOUT, "15000" );
+ idleTimeout = config.getGatewayIdleTimeout();
+ assertThat( idleTimeout, is(15000L));
+ }
+
}