@Start(order = 10) public void start() { persistService.start(); // At this point JPA is started and ready. }
@Dispose(order = 10) public void stop() { // We are nice and stop the persist service at the end... persistService.stop(); }
try { log.debug("Stopping jpa service..."); jpaService.stop(); } catch(Throwable t) { log.trace("Jpa service has already been stopped.", t); jpaOverrideProperties.putAll(updatedProps); log.debug("Starting jpa service..."); jpaService.start(); log.debug("Jpa service is up and running."); } catch(Throwable t) { jpaOverrideProperties.clear(); jpaOverrideProperties.putAll(oldJpaProperties); jpaService.start();
@Override public void init(FilterConfig filterConfig) throws ServletException { persistService.start(); }
@Override public void stop() { persistService.stop(); } }
@Override public void init(FilterConfig filterConfig) throws ServletException { persistService.start(); }
@Override public void destroy() { persistService.stop(); }
@Inject public Initializer(PersistService service) { service.start(); } }
@Override public void destroy() { persistService.stop(); }
/** * Initializes the JPA service. * @param service to be initialized. */ @Inject protected JPAInitializer(PersistService service) { service.start(); } }
@Override public void close() throws IOException { try { jpaService.stop(); } catch(Throwable t) { log.debug("Jpa service has already been stopped."); } }
@Inject public GoogleGuicePersistService(PersistService persistService) { super(); this.persistService = persistService; LOGGER.info("starting persistence"); persistService.start(); }
@Override public void configurationNotFound() { try { log.debug("No persistence configuration found. Making sure jpa service is not running."); jpaService.stop(); } catch(Throwable t) { log.debug("Jpa service has already been stopped."); } }
/** * Start {@link PersistService} * @see <a href="https://github.com/xvik/guice-persist-orient#lifecycle">Lifecycle of guice-persist-orient</a> * @param application Wicket application */ @Override public void init(Application application) { OrienteerWebApplication app = (OrienteerWebApplication) application; PersistService persistService = app.getServiceInstance(PersistService.class); persistService.start(); }
@Override protected void shutDown() throws Exception { LOGGER.info("stopping persistence"); try { persistService.stop(); } catch (Exception e) { LOGGER.warn("error stopping database", e); } } }
public static void main(final String[] args) { final Injector injector = getInjector(); injector.getInstance(PersistService.class).start(); injector.getInstance(ExecutionScope.class).enter(); final MetadataRepositoryMigrator metadataRepositoryMigrator = injector.getInstance(MetadataRepositoryMigrator.class); try { metadataRepositoryMigrator.migrateData(); } catch (final IOException | DMPPersistenceException e) { final String message = "could not migrate metadata repository state successfully"; LOG.error(message, e); throw new RuntimeException(message, e); } }
/** * Stop {@link PersistService} * @see <a href="https://github.com/xvik/guice-persist-orient#lifecycle">Lifecycle of guice-persist-orient</a> * @param application Wicket application */ @Override public void destroy(Application application) { OrienteerWebApplication app = (OrienteerWebApplication) application; PersistService persistService = app.getServiceInstance(PersistService.class); persistService.stop(); } }
public Client(@NonNull Path filePath, @NonNull Config config, boolean cleanRun, @NonNull List<?> listeners) { this.filePath = checkFile(filePath); this.cleanRun = cleanRun; Injector injector = Guice.createInjector( Stage.PRODUCTION, new ConfigurationModule(ConfigValidator.checkValid(config.withFallback(ConfigFactory.load()))), new JpaRepositoryModule(), new ServiceModule() ); persistService = injector.getInstance(PersistService.class); persistService.start(); handlerType = injector.getInstance(MovieHandler.Type.class); handlerChain = injector.getInstance(MovieHandler.class); importProgressService = injector.getInstance(ImportProgressService.class); eventBus = new EventBus(); listeners.forEach(eventBus::register); }
eventBus.post(new ImportFinishedEvent(allErrors)); persistService.stop();
private void init() { //JPA module final Map<String, Object> props = Maps.newHashMap(configuration); props.put("hibernate.connection.datasource", DataSourceManager.get().load(catalogShardName, configuration).get(catalogShardName)); final Module jpaModule = new JpaPersistModule("s3").properties(props); final Module s3Module = new S3Module(catalogName, configuration, infoConverter); final Injector injector = Guice.createInjector(jpaModule, s3Module); persistService = injector.getInstance(PersistService.class); persistService.start(); this.databaseService = injector.getInstance(ConnectorDatabaseService.class); this.tableService = injector.getInstance(ConnectorTableService.class); this.partitionService = injector.getInstance(ConnectorPartitionService.class); }