Search in sources :

Example 51 with PostConstruct

use of javax.annotation.PostConstruct in project javaee7-samples by javaee-samples.

the class SubscriptionCreator method createSubscription.

/**
     * We create the subscription at soonest possible time after deployment so we
     * wouldn't miss any message
     */
@PostConstruct
void createSubscription() {
    try (JMSContext jms = factory.createContext()) {
        // <1> This is factory with clientId specified
        // <2> creates durable subscription on the topic
        JMSConsumer consumer = jms.createDurableConsumer(topic, Resources.SUBSCRIPTION);
        consumer.close();
    }
}
Also used : JMSConsumer(javax.jms.JMSConsumer) JMSContext(javax.jms.JMSContext) PostConstruct(javax.annotation.PostConstruct)

Example 52 with PostConstruct

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

the class StatefulBeanA method onConstruct.

@PostConstruct
void onConstruct() throws Exception {
    final Properties jndiProps = this.getInitialContextProperties();
    final Context context = new InitialContext(jndiProps);
    // lookup and set the SFSB from remote server
    this.statefulBeanOnOtherServer = (StatefulRemoteOnOtherServer) context.lookup("ejb:/deployment-on-other-server//StatefulBeanOnOtherServer!" + StatefulRemoteOnOtherServer.class.getName() + "?stateful");
    // lookup and set the SLSB from remote server
    this.statelessRemoteOnOtherServer = (StatelessRemoteOnOtherServer) context.lookup("ejb:/deployment-on-other-server//StatelessBeanOnOtherServer!" + StatelessRemoteOnOtherServer.class.getName());
    // EJB 2.x remote home view of bean on other server
    this.statefulRemoteHomeForBeanOnOtherServer = (StatefulRemoteHomeForBeanOnOtherServer) context.lookup("ejb:/deployment-on-other-server//StatefulBeanOnOtherServer!" + StatefulRemoteHomeForBeanOnOtherServer.class.getName());
}
Also used : InitialContext(javax.naming.InitialContext) Context(javax.naming.Context) Properties(java.util.Properties) InitialContext(javax.naming.InitialContext) PostConstruct(javax.annotation.PostConstruct)

Example 53 with PostConstruct

use of javax.annotation.PostConstruct in project uPortal by Jasig.

the class PortalDataTypeTargetProviderImpl method init.

@PostConstruct
public void init() {
    Iterable<IPortalDataType> dataTypes = portalDataHandlerService.getExportPortalDataTypes();
    for (IPortalDataType type : dataTypes) {
        final String typeId = type.getTypeId();
        targetMap.put(typeId, new PermissionTargetImpl(typeId, typeId, IPermissionTarget.TargetType.DATA_TYPE));
    }
}
Also used : IPortalDataType(org.apereo.portal.io.xml.IPortalDataType) PostConstruct(javax.annotation.PostConstruct)

Example 54 with PostConstruct

use of javax.annotation.PostConstruct in project midpoint by Evolveum.

the class OrgClosureManager method initialize.

@PostConstruct
public void initialize() {
    OperationResult result = new OperationResult(OrgClosureManager.class.getName() + ".initialize");
    if (!isEnabled()) {
        return;
    }
    SqlRepositoryConfiguration repoConfiguration = baseHelper.getConfiguration();
    if (isOracle()) {
        initializeOracleTemporaryTable();
    }
    if (autoUpdateClosureTableStructure()) {
        // need to rebuild the content of the closure table after re-creating it anew
        checkAndOrRebuild(false, true, repoConfiguration.isStopOnOrgClosureStartupFailure(), true, result);
    } else {
        boolean check, rebuild;
        switch(repoConfiguration.getOrgClosureStartupAction()) {
            case NONE:
                return;
            case CHECK:
                check = true;
                rebuild = false;
                break;
            case REBUILD_IF_NEEDED:
                check = true;
                rebuild = true;
                break;
            case ALWAYS_REBUILD:
                check = false;
                rebuild = true;
                break;
            default:
                throw new IllegalArgumentException("Invalid value: " + repoConfiguration.getOrgClosureStartupAction());
        }
        checkAndOrRebuild(check, rebuild, repoConfiguration.isStopOnOrgClosureStartupFailure(), true, result);
    }
}
Also used : OperationResult(com.evolveum.midpoint.schema.result.OperationResult) SqlRepositoryConfiguration(com.evolveum.midpoint.repo.sql.SqlRepositoryConfiguration) PostConstruct(javax.annotation.PostConstruct)

Example 55 with PostConstruct

use of javax.annotation.PostConstruct in project jetcache by alibaba.

the class CacheContext method init.

@PostConstruct
public synchronized void init() {
    if (cacheManager == null) {
        this.cacheManager = new CacheManager();
        if (globalCacheConfig.getStatIntervalMinutes() > 0) {
            defaultCacheMonitorManager = new DefaultCacheMonitorManager(globalCacheConfig.getStatIntervalMinutes(), TimeUnit.MINUTES, globalCacheConfig.getConfigProvider().statCallback());
            defaultCacheMonitorManager.start();
        }
    }
}
Also used : DefaultCacheMonitorManager(com.alicp.jetcache.support.DefaultCacheMonitorManager) PostConstruct(javax.annotation.PostConstruct)

Aggregations

PostConstruct (javax.annotation.PostConstruct)248 IOException (java.io.IOException)28 File (java.io.File)18 SamlRegisteredService (org.apereo.cas.support.saml.services.SamlRegisteredService)17 Map (java.util.Map)15 ArrayList (java.util.ArrayList)12 ExternalResource (com.vaadin.server.ExternalResource)11 HashMap (java.util.HashMap)10 InitialContext (javax.naming.InitialContext)9 Label (com.vaadin.ui.Label)8 VerticalLayout (com.vaadin.ui.VerticalLayout)8 Request (com.nabalive.framework.web.Request)7 Response (com.nabalive.framework.web.Response)7 Route (com.nabalive.framework.web.Route)7 Link (com.vaadin.ui.Link)7 Properties (java.util.Properties)7 Method (java.lang.reflect.Method)5 InputStream (java.io.InputStream)4 URISyntaxException (java.net.URISyntaxException)4 Path (java.nio.file.Path)4