Skip to content

Commit

Permalink
Fix concurrency issues
Browse files Browse the repository at this point in the history
  • Loading branch information
fluorumlabs committed Oct 18, 2018
1 parent d26d70e commit eb3c850
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ to pool size of 25 threads. You can change that with `AsyncManager.getInstance()
<dependency>
<groupId>org.vaadin.helper</groupId>
<artifactId>async-manager</artifactId>
<version>1.0.0-alpha2</version>
<version>1.0.0-alpha3</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.vaadin.helper</groupId>
<artifactId>async-manager</artifactId>
<version>1.0.0-alpha2</version>
<version>1.0.0-alpha3</version>
<name>Async Manager</name>
<description>Async Manager for Vaadin Flow</description>

Expand Down
7 changes: 6 additions & 1 deletion src/main/java/org/vaadin/flow/helper/AsyncTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ private void add() {
/**
* Remove current task from {@link AsyncManager#asyncTasks} and unregister all listeners
*/
private synchronized void remove() {
private void remove() {
if (parentUI != null) {
asyncManager.removeAsyncTask(parentUI, this);
// Polling interval needs to be adjusted if task is finished
Expand All @@ -205,6 +205,11 @@ private synchronized void remove() {
if (uiDetachListenerRegistration != null) uiDetachListenerRegistration.remove();
if (pollingListenerRegistration != null) pollingListenerRegistration.remove();
if (beforeLeaveListenerRegistration != null) beforeLeaveListenerRegistration.remove();

componentDetachListenerRegistration = null;
uiDetachListenerRegistration = null;
pollingListenerRegistration = null;
beforeLeaveListenerRegistration = null;
});
} catch (UIDetachedException ignore) {
// ignore detached ui -- there will be no polling events for them anyway
Expand Down

0 comments on commit eb3c850

Please sign in to comment.