Java 类org.springframework.context.event.ContextStartedEvent 实例源码

项目:hypersocket-framework    文件:DashboardMessageServiceImpl.java   
@Override
public void onApplicationEvent(ContextStartedEvent event) {

    sessionService.executeInSystemContext(new Runnable() {

        @Override
        public void run() {

            try {
                JobDataMap data = new JobDataMap();
                data.put("jobName", "dashboardMessageJob");
                schedulerService.scheduleNow(DashboardMessageJob.class, data,
                        600000);

            } catch (SchedulerException e) {
                log.error("Failed to schedule DashboardMessageJob", e);
            } 
        }

    });

}
项目:hypersocket-framework    文件:AutomationResourceServiceImpl.java   
@Override
public void onApplicationEvent(ContextStartedEvent event) {

    if (log.isInfoEnabled()) {
        log.info("Scheduling one time only or repetitive automation resources");
    }

    sessionService.executeInSystemContext(new Runnable() {

        @Override
        public void run() {

            for (Realm realm : realmRepository.allRealms()) {
                for (AutomationResource resource : repository.getResources(realm)) {
                    if (!resource.isDailyJob()) {
                        schedule(resource);
                    }
                }
            }

            scheduleDailyJobs();
        }

    });
}
项目:hypersocket-framework    文件:PrincipalSuspensionServiceImpl.java   
@Override
public void onApplicationEvent(ContextStartedEvent event) {

    sessionService.executeInSystemContext(new Runnable() {

        @Override
        public void run() {
            for(PrincipalSuspension s : repository.getSuspensions()) {
                try {
                    if (s.getDuration() > 0) {
                        scheduleResume(s.getPrincipal(), s.getStartTime(), s.getDuration());
                    }
                } catch (ResourceCreationException e) {
                    log.error("Could not schedule resumption of user account " + s.getPrincipal().getName(), e);
                }
            }
        }

    });

}
项目:state-channels    文件:NodeServer.java   
@EventListener(ContextStartedEvent.class)
public void start() throws Exception {
    int port = properties.getPort();
    NettyServerBuilder builder = NettyServerBuilder.forPort(port);
    bindableServices.forEach(builder::addService);
    if (properties.isSecure()) {
        configureSsl(builder);
    }
    grpcServer = builder.build();

    try {
        grpcServer.start();
    } catch (IOException e) {
        if (e.getCause() instanceof BindException) {
            throw new BindException("Address already in use: " + port);
        }
        throw new RuntimeException(e);
    }

    if (properties.getHealthCheckPort() > 0) {
        log.info("Starting health check at port {}", properties.getHealthCheckPort());
        healthCheckSocket = new ServerSocket(properties.getHealthCheckPort());
        healthChecker = new Thread(this::healthCheck, "Health Checker");
        healthChecker.setDaemon(true);
        healthChecker.start();
    }

    log.info("Server started, GRPC API listening on {}", grpcServer.getPort());

    String endpointUrl = properties.getEndpointUrl();
    if (endpointUrl == null) {
        log.warn("No endpoint url provided");
    } else {
        for (Address address : ethereumConfig.getAddresses()) {
            ContractsManager contractManager = factory.getContractManager(address);
            EndpointRegistry registry = new EndpointRegistry(contractManager.endpointRegistry());
            registry.registerEndpoint(address, endpointUrl);
        }
    }
}
项目:jetstream    文件:DataFlows.java   
@Override
public void onApplicationEvent(ApplicationEvent event) {
    if (event instanceof ContextStartedEvent) {
        populateGraph();
    }

}
项目:jetstream    文件:ConfigServer.java   
@Override
public void onApplicationEvent(ApplicationEvent event) {

    if (event instanceof ContextStartedEvent) {
        this.startStandAlone();
    } else if (event instanceof ContextClosedEvent || event instanceof ContextStoppedEvent) {
        this.stopStandAlone();
    }
}
项目:jetstream    文件:JettyServer.java   
public void onApplicationEvent(ApplicationEvent event) {
  if (event instanceof ContextStartedEvent && !isImmediateStart()) {
    try {
      start();
    }
    catch (Exception e) {
      LOGGER.error( e.getLocalizedMessage(),  e);
    }
  }
  else if (event instanceof ContextClosedEvent || event instanceof ContextStoppedEvent) {
    stop();
  }
}
项目:realtime-analytics    文件:MetricServer.java   
@Override
public void onApplicationEvent(ApplicationEvent event) {

    if (event instanceof ContextStartedEvent) {
        this.startStandAlone();
    } else if (event instanceof ContextClosedEvent || event instanceof ContextStoppedEvent) {
        this.stopStandAlone();
    }
}
项目:OpenConext-pdp    文件:PolicyProvisioner.java   
@Override
public void onApplicationEvent(ContextStartedEvent contextStartedEvent) {
    policyDefinitions()
        .filter(definition -> !pdpPolicyRepository.findByNameAndLatestRevision(definition.getName(), true).isPresent())
        .forEach(definition -> {
            String policyXml = policyTemplateEngine.createPolicyXml(definition);
            PdpPolicy pdpPolicy = new PdpPolicy(policyXml, definition.getName(), true, "provisioned",
                "surfnet", "system", true, definition.getType());
            pdpPolicyRepository.save(pdpPolicy);
        });
}
项目:hypersocket-framework    文件:SessionServiceImpl.java   
@Override
public void onApplicationEvent(ContextStartedEvent event) {

    executeInSystemContext(new Runnable() {

        @Override
        public void run() {
            if (log.isInfoEnabled()) {
                log.info("Scheduling session reaper job");
            }

            for (Session session : repository.getSystemSessions()) {
                if (systemSession != null && systemSession.equals(session)) {
                    continue;
                }
                closeSession(session);
            }

            try {
                JobDataMap data = new JobDataMap();
                data.put("jobName", "firstRunSessionReaperJob");
                data.put("firstRun", true);

                schedulerService.scheduleNow(SessionReaperJob.class, data);

                data = new JobDataMap();
                data.put("jobName", "sessionReaperJob");

                schedulerService.scheduleIn(SessionReaperJob.class, data, 60000,
                        60000);
            } catch (SchedulerException e) {
                log.error("Failed to schedule session reaper job", e);
            } 
        }

    });

}
项目:lams    文件:AbstractApplicationContext.java   
@Override
public void start() {
    getLifecycleProcessor().start();
    publishEvent(new ContextStartedEvent(this));
}
项目:spring4-understanding    文件:AbstractApplicationContext.java   
@Override
public void start() {
    getLifecycleProcessor().start();
    publishEvent(new ContextStartedEvent(this));
}
项目:my-spring-cache-redis    文件:AbstractApplicationContext.java   
@Override
public void start() {
    getLifecycleProcessor().start();
    publishEvent(new ContextStartedEvent(this));
}
项目:ibole-microservice    文件:RpcClientListenerBean.java   
private void onStartedEvent(ApplicationEvent event) {
  if (ContextStartedEvent.class.getName().equals(event.getClass().getName())) {
    startRpcClient();
  }
}
项目:spring    文件:AbstractApplicationContext.java   
@Override
public void start() {
    getLifecycleProcessor().start();
    publishEvent(new ContextStartedEvent(this));
}
项目:cloud-meter    文件:CloudMeterStartup.java   
@Override
public void onApplicationEvent(ContextStartedEvent arg0) {
    try{

        log.info("Starting CloudMeterStartup from source: " + arg0.getSource().toString());

        InputStream is = CloudMeterStartup.class.getClassLoader().getResourceAsStream("jmeter.properties");

        JMeterUtils.loadJmeterProperties(is);

        log.info("Property load complete. Cloud-Meter properties initialized.");

    }catch(Exception e){
        log.error("exception while loading properties: " + e.getClass().toString() + "/" + e.getMessage());
    }

}
项目:workshop-spring-4.0-to-4.2    文件:MyEventListener.java   
@EventListener({ContextStartedEvent.class, ContextRefreshedEvent.class})
public void handleContextStart() {
    LOG.info("Context Started of refreshed!!!!!!!!!!!!");
}
项目:jetstream    文件:GenericEventGenerator.java   
@Override
protected void processApplicationEvent(ApplicationEvent arg0) {
    if (m_bSendEventsOnInit && arg0 instanceof ContextStartedEvent)
        startReplay();
}
项目:cosmo    文件:ExternalComponentDecorator.java   
@Override
public void onApplicationEvent(ContextStartedEvent event) {
    decorateByFields();
    decorateBySetters();
}
项目:aliada-tool    文件:PipelineStartupListener.java   
@Override
public void onApplicationEvent(final ContextStartedEvent event) {
    LOGGER.info(MessageCatalog._00022_PIPELINE_STARTING);

    LOGGER.info(MessageCatalog._00023_PIPELINE_STARTED);
}
项目:mandrel    文件:StateService.java   
@Override
public void onApplicationEvent(ContextStartedEvent contextStartedEvent) {
    started.set(true);
}
项目:class-guard    文件:AbstractApplicationContext.java   
public void start() {
    getLifecycleProcessor().start();
    publishEvent(new ContextStartedEvent(this));
}
项目:hulaki    文件:ServerApplication.java   
@Override
public void onApplicationEvent(ContextStartedEvent contextStartedEvent) {
}
项目:csap-core    文件:CsapEventClient.java   
@EventListener
public void handleContextStarted ( ContextStartedEvent event ) {

    logger.warn( "This will never get invoked because it is for configuratble context only" );

}