Search in sources :

Example 36 with PreDestroy

use of javax.annotation.PreDestroy in project muikku by otavanopisto.

the class SearchPluginDescriptor method deinit.

@PreDestroy
public void deinit() {
    Iterator<SearchProvider> searchProviderIterator = searchProviders.iterator();
    while (searchProviderIterator.hasNext()) {
        SearchProvider provider = searchProviderIterator.next();
        logger.info("Deinitializing search provider: " + provider.getName());
        provider.deinit();
    }
    Iterator<SearchIndexUpdater> updaterProviderIterator = searchIndexUpdaters.iterator();
    while (updaterProviderIterator.hasNext()) {
        SearchIndexUpdater updater = updaterProviderIterator.next();
        logger.info("Deinitializing search index updater: " + updater.getName());
        updater.deinit();
    }
}
Also used : SearchProvider(fi.otavanopisto.muikku.search.SearchProvider) SearchIndexUpdater(fi.otavanopisto.muikku.search.SearchIndexUpdater) PreDestroy(javax.annotation.PreDestroy)

Example 37 with PreDestroy

use of javax.annotation.PreDestroy in project sakuli by ConSol.

the class SakuliPropertyPlaceholderConfigurer method restoreProperties.

@PreDestroy
public void restoreProperties() {
    try {
        for (Map.Entry<String, Map<String, Object>> entry : modifiedSahiConfigProps.entrySet()) {
            String propFile = entry.getKey();
            logger.debug("restore properties file '{}' with properties '{}'", propFile, entry.getValue());
            PropertiesConfiguration propConfig = new PropertiesConfiguration(propFile);
            propConfig.setAutoSave(true);
            for (Map.Entry<String, Object> propEntry : entry.getValue().entrySet()) {
                String propKey = propEntry.getKey();
                if (propConfig.containsKey(propKey)) {
                    propConfig.clearProperty(propKey);
                }
                propConfig.addProperty(propKey, propEntry.getValue());
            }
        }
    } catch (ConfigurationException e) {
        logger.error("Error in restore sahi config properties", e);
    }
}
Also used : ConfigurationException(org.apache.commons.configuration.ConfigurationException) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) PreDestroy(javax.annotation.PreDestroy)

Example 38 with PreDestroy

use of javax.annotation.PreDestroy in project wildfly by wildfly.

the class SFSBLifecycleCallback method tearDown.

@PreDestroy
public void tearDown() throws Exception {
    // on Stateful bean is permitted to call getCallerPrincipal on @PreDestroy
    ITestResultsSingleton results = this.getSingleton();
    Principal princ = sessContext.getCallerPrincipal();
    results.setSfsb("predestroy", princ.getName() + "stop");
    log.trace(SFSBLifecycleCallback.class.getSimpleName() + " @PreDestroy called");
}
Also used : Principal(java.security.Principal) PreDestroy(javax.annotation.PreDestroy)

Example 39 with PreDestroy

use of javax.annotation.PreDestroy in project wildfly by wildfly.

the class SLSBLifecycleCallback method tearDown.

@PreDestroy
public void tearDown() throws Exception {
    // on Stateless bean is not permitted to call getCallerPrincipal on @PreDestroy
    ITestResultsSingleton results = getSingleton();
    log.trace(SLSBLifecycleCallback.class.getSimpleName() + " @PreDestroy called");
    Principal princ = null;
    try {
        princ = sessContext.getCallerPrincipal();
    } catch (IllegalStateException e) {
        results.setSlsb("predestroy", "OKstop");
        return;
    }
    results.setSlsb("predestroy", "Method getCallerPrincipal was called from @PreDestroy with result: " + princ);
}
Also used : Principal(java.security.Principal) PreDestroy(javax.annotation.PreDestroy)

Example 40 with PreDestroy

use of javax.annotation.PreDestroy in project wildfly by wildfly.

the class BeanTwo method preDestroy.

@PreDestroy
public void preDestroy() {
    try {
        new InitialContext().lookup(TestResults.SHARED_BINDING_NAME_ONE);
        new InitialContext().lookup(TestResults.SHARED_BINDING_NAME_TWO);
        testResults.setPreDestroyTwo(true);
    } catch (Throwable e) {
        e.printStackTrace();
        testResults.setPreDestroyTwo(false);
    }
}
Also used : InitialContext(javax.naming.InitialContext) PreDestroy(javax.annotation.PreDestroy)

Aggregations

PreDestroy (javax.annotation.PreDestroy)45 ServiceDescriptor (org.opendaylight.infrautils.diagstatus.ServiceDescriptor)4 File (java.io.File)3 ObjectName (javax.management.ObjectName)3 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 PrestoException (com.facebook.presto.spi.PrestoException)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 Method (java.lang.reflect.Method)2 Principal (java.security.Principal)2 JMException (javax.management.JMException)2 MBeanServer (javax.management.MBeanServer)2 InitialContext (javax.naming.InitialContext)2 Terminated (akka.actor.Terminated)1 DruidDataSource (com.alibaba.druid.pool.DruidDataSource)1 SqlTask.createSqlTask (com.facebook.presto.execution.SqlTask.createSqlTask)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 IAtomicLong (com.hazelcast.cp.IAtomicLong)1 CollectorManager (com.navercorp.pinpoint.collector.manage.CollectorManager)1 CommonState (com.navercorp.pinpoint.common.server.cluster.zookeeper.util.CommonState)1 Cache (com.publiccms.common.api.Cache)1