This commit is contained in:
lucio 2024-02-21 20:31:58 +01:00
parent c46ddc6ae0
commit 170429618f
3 changed files with 14 additions and 10 deletions

View File

@ -1,12 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="common-smartgears-app">
@ -14,14 +16,16 @@
<wb-resource deploy-path="/" source-path="/src/main/resources"/>
<wb-resource deploy-path="/" source-path="/src/main/java"/>
</wb-module>

View File

@ -127,7 +127,7 @@ public class OnlineObserver implements AppManagerObserver{
@Override
public ApplicationManager call() throws Exception {
log.info("on init called");
SecretManagerProvider.instance.set(secret);
SecretManagerProvider.set(secret);
ApplicationManager manager = null;
try {
manager = managerClass.getDeclaredConstructor().newInstance();
@ -136,7 +136,7 @@ public class OnlineObserver implements AppManagerObserver{
} catch (Exception e) {
log.warn("error on onInit of {} on context {}",manager.getClass().getCanonicalName(), secret.getContext(), e);
} finally{
SecretManagerProvider.instance.reset();
SecretManagerProvider.reset();
}
return manager;
}
@ -154,14 +154,14 @@ public class OnlineObserver implements AppManagerObserver{
@Override
public void run() {
SecretManagerProvider.instance.set(secret);
SecretManagerProvider.set(secret);
try {
log.info("calling on ShutDown of {} on context {}",appManager.getClass().getCanonicalName(), secret.getContext());
appManager.get().onShutdown();
} catch (Exception e) {
log.warn("error on onShutdown of {} on context {}",appManager.getClass().getCanonicalName(), secret.getContext(), e);
} finally{
SecretManagerProvider.instance.reset();
SecretManagerProvider.reset();
}
}
}

View File

@ -26,7 +26,7 @@ public class OnlineProvider extends ApplicationManagerProvider {
@Override
protected Future<ApplicationManager> retrieveFuture(Class<? extends ApplicationManager> applicationManagerClass) {
Secret secret = SecretManagerProvider.instance.get();
Secret secret = SecretManagerProvider.get();
String context = secret.getContext();
logger.debug("retrieving appManager {} in context {}",applicationManagerClass.getCanonicalName(), context);
return appManagerMap.get(applicationManagerClass.getCanonicalName()).get(context);
@ -37,7 +37,7 @@ public class OnlineProvider extends ApplicationManagerProvider {
MethodHandler handler = new MethodHandler() {
@Override
public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable {
if (SecretManagerProvider.instance.get()==null) throw new Exception("error invoking application manager method, secret is not set in this thread");
if (SecretManagerProvider.get()==null) throw new Exception("error invoking application manager method, secret is not set in this thread");
logger.debug("applicationManagerClass is {}",applicationManagerClass.getCanonicalName());
Future<ApplicationManager> appManagerFuture = retrieveFuture(applicationManagerClass);
logger.debug("appmanager future is null? {}", appManagerFuture==null);