Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 203819 Details for
Bug 353891
[UICallback] Selecting cancel on ProgressDialog does not close dialog
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Draft patch
uicallback.patch (text/plain), 10.32 KB, created by
RĂ¼diger Herrmann
on 2011-09-22 03:47:42 EDT
(
hide
)
Description:
Draft patch
Filename:
MIME Type:
Creator:
RĂ¼diger Herrmann
Created:
2011-09-22 03:47:42 EDT
Size:
10.32 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rap.rwt >Index: src/org/eclipse/rwt/internal/uicallback/UICallBackManager.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/uicallback/UICallBackManager.java,v >retrieving revision 1.9 >diff -u -r1.9 UICallBackManager.java >--- src/org/eclipse/rwt/internal/uicallback/UICallBackManager.java 24 Jul 2011 15:18:01 -0000 1.9 >+++ src/org/eclipse/rwt/internal/uicallback/UICallBackManager.java 22 Sep 2011 07:46:10 -0000 >@@ -68,14 +68,21 @@ > public void wakeClient() { > synchronized( lock ) { > if( !uiThreadRunning ) { >+ wakeCalled = true; > releaseBlockedRequest(); > } > } > } >+ >+ public void forceWakeClient() { >+ synchronized( lock ) { >+ wakeCalled = true; >+ releaseBlockedRequest(); >+ } >+ } > > public void releaseBlockedRequest() { > synchronized( lock ) { >- wakeCalled = true; > lock.notifyAll(); > } > } >@@ -125,6 +132,10 @@ > return hasRunnables; > } > } >+ >+ boolean wasWakeCalled() { >+ return wakeCalled; >+ } > > boolean processRequest( HttpServletResponse response ) { > boolean result = true; >@@ -132,13 +143,12 @@ > if( isCallBackRequestBlocked() ) { > releaseBlockedRequest(); > } >- if( mustBlockCallBackRequest() ) { >+ if( wakeCalled || mustBlockCallBackRequest() ) { > long requestStartTime = System.currentTimeMillis(); > callBackRequestTracker.activate( Thread.currentThread() ); > SessionTerminationListener listener = attachSessionTerminationListener(); > try { > boolean canRelease = false; >- wakeCalled = false; > while( !wakeCalled && !canRelease ) { > lock.wait( requestCheckInterval ); > canRelease = canReleaseBlockedRequest( response, requestStartTime ); >@@ -153,15 +163,14 @@ > } finally { > listener.detach(); > callBackRequestTracker.deactivate( Thread.currentThread() ); >+ wakeCalled = false; > } > } > } > return result; > } > >- private boolean canReleaseBlockedRequest( HttpServletResponse response, >- long requestStartTime ) >- { >+ private boolean canReleaseBlockedRequest( HttpServletResponse response, long requestStartTime ) { > boolean result = false; > if( !mustBlockCallBackRequest() ) { > result = true; >@@ -199,7 +208,7 @@ > return result; > } > >- private boolean isSessionExpired( long requestStartTime ) { >+ private static boolean isSessionExpired( long requestStartTime ) { > return isSessionExpired( requestStartTime, System.currentTimeMillis() ); > } > >Index: src/org/eclipse/rwt/internal/uicallback/UICallBackServiceHandler.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/uicallback/UICallBackServiceHandler.java,v >retrieving revision 1.7 >diff -u -r1.7 UICallBackServiceHandler.java >--- src/org/eclipse/rwt/internal/uicallback/UICallBackServiceHandler.java 22 Sep 2011 07:43:15 -0000 1.7 >+++ src/org/eclipse/rwt/internal/uicallback/UICallBackServiceHandler.java 22 Sep 2011 07:46:10 -0000 >@@ -58,7 +58,8 @@ > } > > static void writeUIRequestNeeded( JavaScriptResponseWriter writer ) { >- if( UICallBackManager.getInstance().hasRunnables() ) { >+ UICallBackManager uiCallBackManager = UICallBackManager.getInstance(); >+ if( uiCallBackManager.hasRunnables() || uiCallBackManager.wasWakeCalled() ) { > writer.write( JS_SEND_UI_REQUEST ); > } > } >Index: src/org/eclipse/swt/widgets/Display.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/Display.java,v >retrieving revision 1.141 >diff -u -r1.141 Display.java >--- src/org/eclipse/swt/widgets/Display.java 19 Sep 2011 11:25:53 -0000 1.141 >+++ src/org/eclipse/swt/widgets/Display.java 22 Sep 2011 07:46:11 -0000 >@@ -1196,7 +1196,7 @@ > if( thread != Thread.currentThread() ) { > UICallBack.runNonUIThreadWithFakeContext( this, new Runnable() { > public void run() { >- UICallBackManager.getInstance().releaseBlockedRequest(); >+ UICallBackManager.getInstance().forceWakeClient(); > } > } ); > } >#P org.eclipse.rap.rwt.test >Index: src/org/eclipse/rwt/internal/uicallback/UICallBackManager_Test.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt.test/org.eclipse.rap.rwt.test/src/org/eclipse/rwt/internal/uicallback/UICallBackManager_Test.java,v >retrieving revision 1.10 >diff -u -r1.10 UICallBackManager_Test.java >--- src/org/eclipse/rwt/internal/uicallback/UICallBackManager_Test.java 19 Sep 2011 20:28:58 -0000 1.10 >+++ src/org/eclipse/rwt/internal/uicallback/UICallBackManager_Test.java 22 Sep 2011 07:46:12 -0000 >@@ -110,11 +110,22 @@ > assertFalse( manager.isCallBackRequestBlocked() ); > assertFalse( thread.isAlive() ); > } >+ >+ public void testWakeWithoutPendingUICallbackReleasesNextUICallback() throws Exception { >+ Throwable[] uiCallBackServiceHandlerThrowable = { null }; >+ ServiceContext context = ContextProvider.getContext(); > >+ manager.forceWakeClient(); >+ simulateUiCallBackRequest( uiCallBackServiceHandlerThrowable, context ); >+ >+ assertNull( uiCallBackServiceHandlerThrowable[ 0 ] ); >+ assertFalse( manager.isCallBackRequestBlocked() ); >+ } >+ > public void testWaitOnUIThread() throws Exception { > final Throwable[] uiCallBackServiceHandlerThrowable = { null }; > ServiceContext context = ContextProvider.getContext(); >- simulateUiCallBackThread( uiCallBackServiceHandlerThrowable, context ); >+ simulateUiCallBackRequest( uiCallBackServiceHandlerThrowable, context ); > assertNull( uiCallBackServiceHandlerThrowable[ 0 ] ); > display.wake(); > assertTrue( manager.isCallBackRequestBlocked() ); >@@ -124,7 +135,7 @@ > public void testWaitOnBackgroundThread() throws Throwable { > final Throwable[] uiCallBackServiceHandlerThrowable = { null }; > ServiceContext context = ContextProvider.getContext(); >- simulateUiCallBackThread( uiCallBackServiceHandlerThrowable, context ); >+ simulateUiCallBackRequest( uiCallBackServiceHandlerThrowable, context ); > assertNull( uiCallBackServiceHandlerThrowable[ 0 ] ); > assertTrue( manager.isCallBackRequestBlocked() ); > Runnable runnable = new Runnable() { >@@ -141,7 +152,7 @@ > public void testWaitOnBackgroundThread_DuringLifecycle() throws Exception { > final Throwable[] uiCallBackServiceHandlerThrowable = { null }; > ServiceContext context = ContextProvider.getContext(); >- simulateUiCallBackThread( uiCallBackServiceHandlerThrowable, context ); >+ simulateUiCallBackRequest( uiCallBackServiceHandlerThrowable, context ); > assertNull( uiCallBackServiceHandlerThrowable[ 0 ] ); > assertTrue( manager.isCallBackRequestBlocked() ); > Thread thread = new Thread( new Runnable() { >@@ -185,7 +196,7 @@ > public void testCallBackRequestBlocking() throws Exception { > final Throwable[] uiCallBackServiceHandlerThrowable = { null }; > ServiceContext context = ContextProvider.getContext(); >- simulateUiCallBackThread( uiCallBackServiceHandlerThrowable, context ); >+ simulateUiCallBackRequest( uiCallBackServiceHandlerThrowable, context ); > assertNull( uiCallBackServiceHandlerThrowable[ 0 ] ); > assertTrue( manager.isCallBackRequestBlocked() ); > } >@@ -194,7 +205,7 @@ > final Throwable[] uiCallBackServiceHandlerThrowable = { null }; > ServiceContext context = ContextProvider.getContext(); > Thread uiCallBackThread >- = simulateUiCallBackThread( uiCallBackServiceHandlerThrowable, context ); >+ = simulateUiCallBackRequest( uiCallBackServiceHandlerThrowable, context ); > simulateBackgroundAddition( context ); > assertFalse( manager.isCallBackRequestBlocked() ); > assertFalse( uiCallBackThread.isAlive() ); >@@ -204,7 +215,7 @@ > public void testCallBackRequestIsReleasedOnSessionInvalidate() throws Exception { > Throwable[] uiCallBackHandlerThrowable = { null }; > ServiceContext context = ContextProvider.getContext(); >- Thread uiCallBackThread = simulateUiCallBackThread( uiCallBackHandlerThrowable, context ); >+ Thread uiCallBackThread = simulateUiCallBackRequest( uiCallBackHandlerThrowable, context ); > > context.getSessionStore().getHttpSession().invalidate(); > uiCallBackThread.join(); >@@ -233,10 +244,10 @@ > manager.setRequestCheckInterval( 20 ); > ServiceContext context1 = ContextProvider.getContext(); > Throwable[] uiCallBackHandlerThrowable1 = { null }; >- Thread uiCallBackThread1 = simulateUiCallBackThread( uiCallBackHandlerThrowable1, context1 ); >+ Thread uiCallBackThread1 = simulateUiCallBackRequest( uiCallBackHandlerThrowable1, context1 ); > ServiceContext context2 = createServiceContext( context1.getSessionStore().getHttpSession() ); > Throwable[] uiCallBackHandlerThrowable2 = { null }; >- Thread uiCallBackThread2 = simulateUiCallBackThread( uiCallBackHandlerThrowable2, context2 ); >+ Thread uiCallBackThread2 = simulateUiCallBackRequest( uiCallBackHandlerThrowable2, context2 ); > > Thread.sleep( SLEEP_TIME ); > >@@ -261,7 +272,7 @@ > }; > ServiceContext context2 = createServiceContext( httpSession, response ); > Throwable[] uiCallBackHandlerThrowable = { null }; >- Thread uiCallBackThread = simulateUiCallBackThread( uiCallBackHandlerThrowable, context2 ); >+ Thread uiCallBackThread = simulateUiCallBackRequest( uiCallBackHandlerThrowable, context2 ); > > Thread.sleep( SLEEP_TIME ); > >@@ -275,7 +286,7 @@ > ServiceContext context = ContextProvider.getContext(); > // test runnables addition while no uiCallBack thread is not blocked > Thread uiCallBackThread >- = simulateUiCallBackThread( uiCallBackServiceHandlerThrowable, context ); >+ = simulateUiCallBackRequest( uiCallBackServiceHandlerThrowable, context ); > manager.notifyUIThreadEnd(); > simulateBackgroundAddition( context ); > fakeRequestParam( display ); >@@ -564,7 +575,7 @@ > } > } > >- private Thread simulateUiCallBackThread( >+ private Thread simulateUiCallBackRequest( > final Throwable[] uiCallBackServiceHandlerThrowable, > final ServiceContext context ) > throws InterruptedException
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 353891
:
203819
|
203996