blob: bd620608c0290bafdc33ffb9e78f3825afc5b4af (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/*******************************************************************************
* Copyright (c) 2006 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package thread.locktest;
import org.eclipse.osgi.tests.bundles.AbstractBundleTests;
import org.osgi.framework.*;
public class Activator implements BundleActivator, Runnable {
public void start(BundleContext context) throws Exception {
Thread thread = new Thread(this, "thread.locktest");
System.out.println("about to start thread");
thread.start();
System.out.println("about to join the thread");
thread.join(10000);
System.out.println("after joining thread");
AbstractBundleTests.simpleResults.addEvent(new BundleEvent(BundleEvent.STARTED, context.getBundle()));
}
public void stop(BundleContext context) throws Exception {
AbstractBundleTests.simpleResults.addEvent(new BundleEvent(BundleEvent.STOPPED, context.getBundle()));
}
public void run() {
long startTime = System.currentTimeMillis();
System.out.println("about to load Class1");
new Class1();
long totalTime = System.currentTimeMillis() - startTime;
System.out.println("loaded Class1 " + totalTime);
if (totalTime < 10000)
AbstractBundleTests.simpleResults.addEvent(new Long(5000));
}
}
|