Skip to content

Commit

Permalink
Fixed auto-reconnection problem
Browse files Browse the repository at this point in the history
  • Loading branch information
lvca committed Nov 12, 2015
1 parent e64c537 commit 716720b
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 117 deletions.
Expand Up @@ -21,16 +21,19 @@

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;

import com.orientechnologies.common.exception.OException;
import com.orientechnologies.common.log.OLogManager;
import com.orientechnologies.orient.core.config.OGlobalConfiguration;
import com.orientechnologies.orient.core.engine.OEngineAbstract;
import com.orientechnologies.orient.core.exception.ODatabaseException;
import com.orientechnologies.orient.core.sql.parser.OWait;
import com.orientechnologies.orient.core.storage.OStorage;

/**
* Remote engine implementation.
*
* @author Luca Garulli
*/
public class OEngineRemote extends OEngineAbstract {
public static final String NAME = "remote";
protected static final Map<String, OStorageRemote> sharedStorages = new HashMap<String, OStorageRemote>();
Expand Down Expand Up @@ -59,29 +62,19 @@ public OStorage createStorage(final String iURL, final Map<String, String> iConf
}
}

public void removeStorage(final String iURL) {
synchronized (sharedStorages) {
sharedStorages.remove(iURL);
}
}

@Override
public void removeStorage(final OStorage iStorage) {
synchronized (sharedStorages) {
for (Entry<String, OStorageRemote> entry : sharedStorages.entrySet()) {
if (entry.getValue() == iStorage) {
sharedStorages.remove(entry.getKey());
break;
}
}
}
}

@Override
public void shutdown() {
super.shutdown();
connectionManager.close();
synchronized (sharedStorages) {
for (Map.Entry<String, OStorageRemote> entry : sharedStorages.entrySet()) {
entry.getValue().close(true, false);
}

sharedStorages.clear();
}
}
Expand Down

0 comments on commit 716720b

Please sign in to comment.