public void start() throws GondolaException { if (threads.size() > 0) { throw new IllegalStateException("start() can only be called once"); } if (channel == null) { // Peer is not a slave so create a channel to remote member channel = gondola.getNetwork().createChannel(cmember.memberId, peerId); } channel.start(); reset(); // Start local threads threads.add(new Receiver()); threads.add(new Backfiller()); threads.add(new Sender()); threads.forEach(t -> t.start()); }
public void run() { while (true) { try { backfill(); } catch (InterruptedException e) { return; } catch (Exception e) { logger.error(e.getMessage(), e); // Pause to avoid a spin loop try { clock.sleep(10 * 1000); } catch (InterruptedException e1) { return; } } } }
public void run() { while (true) { try { backfill(); } catch (InterruptedException e) { return; } catch (Exception e) { logger.error(e.getMessage(), e); // Pause to avoid a spin loop try { clock.sleep(10 * 1000); } catch (InterruptedException e1) { return; } } } }
public void start() { channel = gondola.getNetwork().createChannel(cmember.memberId, peerId); reset(); // Start local threads assert threads.size() == 0 : String.format("The threads have not been properly shutdown. %d threads remaining", threads.size()); threads.add(new Sender()); threads.add(new Receiver()); threads.add(new Backfiller()); threads.forEach(t -> t.start()); }