patch 005 - detect and trace http thread self-cancel
diff --git a/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/form/AbstractForm.java b/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/form/AbstractForm.java
index 61e64b8..5fd6433 100644
--- a/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/form/AbstractForm.java
+++ b/org.eclipse.scout.rt.client/src/main/java/org/eclipse/scout/rt/client/ui/form/AbstractForm.java
@@ -37,7 +37,6 @@
import org.eclipse.scout.rt.client.ModelContextProxy;
import org.eclipse.scout.rt.client.ModelContextProxy.ModelContext;
-import org.eclipse.scout.rt.client.context.ClientRunContext;
import org.eclipse.scout.rt.client.context.ClientRunContexts;
import org.eclipse.scout.rt.client.dto.Data;
import org.eclipse.scout.rt.client.dto.FormData;
@@ -197,7 +196,7 @@
private IWrappedFormField m_wrappedFormField;
private ButtonListener m_systemButtonListener;
private String m_classId;
- private ClientRunContext m_initialClientRunContext; // ClientRunContext of the calling context during initialization.
+ private ModelContext m_callingModelContext; // ClientRunContext of the calling context during initialization.
private IFormHandler m_handler; // never null (ensured by setHandler())
private SearchFilter m_searchFilter;
@@ -266,7 +265,7 @@
}
// Remember the initial ClientRunContext to not loose the Form from current calling context.
- m_initialClientRunContext = ClientRunContexts.copyCurrent();
+ m_callingModelContext = ModelContext.copyCurrent();
// Run the initialization on behalf of this Form.
ClientRunContexts.copyCurrent().withForm(this).run(new IRunnable() {
@@ -3077,13 +3076,16 @@
}
protected IDisplayParent resolveDisplayParent() {
- return m_initialClientRunContext.call(new Callable<IDisplayParent>() {
-
- @Override
- public IDisplayParent call() throws Exception {
- return BEANS.get(DisplayParentResolver.class).resolve(AbstractForm.this);
- }
- });
+ return ClientRunContexts.copyCurrent()
+ .withDesktop(m_callingModelContext.getDesktop())
+ .withOutline(m_callingModelContext.getOutline(), false)
+ .withForm(m_callingModelContext.getForm())
+ .call(new Callable<IDisplayParent>() {
+ @Override
+ public IDisplayParent call() throws Exception {
+ return BEANS.get(DisplayParentResolver.class).resolve(AbstractForm.this);
+ }
+ });
}
/**
diff --git a/org.eclipse.scout.rt.platform/src/main/java/org/eclipse/scout/rt/platform/context/ThreadInterruptUtil.java b/org.eclipse.scout.rt.platform/src/main/java/org/eclipse/scout/rt/platform/context/ThreadInterruptUtil.java
index fbb0b76..787a75b 100644
--- a/org.eclipse.scout.rt.platform/src/main/java/org/eclipse/scout/rt/platform/context/ThreadInterruptUtil.java
+++ b/org.eclipse.scout.rt.platform/src/main/java/org/eclipse/scout/rt/platform/context/ThreadInterruptUtil.java
@@ -33,12 +33,25 @@
}
public static void logCancel(Object obj, String method, boolean interrupt, Thread runner) {
- LOG.info("CANCEL {}@{}.{}, interrupt={}, runner={}",
- obj.getClass().getSimpleName(),
- Integer.toHexString(obj.hashCode()),
- method,
- interrupt,
- runner);
+ String curName = Thread.currentThread().getName();
+ String runnerName = runner != null ? runner.getName() : null;
+ if (curName != null && runnerName != null && curName.startsWith("http-") && runnerName.startsWith("http-")) {
+ LOG.info("CANCEL {}@{}.{}, interrupt={}, runner={}",
+ obj.getClass().getSimpleName(),
+ Integer.toHexString(obj.hashCode()),
+ method,
+ interrupt,
+ runner,
+ new Exception("Caller trace"));
+ }
+ else {
+ LOG.info("CANCEL {}@{}.{}, interrupt={}, runner={}",
+ obj.getClass().getSimpleName(),
+ Integer.toHexString(obj.hashCode()),
+ method,
+ interrupt,
+ runner);
+ }
}
public static void logInterrupt(Object obj, String method, Thread thread) {
diff --git a/org.eclipse.scout.rt.shared/src/main/java/org/eclipse/scout/rt/shared/servicetunnel/http/HttpServiceTunnel.java b/org.eclipse.scout.rt.shared/src/main/java/org/eclipse/scout/rt/shared/servicetunnel/http/HttpServiceTunnel.java
index a67d418..07d392e 100644
--- a/org.eclipse.scout.rt.shared/src/main/java/org/eclipse/scout/rt/shared/servicetunnel/http/HttpServiceTunnel.java
+++ b/org.eclipse.scout.rt.shared/src/main/java/org/eclipse/scout/rt/shared/servicetunnel/http/HttpServiceTunnel.java
@@ -30,7 +30,6 @@
import org.eclipse.scout.rt.platform.util.concurrent.FutureCancelledError;
import org.eclipse.scout.rt.platform.util.concurrent.ICancellable;
import org.eclipse.scout.rt.platform.util.concurrent.ThreadInterruptedError;
-import org.eclipse.scout.rt.shared.ScoutTexts;
import org.eclipse.scout.rt.shared.SharedConfigProperties.ServiceTunnelTargetUrlProperty;
import org.eclipse.scout.rt.shared.servicetunnel.AbstractServiceTunnel;
import org.eclipse.scout.rt.shared.servicetunnel.BinaryServiceTunnelContentHandler;
@@ -225,10 +224,10 @@
}
catch (ThreadInterruptedError e) { // NOSONAR
future.cancel(true); // Ensure the monitor to be cancelled once this thread is interrupted to cancel the remote call.
- return new ServiceTunnelResponse(new ThreadInterruptedError(ScoutTexts.get("UserInterrupted"))); // Interruption has precedence over computation result or computation error.
+ return new ServiceTunnelResponse(new ThreadInterruptedError("UserInterrupted")); // Interruption has precedence over computation result or computation error.
}
catch (FutureCancelledError e) { // NOSONAR
- return new ServiceTunnelResponse(new FutureCancelledError(ScoutTexts.get("UserInterrupted"))); // Cancellation has precedence over computation result or computation error.
+ return new ServiceTunnelResponse(new FutureCancelledError("UserInterrupted")); // Cancellation has precedence over computation result or computation error.
}
}
diff --git a/org.eclipse.scout.rt.ui.html/src/main/java/org/eclipse/scout/rt/ui/html/UiSession.java b/org.eclipse.scout.rt.ui.html/src/main/java/org/eclipse/scout/rt/ui/html/UiSession.java
index bdd1a4b..2bf1832 100644
--- a/org.eclipse.scout.rt.ui.html/src/main/java/org/eclipse/scout/rt/ui/html/UiSession.java
+++ b/org.eclipse.scout.rt.ui.html/src/main/java/org/eclipse/scout/rt/ui/html/UiSession.java
@@ -913,6 +913,8 @@
public void logout() {
LOG.info("Logging out from UI session with ID {} [clientSessionId={}, processingJsonRequest={}]", m_uiSessionId, getClientSessionId(), isProcessingJsonRequest());
+ ThreadInterruptUtil.detectAndClearThreadInterruption(this, "logout");
+
// Redirect client to "you are now logged out" screen
if (isProcessingJsonRequest()) {
boolean platformValid = (Platform.get() != null && Platform.get().getState() == IPlatform.State.PlatformStarted);