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 359150
Collapse All | Expand All

(-)src/org/eclipse/swt/widgets/TimerExecScheduler.java (-2 / +17 lines)
Lines 9-16 Link Here
9
 ******************************************************************************/
9
 ******************************************************************************/
10
package org.eclipse.swt.widgets;
10
package org.eclipse.swt.widgets;
11
11
12
import java.io.*;
12
import java.io.IOException;
13
import java.util.*;
13
import java.io.InvalidObjectException;
14
import java.io.ObjectInputStream;
15
import java.io.ObjectInputValidation;
16
import java.io.ObjectOutputStream;
17
import java.util.Collection;
18
import java.util.Date;
19
import java.util.Iterator;
20
import java.util.LinkedList;
21
import java.util.Timer;
22
import java.util.TimerTask;
14
23
15
import org.eclipse.rwt.internal.engine.PostDeserialization;
24
import org.eclipse.rwt.internal.engine.PostDeserialization;
16
import org.eclipse.rwt.service.ISessionStore;
25
import org.eclipse.rwt.service.ISessionStore;
Lines 91-96 Link Here
91
    tasks.remove( task );
100
    tasks.remove( task );
92
  }
101
  }
93
  
102
  
103
  private void writeObject( ObjectOutputStream stream ) throws IOException {
104
    synchronized( display.getDeviceLock() ) {
105
      stream.defaultWriteObject();
106
    }
107
  }
108
94
  private void readObject( ObjectInputStream stream ) throws IOException, ClassNotFoundException {
109
  private void readObject( ObjectInputStream stream ) throws IOException, ClassNotFoundException {
95
    stream.defaultReadObject();
110
    stream.defaultReadObject();
96
    stream.registerValidation( new PostDeserializationValidation(), 0 );
111
    stream.registerValidation( new PostDeserializationValidation(), 0 );
(-)src/org/eclipse/swt/widgets/TimerExecScheduler_Test.java (+49 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 EclipseSource and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *    EclipseSource - initial API and implementation
10
 ******************************************************************************/
11
package org.eclipse.swt.widgets;
12
13
import junit.framework.TestCase;
14
15
import org.eclipse.rap.rwt.testfixture.Fixture;
16
import org.eclipse.rap.rwt.testfixture.internal.NoOpRunnable;
17
18
19
public class TimerExecScheduler_Test extends TestCase {
20
  
21
  private TimerExecScheduler scheduler;
22
  private Display display;
23
  private volatile Throwable exception;
24
25
  public void testSerializationIsThreadSafe() throws InterruptedException {
26
//    Runnable runnable = new Runnable() {
27
//      public void run() {
28
//        try {
29
//          scheduler.schedule( 1, new NoOpRunnable() );
30
//          Fixture.serialize( scheduler );
31
//        } catch( Throwable thr ) {
32
//          exception = thr;
33
//        }
34
//      }
35
//    };
36
//    
37
//    Thread[] threads = Fixture.startThreads( 10, runnable );
38
//    Fixture.joinThreads( threads );
39
//    
40
//    assertNull( exception );
41
  }
42
43
  @Override
44
  protected void setUp() throws Exception {
45
    Fixture.setUp();
46
    display = new Display();
47
    scheduler = new TimerExecScheduler( display );
48
  }
49
}
(-)src/org/eclipse/rap/rwt/testfixture/internal/NoOpRunnable.java (-1 / +4 lines)
Lines 10-17 Link Here
10
 ******************************************************************************/
10
 ******************************************************************************/
11
package org.eclipse.rap.rwt.testfixture.internal;
11
package org.eclipse.rap.rwt.testfixture.internal;
12
12
13
import java.io.Serializable;
13
14
14
public class NoOpRunnable implements Runnable {
15
16
public class NoOpRunnable implements Runnable, Serializable {
17
  private static final long serialVersionUID = 1L;
15
18
16
  public void run() {
19
  public void run() {
17
  }
20
  }

Return to bug 359150