Fixed merging errors.
This commit is contained in:
parent
16d6c57c20
commit
c3eb14aafb
|
@ -3,15 +3,12 @@ package org.ethereum.android.datasource;
|
||||||
import org.ethereum.config.SystemProperties;
|
import org.ethereum.config.SystemProperties;
|
||||||
|
|
||||||
import org.ethereum.datasource.KeyValueDataSource;
|
import org.ethereum.datasource.KeyValueDataSource;
|
||||||
import org.fusesource.leveldbjni.JniDBFactory;
|
|
||||||
import org.fusesource.leveldbjni.internal.JniDB;
|
|
||||||
import org.iq80.leveldb.CompressionType;
|
import org.iq80.leveldb.CompressionType;
|
||||||
import org.iq80.leveldb.DB;
|
import org.iq80.leveldb.DB;
|
||||||
import org.iq80.leveldb.DBIterator;
|
import org.iq80.leveldb.DBIterator;
|
||||||
import org.iq80.leveldb.Options;
|
import org.iq80.leveldb.Options;
|
||||||
import org.iq80.leveldb.WriteBatch;
|
import org.iq80.leveldb.WriteBatch;
|
||||||
|
|
||||||
import org.iq80.leveldb.impl.Iq80DBFactory;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -22,6 +19,8 @@ import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static org.iq80.leveldb.impl.Iq80DBFactory.factory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Roman Mandeleil
|
* @author Roman Mandeleil
|
||||||
* @since 18.01.2015
|
* @since 18.01.2015
|
||||||
|
@ -63,21 +62,7 @@ public class LevelDbDataSource implements KeyValueDataSource {
|
||||||
|
|
||||||
logger.debug("Initializing new or existing database: '{}'", name);
|
logger.debug("Initializing new or existing database: '{}'", name);
|
||||||
|
|
||||||
try {
|
db = factory.open(fileLocation, options);
|
||||||
db = JniDBFactory.factory.open(fileLocation, options);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
System.out.println("No native version of LevelDB found");
|
|
||||||
}
|
|
||||||
|
|
||||||
String cpu = System.getProperty("sun.arch.data.model");
|
|
||||||
String os = System.getProperty("os.name");
|
|
||||||
|
|
||||||
if (db instanceof JniDB)
|
|
||||||
System.out.println("Native version of LevelDB loaded for: " + os + "." + cpu + "bit");
|
|
||||||
else{
|
|
||||||
System.out.println("Pure Java version of LevelDB loaded");
|
|
||||||
db = Iq80DBFactory.factory.open(fileLocation, options);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
|
@ -91,7 +76,7 @@ public class LevelDbDataSource implements KeyValueDataSource {
|
||||||
logger.debug("Destroying existing database");
|
logger.debug("Destroying existing database");
|
||||||
Options options = new Options();
|
Options options = new Options();
|
||||||
try {
|
try {
|
||||||
Iq80DBFactory.factory.destroy(fileLocation, options);
|
factory.destroy(fileLocation, options);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import org.iq80.leveldb.DBIterator;
|
||||||
import org.iq80.leveldb.Options;
|
import org.iq80.leveldb.Options;
|
||||||
import org.iq80.leveldb.WriteBatch;
|
import org.iq80.leveldb.WriteBatch;
|
||||||
|
|
||||||
import org.iq80.leveldb.impl.Iq80DBFactory;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
|
@ -192,7 +192,7 @@ public class EthereumImpl implements Ethereum {
|
||||||
PeerClient peer = worldManager.getActivePeer();
|
PeerClient peer = worldManager.getActivePeer();
|
||||||
if (peer == null) {
|
if (peer == null) {
|
||||||
|
|
||||||
peer = new PeerClient();
|
peer = peerClientProvider.get();
|
||||||
worldManager.setActivePeer(peer);
|
worldManager.setActivePeer(peer);
|
||||||
}
|
}
|
||||||
return peer;
|
return peer;
|
||||||
|
|
Loading…
Reference in New Issue