public ExceptionLogger(Gondola gondola) { this.clock = gondola.getClock(); }
public Peer(Gondola gondola, CoreMember cmember, int peerId) { this.gondola = gondola; this.clock = gondola.getClock(); this.storage = gondola.getStorage(); this.cmember = cmember; this.peerId = peerId; entry0 = new LogEntry(storage, 1) { @Override public void release() { // Don't release back into pool } }; entry0.term = 0; entry0.index = 0; entry0.size = 0; }
public Peer(Gondola gondola, CoreMember cmember, int peerId) { this.gondola = gondola; this.clock = gondola.getClock(); this.storage = gondola.getStorage(); this.cmember = cmember; this.peerId = peerId; entry0 = new LogEntry(storage, 1) { @Override public void release() { // Don't release back into pool } }; entry0.term = 0; entry0.index = 0; entry0.size = 0; }
gondola.getClock().awaitCondition(lock, retryCond, createSocketRetryPeriod); } catch (InterruptedException e1) { return;
public CoreMember(Gondola gondola, Cluster cluster, int memberId, List<Integer> peerIds, boolean isPrimary) throws Exception { this.gondola = gondola; this.cluster = cluster; this.memberId = memberId; this.isPrimary = isPrimary; gondola.getConfig().registerForUpdates(this); acquireFileLock(); clock = gondola.getClock(); pool = gondola.getMessagePool(); storage = gondola.getStorage(); incomingQueue = new ArrayBlockingQueue<>(incomingQueueSize); saveQueue = new SaveQueue(gondola, this); commitQueue = new CommitQueue(gondola, this); for (int id : peerIds) { Peer peer = new Peer(gondola, this, id); peers.add(peer); peerMap.put(peer.peerId, peer); } // Initialize some convenience variables for use when calculating the commit index majority = (peers.size() + 1) / 2 + 1; matchIndices = new int[peers.size()]; reset(); }
gondola.getClock().awaitCondition(lock, retryCond, createSocketRetryPeriod); } catch (InterruptedException e1) { break here;
public CoreMember(Gondola gondola, Shard shard, int memberId, List<Integer> peerIds, boolean isPrimary) throws GondolaException { this.gondola = gondola; this.shard = shard; this.memberId = memberId; this.peerIds = peerIds; this.isPrimary = isPrimary; gondola.getConfig().registerForUpdates(configListener); // Acquire file lock to prevent another process running with the same member id try { fileLock(true); } catch (IOException e) { throw new GondolaException(e); } clock = gondola.getClock(); pool = gondola.getMessagePool(); storage = gondola.getStorage(); incomingQueue = new ArrayBlockingQueue<>(incomingQueueSize); saveQueue = new SaveQueue(gondola, this); commitQueue = new CommitQueue(gondola, this); gondola.getNetwork().register(memberId, channel -> acceptSlaveConnection(channel)); peerIds.forEach(id -> peers.put(id, new Peer(gondola, this, id))); // Initialize some convenience variables for use when calculating the commit index majority = (peers.size() + 1) / 2 + 1; matchIndices = new int[peers.size()]; reset(); }