Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 283596 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/rwt/internal/lifecycle/RWTLifeCycle.java (-9 / +38 lines)
Lines 21-26 Link Here
21
21
22
import org.eclipse.rwt.internal.AdapterFactoryRegistry;
22
import org.eclipse.rwt.internal.AdapterFactoryRegistry;
23
import org.eclipse.rwt.internal.lifecycle.IPhase.IInterruptible;
23
import org.eclipse.rwt.internal.lifecycle.IPhase.IInterruptible;
24
import org.eclipse.rwt.internal.lifecycle.UICallBackManager.RunnableBase;
24
import org.eclipse.rwt.internal.service.*;
25
import org.eclipse.rwt.internal.service.*;
25
import org.eclipse.rwt.internal.util.ParamCheck;
26
import org.eclipse.rwt.internal.util.ParamCheck;
26
import org.eclipse.rwt.lifecycle.*;
27
import org.eclipse.rwt.lifecycle.*;
Lines 110-138 Link Here
110
  private final class UIThreadController implements Runnable {
111
  private final class UIThreadController implements Runnable {
111
    public void run() {
112
    public void run() {
112
      IUIThreadHolder uiThread = ( IUIThreadHolder )Thread.currentThread();
113
      IUIThreadHolder uiThread = ( IUIThreadHolder )Thread.currentThread();
114
      UICallBackManager uiCallbackManager = null;
113
      try {
115
      try {
114
        // TODO [rh] consider taking thread from session attribute
116
        // TODO [rh] consider taking thread from session attribute
115
        synchronized( uiThread.getLock() ) {          
117
        synchronized( uiThread.getLock() ) {
116
          uiThread.updateServiceContext();
118
          uiThread.updateServiceContext();
117
          UICallBackManager.getInstance().notifyUIThreadStart();
119
          uiCallbackManager = UICallBackManager.getInstance();
120
          uiCallbackManager.notifyUIThreadStart();
118
          continueLifeCycle();
121
          continueLifeCycle();
119
          createUI();
122
          createUI();
120
          continueLifeCycle();
123
          continueLifeCycle();
121
          UICallBackManager.getInstance().notifyUIThreadEnd();
124
          uiCallbackManager.notifyUIThreadEnd();
122
          // TODO [rh] preliminary solution: see 
125
          // TODO [rh] preliminary solution: see
123
          //      https://bugs.eclipse.org/bugs/show_bug.cgi?id=219465
126
          // https://bugs.eclipse.org/bugs/show_bug.cgi?id=219465
124
          setShutdownAdapter( null );
127
          setShutdownAdapter( null );
125
        }
128
        }
126
      } catch( final UIThreadTerminatedError e ) {
129
      } catch( final UIThreadTerminatedError e ) {
127
        ( ( ISessionShutdownAdapter )uiThread ).processShutdown();
130
        ( ( ISessionShutdownAdapter )uiThread ).processShutdown();
128
      } catch( final Throwable thr ) {
131
      } catch( final Throwable thr ) {
129
        // TODO [rh] preliminary fix for 
132
        // TODO [rh] preliminary fix for
130
        //      https://bugs.eclipse.org/bugs/show_bug.cgi?id=232289
133
        // https://bugs.eclipse.org/bugs/show_bug.cgi?id=232289
131
        //      For a decent solution, see these ideas
134
        // For a decent solution, see these ideas
132
        //      https://bugs.eclipse.org/bugs/show_bug.cgi?id=219465
135
        // https://bugs.eclipse.org/bugs/show_bug.cgi?id=219465
133
        setShutdownAdapter( null );
136
        setShutdownAdapter( null );
134
        IServiceStateInfo stateInfo = ContextProvider.getStateInfo();
137
        IServiceStateInfo stateInfo = ContextProvider.getStateInfo();
135
        stateInfo.setAttribute( UI_THREAD_THROWABLE, thr );
138
        stateInfo.setAttribute( UI_THREAD_THROWABLE, thr );
139
      } finally {
140
        try {
141
          
142
          // Now that this session is ending, go through all 
143
          // the remaining runnables and give them a chance to run
144
          // They may fail (since we don't have a context anymore), but 
145
          // this will give them a chance to cleanup.
146
          List runnables = uiCallbackManager.runnables;
147
          if( runnables != null ) {
148
            RunnableBase[] toBeExecuted = new RunnableBase[ runnables.size() ];
149
            runnables.toArray( toBeExecuted );
150
            for( int i = 0; i < toBeExecuted.length; i++ ) {
151
              RunnableBase runnable = toBeExecuted[ i ];
152
              if( runnable.canRun() ) {
153
                try {
154
                  runnable.run();
155
                } catch( final Throwable t ) {
156
                  // Doesn't really matter, we just wanted to give the thread a chance to run
157
                }
158
              }
159
            }
160
          }
161
        } catch( final Throwable t ) {
162
          // Not much we can do now
163
          // I guess we could log this!
164
        }
136
      }
165
      }
137
    }
166
    }
138
  }
167
  }

Return to bug 283596