fix mailbox msg remove bug, add setup for release version

This commit is contained in:
Manfred Karrer 2015-11-18 13:46:47 +01:00
parent 9b1108aa0a
commit 82e766e6b1
38 changed files with 333 additions and 277 deletions

View file

@ -2,15 +2,12 @@ package io.bitsquare.p2p.seed;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import io.bitsquare.app.BitsquareEnvironment;
import io.bitsquare.app.Log;
import io.bitsquare.common.UserThread;
import org.bitcoinj.crypto.DRMWorkaround;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.NoSuchAlgorithmException;
import java.security.Security;
import java.util.Scanner;
@ -20,6 +17,9 @@ import java.util.concurrent.ThreadFactory;
public class SeedNodeMain {
private static final Logger log = LoggerFactory.getLogger(SeedNodeMain.class);
public static final boolean IS_RELEASE_VERSION = false;
private SeedNode seedNode;
private boolean stopped;
@ -28,29 +28,35 @@ public class SeedNodeMain {
// eg. lmvdenjkyvx2ovga.onion:8001 false eo5ay2lyzrfvx2nr.onion:8002|si3uu56adkyqkldl.onion:8003
// To stop enter: q
public static void main(String[] args) throws NoSuchAlgorithmException {
Path path = Paths.get("seed_node_log");
Log.setup(path.toString());
Log.PRINT_TRACE_METHOD = true;
log.info("Log files under: " + path.toAbsolutePath().toString());
DRMWorkaround.maybeDisableExportControls();
new SeedNodeMain(args);
}
public SeedNodeMain(String[] args) {
Security.addProvider(new BouncyCastleProvider());
final ThreadFactory threadFactory = new ThreadFactoryBuilder()
.setNameFormat("SeedNodeMain")
.setDaemon(true)
.build();
UserThread.setExecutor(Executors.newSingleThreadExecutor(threadFactory));
// setup UncaughtExceptionHandler
Thread.UncaughtExceptionHandler handler = (thread, throwable) -> {
// Might come from another thread
log.error("Uncaught Exception from thread " + Thread.currentThread().getName());
log.error("Uncaught Exception throwableMessage= " + throwable.getMessage());
throwable.printStackTrace();
};
Thread.setDefaultUncaughtExceptionHandler(handler);
Thread.currentThread().setUncaughtExceptionHandler(handler);
DRMWorkaround.maybeDisableExportControls();
Security.addProvider(new BouncyCastleProvider());
UserThread.execute(() -> {
try {
seedNode = new SeedNode(BitsquareEnvironment.defaultUserDataDir());
seedNode.processArgs(args);
seedNode.createAndStartP2PService();
seedNode.createAndStartP2PService(IS_RELEASE_VERSION);
} catch (Throwable t) {
log.error("Executing task failed. " + t.getMessage());
t.printStackTrace();