Skip to content

Commit

Permalink
Issue #3413 was fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
laa committed Jan 19, 2015
1 parent ddf02bd commit aedef5a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 35 deletions.
Expand Up @@ -114,9 +114,17 @@ public class OServer {
private Map<String, Object> variables = new HashMap<String, Object>();
private String serverRootDirectory;
private String databaseDirectory;
private final boolean shutdownEngineOnExit;

public OServer() throws ClassNotFoundException, MalformedObjectNameException, NullPointerException,
InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException {
this(true);
}

public OServer(boolean shutdownEngineOnExit) throws ClassNotFoundException, MalformedObjectNameException, NullPointerException,
InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException {
this.shutdownEngineOnExit = shutdownEngineOnExit;

serverRootDirectory = OSystemVariableResolver.resolveSystemVariables("${" + Orient.ORIENTDB_HOME + "}", ".");

OLogManager.installCustomFormatter();
Expand Down Expand Up @@ -347,7 +355,7 @@ public boolean shutdown() {
lock.unlock();
}

if (!Orient.isRegisterDatabaseByPath())
if (shutdownEngineOnExit && !Orient.isRegisterDatabaseByPath())
try {
OLogManager.instance().info(this, "Shutting down databases:");
Orient.instance().shutdown();
Expand Down
@@ -1,38 +1,43 @@
/*
*
* * Copyright 2014 Orient Technologies LTD (info(at)orientechnologies.com)
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
* *
* * For more information: http://www.orientechnologies.com
*
*/
*
* * Copyright 2014 Orient Technologies LTD (info(at)orientechnologies.com)
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
* *
* * For more information: http://www.orientechnologies.com
*
*/
package com.orientechnologies.orient.server;

public class OServerMain {
private static OServer instance;
private static OServer instance;

public static OServer create() throws Exception {
instance = new OServer();
return instance;
}
public static OServer create() throws Exception {
instance = new OServer();
return instance;
}

public static OServer server() {
return instance;
}
public static OServer create(boolean shutdownEngineOnExit) throws Exception {
instance = new OServer(shutdownEngineOnExit);
return instance;
}

public static void main(final String[] args) throws Exception {
instance = OServerMain.create();
instance.startup().activate();
}
}
public static OServer server() {
return instance;
}

public static void main(final String[] args) throws Exception {
instance = OServerMain.create();
instance.startup().activate();
}
}
Expand Up @@ -22,10 +22,10 @@
import com.orientechnologies.orient.core.Orient;

public class OServerShutdownHook extends Thread {
private OServer server;
private final OServer server;

protected OServerShutdownHook(final OServer iServer) {
server = iServer;
protected OServerShutdownHook(final OServer server) {
this.server = server;
Orient.instance().removeShutdownHook();
Runtime.getRuntime().addShutdownHook(this);
}
Expand Down

0 comments on commit aedef5a

Please sign in to comment.