aboutsummaryrefslogtreecommitdiff
path: root/connector/src/main/java/at
diff options
context:
space:
mode:
Diffstat (limited to 'connector/src/main/java/at')
-rw-r--r--connector/src/main/java/at/asitplus/eidas/specific/connector/SpringContextCloseHandler.java56
-rw-r--r--connector/src/main/java/at/asitplus/eidas/specific/connector/SpringInitializer.java186
2 files changed, 1 insertions, 241 deletions
diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/SpringContextCloseHandler.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/SpringContextCloseHandler.java
index 2a3b659a..e884b5c6 100644
--- a/connector/src/main/java/at/asitplus/eidas/specific/connector/SpringContextCloseHandler.java
+++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/SpringContextCloseHandler.java
@@ -133,29 +133,6 @@ public class SpringContextCloseHandler
private void internalThreadPoolTaskExecutor(final Map<String, ThreadPoolTaskExecutor> executers) {
for (final ThreadPoolTaskExecutor executor : executers.values()) {
- // Not needed yet
- // int retryCount = 0;
- // while(executor.getActiveCount()>0 && ++retryCount<51){
- // try {
- // log.debug("Executer {} is still working with active {} work. Retry count is
- // {}",
- // executor.getThreadNamePrefix(),
- // executor.getActiveCount(),
- // retryCount);
- // Thread.sleep(1000);
- //
- // } catch (final InterruptedException e) {
- // e.printStackTrace();
- // }
- // }
- //
- // if(!(retryCount<51))
- // log.debug("Executer {} is still working. Since Retry count exceeded max value
- // {}, will be
- // killed immediately",
- // executor.getThreadNamePrefix(),
- // retryCount);
-
executor.shutdown();
log.debug("Executer {} with active {} work has killed", executor.getThreadNamePrefix(),
executor.getActiveCount());
@@ -168,38 +145,7 @@ public class SpringContextCloseHandler
private void internalThreadPoolTaskScheduler(
final Map<String, ThreadPoolTaskScheduler> schedulers) {
log.trace("Stopping #{} task-schedulers", schedulers.size());
-
- // for (final ThreadPoolTaskScheduler scheduler : schedulers.values()) {
- // scheduler.getScheduledExecutor().shutdown();
- // try {
- // scheduler.getScheduledExecutor().awaitTermination(20000,
- // TimeUnit.MILLISECONDS);
- // if(scheduler.getScheduledExecutor().isTerminated() ||
- // scheduler.getScheduledExecutor().isShutdown())
- // log.debug("Scheduler {} has stoped", scheduler.getThreadNamePrefix());
- //
- // else{
- // log.debug("Scheduler {} has not stoped normally and will be shut down
- // immediately",
- // scheduler.getThreadNamePrefix());
- // scheduler.getScheduledExecutor().shutdownNow();
- // log.info("Scheduler {} has shut down immediately",
- // scheduler.getThreadNamePrefix());
- //
- // }
- //
- // } catch (final IllegalStateException e) {
- // e.printStackTrace();
- //
- // } catch (final InterruptedException e) {
- // e.printStackTrace();
- //
- // } finally {
- // scheduler.shutdown();
- //
- // }
- // }
-
+
}
private void internalIDestroyableObject(final Map<String, IDestroyableObject> objectsToDestroy) {
diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/SpringInitializer.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/SpringInitializer.java
deleted file mode 100644
index 417828a6..00000000
--- a/connector/src/main/java/at/asitplus/eidas/specific/connector/SpringInitializer.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright 2018 A-SIT Plus GmbH
- * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
- * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
- *
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "License");
- * You may not use this work except in compliance with the License.
- * You may obtain a copy of the License at:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
-*/
-
-package at.asitplus.eidas.specific.connector;
-
-import java.util.Arrays;
-
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRegistration;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-import org.springframework.context.support.GenericApplicationContext;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.web.WebApplicationInitializer;
-import org.springframework.web.context.ContextLoaderListener;
-import org.springframework.web.context.request.RequestContextListener;
-import org.springframework.web.context.support.GenericWebApplicationContext;
-import org.springframework.web.context.support.ServletContextResource;
-import org.springframework.web.servlet.DispatcherServlet;
-
-import at.gv.egiz.components.spring.api.SpringLoader;
-import at.gv.egiz.eaaf.core.api.IStatusMessenger;
-import at.gv.egiz.eaaf.core.impl.logging.LogMessageProviderFactory;
-import at.gv.egiz.eaaf.core.impl.utils.Random;
-import at.gv.egiz.eaaf.modules.pvp2.impl.opensaml.initialize.EaafOpenSaml3xInitializer;
-
-/**
- * Web application initializer.
- *
- * @author Thomas Lenz
- */
-public class SpringInitializer implements WebApplicationInitializer {
-
- private static final Logger log = LoggerFactory.getLogger(SpringInitializer.class);
-
- private String[] rootServletContexts = null;
- private String[] servletContexts = null;
-
- /**
- * Application specific Spring initializer.
- *
- */
- public SpringInitializer() {
- this.rootServletContexts = null;
- this.servletContexts = new String[] {
- "/applicationContext.xml",
-
- };
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.springframework.web.WebApplicationInitializer#onStartup(javax.servlet.
- * ServletContext)
- */
- @Override
- public void onStartup(ServletContext servletContext) throws ServletException {
- try {
- log.info("=============== Loading Config Root Context! ===============");
- final ApplicationContext cfgRootContext =
- new ClassPathXmlApplicationContext(new String[] {
- "/applicationContext.xml"
- });
-
- log.info("=============== Loading Root Context! ===============");
- final GenericWebApplicationContext rootContext = new GenericWebApplicationContext();
- rootContext.setServletContext(servletContext);
- rootContext.setParent(cfgRootContext);
-
- log.info("Spring-context was initialized with active profiles: {}",
- Arrays.asList(rootContext.getEnvironment().getActiveProfiles()));
-
- log.info("=============== Loading Local Contexts! ===============");
- final XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(
- rootContext);
- if (rootServletContexts != null) {
- for (final String rootServletContext : rootServletContexts) {
- log.debug("Loading: " + rootServletContext);
- xmlReader.loadBeanDefinitions(new ServletContextResource(
- servletContext, rootServletContext));
- }
- }
- // Manage the lifecycle of the root application context
- servletContext.addListener(new ContextLoaderListener(rootContext));
-
- // log.debug("Beans after logAMQP in {}", rootContext);
- // dumpBeanDefinitions(rootContext);
-
- log.info("=============== Loading SPI Context! ===============");
- log.debug("Loading modules and components");
- SpringLoader.loadSpringServices(rootContext);
-
- log.trace("Beans after SPI in " + rootContext);
- dumpBeanDefinitions(rootContext);
-
- log.debug("Loading servlet config in " + rootContext);
- if (servletContexts != null) {
- for (final String servletContextString : servletContexts) {
- xmlReader.loadBeanDefinitions(new ClassPathResource(servletContextString, SpringInitializer.class));
- }
-
- }
-
- log.debug("Refreshing context " + rootContext);
- rootContext.refresh();
-
- log.info("=============== Register Dispatcher Servlet! ===============");
-
- log.trace("Final Beans in " + rootContext);
- dumpBeanDefinitions(rootContext);
-
- log.info("Registering dispatcher configuration");
- final ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher",
- new DispatcherServlet(rootContext));
- if (dispatcher != null) {
- dispatcher.setLoadOnStartup(1);
- dispatcher.addMapping("/");
- dispatcher.setAsyncSupported(true);
-
- } else {
- log.error("Failed to register dispatcher server in servlet context!");
- }
-
- log.info("=============== Register RequestContextListener! ===============");
- servletContext.addListener(new RequestContextListener());
-
- // initialize status messenger
- LogMessageProviderFactory.setStatusMessager(rootContext.getBean(IStatusMessenger.class));
-
- log.info("Bootstrap openSAML .... ");
- EaafOpenSaml3xInitializer.eaafInitialize();
-
- log.info("Seed random number generator ... ");
- Random.seedRandom();
-
- log.info("Initialization of MS-specific eIDAS-connector finished.");
-
- } catch (final Throwable e) {
- log.error("MS-specific eIDAS-connector initialization FAILED!", e);
-
- }
-
- }
-
- private void dumpBeanDefinitions(GenericApplicationContext context) {
- log.trace("Registered Bean in context " + context.toString());
-
- final String[] registeredBeans = context.getBeanDefinitionNames();
- for (final String registeredBean : registeredBeans) {
- final BeanDefinition beanDefinition = context
- .getBeanDefinition(registeredBean);
- log.trace(registeredBean + " -> " + beanDefinition.getBeanClassName());
-
- }
-
- log.trace("Registered Bean in context --" + context);
- }
-}