ARTEMIS-1069 Artemis unsafe usage on Eventls polling

This commit is contained in:
Clebert Suconic 2017-03-27 11:41:20 -04:00
parent 07f7916ed3
commit af0be518e1
2 changed files with 4 additions and 22 deletions

View File

@ -143,10 +143,6 @@ public class AMQPConnectionContext extends ProtonInitializable {
handler.flush(); handler.flush();
} }
public void flush(boolean wait) {
handler.flush(wait);
}
public void close(ErrorCondition errorCondition) { public void close(ErrorCondition errorCondition) {
handler.close(errorCondition); handler.close(errorCondition);
} }

View File

@ -56,12 +56,7 @@ public class ProtonHandler extends ProtonInitializable {
private final Executor dispatchExecutor; private final Executor dispatchExecutor;
private final Runnable dispatchRunnable = new Runnable() { private final Runnable dispatchRunnable = () -> dispatch();
@Override
public void run() {
dispatch();
}
};
private ArrayList<EventHandler> handlers = new ArrayList<>(); private ArrayList<EventHandler> handlers = new ArrayList<>();
@ -251,23 +246,13 @@ public class ProtonHandler extends ProtonInitializable {
} }
public void flush() { public void flush() {
flush(false);
}
public void flush(boolean wait) {
synchronized (lock) { synchronized (lock) {
transport.process(); transport.process();
checkServerSASL(); checkServerSASL();
} }
if (wait) {
dispatch();
} else {
dispatchExecutor.execute(dispatchRunnable); dispatchExecutor.execute(dispatchRunnable);
} }
}
public void close(ErrorCondition errorCondition) { public void close(ErrorCondition errorCondition) {
synchronized (lock) { synchronized (lock) {
@ -276,7 +261,8 @@ public class ProtonHandler extends ProtonInitializable {
} }
connection.close(); connection.close();
} }
flush(true);
flush();
} }
protected void checkServerSASL() { protected void checkServerSASL() {