ARTEMIS-892 - add lock to tick method
https://issues.apache.org/jira/browse/ARTEMIS-892
This commit is contained in:
parent
db6ee74a33
commit
198143edd0
|
@ -91,22 +91,24 @@ public class ProtonHandler extends ProtonInitializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public long tick(boolean firstTick) {
|
public long tick(boolean firstTick) {
|
||||||
if (!firstTick) {
|
synchronized (lock) {
|
||||||
try {
|
if (!firstTick) {
|
||||||
if (connection.getLocalState() != EndpointState.CLOSED) {
|
try {
|
||||||
long rescheduleAt = transport.tick(TimeUnit.NANOSECONDS.toMillis(System.nanoTime()));
|
if (connection.getLocalState() != EndpointState.CLOSED) {
|
||||||
if (transport.isClosed()) {
|
long rescheduleAt = transport.tick(TimeUnit.NANOSECONDS.toMillis(System.nanoTime()));
|
||||||
throw new IllegalStateException("Channel was inactive for to long");
|
if (transport.isClosed()) {
|
||||||
|
throw new IllegalStateException("Channel was inactive for to long");
|
||||||
|
}
|
||||||
|
return rescheduleAt;
|
||||||
}
|
}
|
||||||
return rescheduleAt;
|
} catch (Exception e) {
|
||||||
|
transport.close();
|
||||||
|
connection.setCondition(new ErrorCondition());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
return 0;
|
||||||
transport.close();
|
|
||||||
connection.setCondition(new ErrorCondition());
|
|
||||||
}
|
}
|
||||||
return 0;
|
return transport.tick(TimeUnit.NANOSECONDS.toMillis(System.nanoTime()));
|
||||||
}
|
}
|
||||||
return transport.tick(TimeUnit.NANOSECONDS.toMillis(System.nanoTime()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int capacity() {
|
public int capacity() {
|
||||||
|
|
Loading…
Reference in New Issue