Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
Description
LocalStreamBuilder supports a default execution even when streamConfig is empty/null
StreamBuilder builder = new LocalStreamBuilder(100);
streams-monitoring throws an exception and does not run when no config is supplied.
00:31:21.762 [main] ERROR o.a.s.m.tasks.BroadcastMonitorThread - Exception while trying to set default broadcast thread wait time: {}
java.lang.NullPointerException: null
at org.apache.streams.monitoring.tasks.BroadcastMonitorThread.setWaitTime(BroadcastMonitorThread.java:144) [classes/:na]
at org.apache.streams.monitoring.tasks.BroadcastMonitorThread.<init>(BroadcastMonitorThread.java:58) [classes/:na]
at org.apache.streams.local.builders.LocalStreamBuilder.<init>(LocalStreamBuilder.java:114) [classes/:na]
at org.apache.streams.local.builders.LocalStreamBuilder.<init>(LocalStreamBuilder.java:89) [classes/:na]
at org.apache.streams.twitter.example.TwitterUserstreamConsole.main(TwitterUserstreamConsole.java:49) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_20]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_20]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_20]
at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_20]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) [idea_rt.jar:na]
00:31:21.773 [main] DEBUG o.a.s.l.builders.LocalStreamBuilder - Attaching shutdown handler
The workaround is to supply a config like this:
Map<String, Object> streamConfig = Maps.newHashMap();
streamConfig.put(LocalStreamBuilder.TIMEOUT_KEY, 20 * 60 * 1000);
streamConfig.put("monitoring_broadcast_interval_ms", -1);
StreamBuilder builder = new LocalStreamBuilder(100, streamConfig);
But that should not be necessary.
Establish documented defaults for this capability, ensure no exceptions occur in the default state, and do not require explicit action by the implementation to use the default.