Skip to content

Instantly share code, notes, and snippets.

@robstryker
Created February 10, 2020 21:26
Show Gist options
  • Save robstryker/82785d855634f5c87bc6339eeedafbb3 to your computer and use it in GitHub Desktop.
Save robstryker/82785d855634f5c87bc6339eeedafbb3 to your computer and use it in GitHub Desktop.
simple osgi Activator
package org.wso2.mbp.sample01;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
public class Activator implements BundleActivator {
/**
* Implements BundleActivator.start().
*
* @param context the framework context for the bundle.
*/
public void start(BundleContext context) throws Exception {
System.out.println("Hello World, I've been updated!");
new Thread("Testing stuff") {
public void run() {
for( int i = 0; i < 10; i++ ) {
System.out.println("Loop " + i);
try {
Thread.sleep(200);
} catch(InterruptedException ie) {
}
}
}
}.start();
}
/**
* Implements BundleActivator.stop().
*
* @param context the framework context for the bundle.
*/
public void stop(BundleContext context) {
System.out.println("Goodbye World!!!");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment