Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue-1600 add thread-safe protection to inputManager #1604

Merged
merged 9 commits into from
Jan 6, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,18 @@ public InputManager(SiddhiAppContext siddhiAppContext,
public InputHandler getInputHandler(String streamId) {
InputHandler inputHandler = inputHandlerMap.get(streamId);
if (inputHandler == null) {
InputHandler newInputHandler = constructInputHandler(streamId);
if (this.isConnected) {
newInputHandler.connect();
synchronized (this) {
inputHandler = inputHandlerMap.get(streamId);
if (inputHandler == null) {
InputHandler newInputHandler = constructInputHandler(streamId);
if (this.isConnected) {
newInputHandler.connect();
}
return newInputHandler;
} else {
return inputHandler;
}
}
return newInputHandler;
} else {
return inputHandler;
}
Expand All @@ -78,7 +85,7 @@ public synchronized void disconnect() {
this.isConnected = false;
}

public InputHandler constructInputHandler(String streamId) {
public synchronized InputHandler constructInputHandler(String streamId) {
InputHandler inputHandler = new InputHandler(streamId, inputHandlerMap.size(),
inputEntryValve, siddhiAppContext);
StreamJunction streamJunction = streamJunctionMap.get(streamId);
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@
<guava.bundle.version>23.0.0</guava.bundle.version>
<gson.version>2.8.5</gson.version>
<commons-lang3.version>3.9</commons-lang3.version>
<classindex.version>3.8</classindex.version>
<classindex.version>3.9</classindex.version>
<quartz.version>2.1.1.wso2v1</quartz.version>
<org.osgi.core.version>6.0.0</org.osgi.core.version>
<org.osgi.core.bundle.version>6.0.0.201403061837</org.osgi.core.bundle.version>
Expand Down Expand Up @@ -797,7 +797,7 @@
<maven.scm.plugin.version>1.11.2</maven.scm.plugin.version>
<maven.scm.publish.plugin.version>3.0.0</maven.scm.publish.plugin.version>
<maven.site.plugin.version>3.8.2</maven.site.plugin.version>
<maven.source.plugin.version>3.2.0</maven.source.plugin.version>
<maven.source.plugin.version>3.2.1</maven.source.plugin.version>
<apache.rat.plugin.version>0.13</apache.rat.plugin.version>
<maven.scr.plugin.version>1.26.4</maven.scr.plugin.version>

Expand Down