|
|
|
@ -133,7 +133,7 @@ public class InitManager {
|
|
|
|
|
try {
|
|
|
|
|
this.retries = Integer.parseInt(retriesValue);
|
|
|
|
|
} catch (NumberFormatException e) {
|
|
|
|
|
log.error("Retries paramater [{}] is not an integer", retriesValue);
|
|
|
|
|
log.error("Retries parameter [{}] is not an integer", retriesValue);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String intervalValue = params.get(Initializer.INITIALIZER_QUERY_STRING_PARAM_INTERVAL);
|
|
|
|
@ -141,7 +141,7 @@ public class InitManager {
|
|
|
|
|
try {
|
|
|
|
|
this.interval = Integer.parseInt(intervalValue);
|
|
|
|
|
} catch (NumberFormatException e) {
|
|
|
|
|
log.error("Interval paramater [{}] is not an integer", intervalValue);
|
|
|
|
|
log.error("Interval parameter [{}] is not an integer", intervalValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -221,6 +221,12 @@ public class InitManager {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void runInitializer() {
|
|
|
|
|
Thread thread = new Thread(new Executor(this));
|
|
|
|
|
thread.setContextClassLoader(Thread.currentThread().getContextClassLoader());
|
|
|
|
|
thread.start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setCallback() {
|
|
|
|
|
BundleWiring wiring = getBundle().adapt(BundleWiring.class);
|
|
|
|
|
ClassLoader cl = wiring.getClassLoader();
|
|
|
|
@ -230,7 +236,7 @@ public class InitManager {
|
|
|
|
|
log.info("Loaded class {}", clazz.getName());
|
|
|
|
|
Constructor<?> constructor = clazz.getConstructor();
|
|
|
|
|
Initializer initializer = (Initializer) constructor.newInstance();
|
|
|
|
|
initializer.setCalllback(this);
|
|
|
|
|
initializer.setCallback(this);
|
|
|
|
|
} catch (ClassNotFoundException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
e.printStackTrace();
|
|
|
|
@ -241,7 +247,8 @@ public class InitManager {
|
|
|
|
|
synchronized (this.dependsOn) {
|
|
|
|
|
this.dependsOn.remove(meta.id);
|
|
|
|
|
if (!this.executed && this.canExecute())
|
|
|
|
|
this.execute();
|
|
|
|
|
// this.execute();
|
|
|
|
|
this.runInitializer();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -251,7 +258,7 @@ public class InitManager {
|
|
|
|
|
InitManager.this.updateById(id, true);
|
|
|
|
|
this.executed = true;
|
|
|
|
|
this.notifyDependent();
|
|
|
|
|
owner.setCalllback(null);
|
|
|
|
|
owner.setCallback(null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
@ -367,10 +374,12 @@ public class InitManager {
|
|
|
|
|
bundle.getBundleId(), bundle.getSymbolicName());
|
|
|
|
|
|
|
|
|
|
InitializerMeta meta = createMeta(initializerClass, bundle);
|
|
|
|
|
|
|
|
|
|
meta.runInitializer();
|
|
|
|
|
|
|
|
|
|
Thread thread = new Thread(new Executor(meta));
|
|
|
|
|
thread.setContextClassLoader(Thread.currentThread().getContextClassLoader());
|
|
|
|
|
thread.start();
|
|
|
|
|
// Thread thread = new Thread(new Executor(meta));
|
|
|
|
|
// thread.setContextClassLoader(Thread.currentThread().getContextClassLoader());
|
|
|
|
|
// thread.start();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|