Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -566,13 +566,6 @@ private int getExpectedServerId() {
}

private void forceMessageHandling() {
// Clear previous request if it exists. Otherwise resyncrhonize can
// trigger
// "Trying to start a new request while another is active" exception and
// fail.
if (registry.getRequestResponseTracker().hasActiveRequest()) {
registry.getRequestResponseTracker().endRequest();
}
if (!responseHandlingLocks.isEmpty()) {
// Lock which was never release -> bug in locker or things just
// too slow
Expand All @@ -588,7 +581,17 @@ private void forceMessageHandling() {
+ " from the server");

}
if (!handlePendingMessages() && !pendingUIDLMessages.isEmpty()) {
boolean needsResynchronize = !handlePendingMessages()
&& !pendingUIDLMessages.isEmpty();
if (needsResynchronize) {
// Clear previous request if it exists. Otherwise resyncrhonize can
// trigger
// "Trying to start a new request while another is active" exception
// and fail.
if (registry.getRequestResponseTracker().hasActiveRequest()) {
registry.getRequestResponseTracker().endRequest(false);
}

// There are messages but the next id was not found, likely it
// has been lost
// Drop pending messages and resynchronize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ public boolean hasActiveRequest() {
* Fires a {@link ResponseHandlingEndedEvent}.
*/
public void endRequest() {
endRequest(true);
}

public void endRequest(boolean allowFlushPendingInvocations) {
if (!hasActiveRequest) {
throw new IllegalStateException(
"endRequest called when no request is active");
Expand All @@ -109,7 +113,8 @@ public void endRequest() {
hasActiveRequest = false;

if (registry.getUILifecycle().isRunning()
&& registry.getServerRpcQueue().isFlushPending()) {
&& registry.getServerRpcQueue().isFlushPending()
&& allowFlushPendingInvocations) {
// Send the pending RPCs immediately.
// This might be an unnecessary optimization as ServerRpcQueue has a
// finally scheduled command which trigger the send if we do not do
Expand Down