diff options
author | Ivan Motsch | 2019-03-15 08:49:45 +0000 |
---|---|---|
committer | Ivan Motsch | 2019-03-22 08:18:31 +0000 |
commit | 7a90f6a02dc573a5fbc55dc8faa56047593f9cc8 (patch) | |
tree | 6cb17bc60ccd42a648dc8ce4e527fa0519089ea2 | |
parent | 4bc9574e0ab299a39e88d77b0762daa3eec8ba67 (diff) | |
download | org.eclipse.scout.rt-features/imotsch/6.1.0.B022-patch.tar.gz org.eclipse.scout.rt-features/imotsch/6.1.0.B022-patch.tar.xz org.eclipse.scout.rt-features/imotsch/6.1.0.B022-patch.zip |
patch 005 - detect and trace http thread self-cancelfeatures/imotsch/6.1.0.B022-patch
4 files changed, 35 insertions, 19 deletions
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 61e64b822b..5fd6433909 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 java.util.concurrent.TimeUnit; 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 @@ public abstract class AbstractForm extends AbstractPropertyObserver implements I 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 @@ public abstract class AbstractForm extends AbstractPropertyObserver implements I } // 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 @@ public abstract class AbstractForm extends AbstractPropertyObserver implements I } 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 fbb0b76b2f..787a75b381 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 class ThreadInterruptUtil { } 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 a67d41861a..07d392ee06 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.UriUtility; 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 @@ public class HttpServiceTunnel extends AbstractServiceTunnel { } 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 bdd1a4b3a2..2bf18329cd 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 class UiSession implements IUiSession { 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); |