Hello world

This commit is contained in:
2021-09-28 11:17:52 +02:00
commit 9cdbb84076
35 changed files with 1150 additions and 0 deletions

7
MyFirstBundle/bnd.bnd Normal file
View File

@@ -0,0 +1,7 @@
Bundle-Version: 1.0.0
Private-Package: MyFirstBundle
-buildfeatures:
-buildpath:
Bundle-Activator: MyFirstBundle.Activator

View File

@@ -0,0 +1,28 @@
package MyFirstBundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
public class Activator implements BundleActivator {
private Thread thread;
@Override
public void start(BundleContext bundleContext) throws Exception {
thread = new Thread(() -> {
try {
while (true) {
System.out.println("Hello!");
Thread.sleep(2000);
}
} catch (InterruptedException e) {
System.out.println("MyFirstBundle stopped");
}
});
thread.start();
}
@Override
public void stop(BundleContext bundleContext) throws Exception {
thread.interrupt();
}
}