@Inject public DatabaseServerImpl(final ApplicationDirectories applicationDirectories, final List<OServerHandlerConfiguration> injectedHandlers, @Named("nexus-uber") final ClassLoader uberClassLoader, @Named("${nexus.orient.binaryListenerEnabled:-false}") final boolean binaryListenerEnabled) { this.applicationDirectories = checkNotNull(applicationDirectories); this.injectedHandlers = checkNotNull(injectedHandlers); this.uberClassLoader = checkNotNull(uberClassLoader); this.binaryListenerEnabled = binaryListenerEnabled; log.info("OrientDB version: {}", OConstants.getVersion()); // disable default global shutdown-hook, will shutdown manually when nexus is stopped Orient.instance().removeShutdownHook(); }
@Override protected void doStart() throws Exception { Orient.instance().startup(); Orient.instance().removeShutdownHook(); }
@Override protected void doStart() throws Exception { Orient.instance().startup(); Orient.instance().removeShutdownHook(); }
@Override public void onAfterInitialized(Application application) { Orient.instance().startup(); Orient.instance().removeShutdownHook(); } @Override
@Override public void onAfterInitialized(Application application) { Orient.instance().startup(); Orient.instance().removeShutdownHook(); } @Override
@Override protected void doStart() throws Exception { // global startup Orient.instance().startup(); // instance startup OServer server = new OServer(); configureOrientMinimumLogLevel(); server.setExtensionClassLoader(uberClassLoader); OServerConfiguration config = createConfiguration(); server.startup(config); // remove Orient shutdown-hooks added during startup, we'll manage shutdown ourselves Orient.instance().removeShutdownHook(); server.removeShutdownHook(); // create default root user to avoid orientdb prompt on console server.addUser(OServerConfiguration.DEFAULT_ROOT_USER, null, "*"); // Log global configuration if (log.isDebugEnabled()) { // dumpConfiguration() only accepts ancient stream api String encoding = StandardCharsets.UTF_8.name(); ByteArrayOutputStream buff = new ByteArrayOutputStream(); OGlobalConfiguration.dumpConfiguration(new PrintStream(buff, true, encoding)); log.debug("Global configuration:\n{}", new String(buff.toByteArray(), encoding)); } Orient.instance().addDbLifecycleListener(entityHook); server.activate(); log.info("Activated"); this.orientServer = server; }
} finally { try { removeShutdownHook(); } finally { try {
public void testOrientDbLifeCycle(String dbURL, boolean createDb, boolean dropDb) throws Exception { Orient.instance().startup(); assertNotNull(ODatabaseRecordThreadLocal.instance()); Orient.instance().removeShutdownHook(); OServer server = OServerMain.create(); server.startup(OrientDbTestWebApplication.class.getResource("db.config.xml").openStream()); server.activate(); if(createDb) { ODatabaseDocument dbToCreate = new ODatabaseDocumentTx(dbURL); if(!dbToCreate.exists()) dbToCreate.create(); dbToCreate.close(); } assertNotNull(ODatabaseRecordThreadLocal.instance()); ODatabaseDocument db = new OPartitionedDatabasePoolFactory().get(dbURL, "admin", "admin").acquire(); db.close(); assertNotNull(ODatabaseRecordThreadLocal.instance()); if(dropDb) { ODatabaseDocument dbToDrop = new ODatabaseDocumentTx(dbURL); dbToDrop.open("admin", "admin"); dbToDrop.drop(); } server.shutdown(); Orient.instance().shutdown(); // Thread.sleep(50); }