Handle offer removal on disconnect, cleanup

This commit is contained in:
Manfred Karrer 2016-02-17 17:33:53 +01:00
parent db363fac48
commit 17c780639f
69 changed files with 377 additions and 367 deletions

View file

@ -3,7 +3,6 @@ package io.bitsquare.p2p.seed;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import io.bitsquare.app.BitsquareEnvironment;
import io.bitsquare.common.UserThread;
import io.bitsquare.trade.offer.OfferBookService;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -15,8 +14,7 @@ import java.util.concurrent.ThreadFactory;
public class SeedNodeMain {
private static final Logger log = LoggerFactory.getLogger(SeedNodeMain.class);
public static final boolean USE_DETAILED_LOGGING = true;
private OfferBookService offerBookService;
private static final boolean USE_DETAILED_LOGGING = true;
private SeedNode seedNode;
@ -26,7 +24,7 @@ public class SeedNodeMain {
new SeedNodeMain(args);
}
public SeedNodeMain(String[] args) throws InterruptedException {
private SeedNodeMain(String[] args) throws InterruptedException {
final ThreadFactory threadFactory = new ThreadFactoryBuilder()
.setNameFormat("SeedNodeMain")
.setDaemon(true)
@ -50,10 +48,6 @@ public class SeedNodeMain {
seedNode = new SeedNode(BitsquareEnvironment.defaultUserDataDir());
seedNode.processArgs(args);
seedNode.createAndStartP2PService(USE_DETAILED_LOGGING);
// We need the offerbook service to handle the case when the offerer is in sleep/hibernate mode and
// we want to remove his offers and not wait until TTL is over.
offerBookService = new OfferBookService(seedNode.getSeedNodeP2PService());
} catch (Throwable t) {
log.error("Executing task failed. " + t.getMessage());
t.printStackTrace();