/** {@inheritDoc} */ @Override protected void blockingFetch(Repository repo, ReplicaFetchRequest req) throws IOException { throw new IOException(KetchText.get().cannotFetchFromLocalReplica); }
private void waitForPropose(Proposal proposal, ProgressSpinner spinner) throws InterruptedException { spinner.beginTask(KetchText.get().proposingUpdates, 2, SECONDS); while (!proposal.await(250, MILLISECONDS)) { spinner.update(); } spinner.endTask(proposal.getState() == EXECUTED ? KetchText.get().accepted : KetchText.get().failed); } }
private void waitForQueue(Proposal proposal, ProgressSpinner spinner) throws InterruptedException { spinner.beginTask(KetchText.get().waitingForQueue, 1, SECONDS); while (!proposal.awaitStateChange(QUEUED, 250, MILLISECONDS)) { spinner.update(); } switch (proposal.getState()) { case RUNNING: default: spinner.endTask(KetchText.get().starting); break; case EXECUTED: spinner.endTask(KetchText.get().accepted); break; case ABORTED: spinner.endTask(KetchText.get().failed); break; } }
} catch (IOException e) { log.error(KetchText.get().leaderFailedToStore, e); lock.lock(); try {
private boolean isOnlyTxnNamespace(Collection<ReceiveCommand> cmdList) { // Be paranoid and reject non txnNamespace names, this // is a programming error in Ketch that should not occur. String txnNamespace = getSystem().getTxnNamespace(); for (ReceiveCommand cmd : cmdList) { if (!cmd.getRefName().startsWith(txnNamespace)) { cmd.setResult(REJECTED_OTHER_REASON, MessageFormat.format( KetchText.get().outsideTxnNamespace, cmd.getRefName(), txnNamespace)); ReceiveCommand.abort(cmdList); return false; } } return true; } }
/** * Initializes local replica by reading accepted and committed references. * <p> * Loads accepted and committed references from the reference database of * the local replica and stores their current ObjectIds in memory. * * @param repo * repository to initialize state from. * @throws IOException * cannot read repository state. */ void initialize(Repository repo) throws IOException { RefDatabase refdb = repo.getRefDatabase(); if (refdb instanceof RefTreeDatabase) { RefTreeDatabase treeDb = (RefTreeDatabase) refdb; String txnNamespace = getSystem().getTxnNamespace(); if (!txnNamespace.equals(treeDb.getTxnNamespace())) { throw new IOException(MessageFormat.format( KetchText.get().mismatchedTxnNamespace, txnNamespace, treeDb.getTxnNamespace())); } refdb = treeDb.getBootstrap(); } initialize(refdb.exactRef( getSystem().getTxnAccepted(), getSystem().getTxnCommitted())); }
/** {@inheritDoc} */ @Override protected void blockingFetch(Repository repo, ReplicaFetchRequest req) throws IOException { throw new IOException(KetchText.get().cannotFetchFromLocalReplica); }
@Override protected void blockingFetch(Repository repo, ReplicaFetchRequest req) throws IOException { throw new IOException(KetchText.get().cannotFetchFromLocalReplica); }
private void waitForPropose(Proposal proposal, ProgressSpinner spinner) throws InterruptedException { spinner.beginTask(KetchText.get().proposingUpdates, 2, SECONDS); while (!proposal.await(250, MILLISECONDS)) { spinner.update(); } spinner.endTask(proposal.getState() == EXECUTED ? KetchText.get().accepted : KetchText.get().failed); } }
private void waitForPropose(Proposal proposal, ProgressSpinner spinner) throws InterruptedException { spinner.beginTask(KetchText.get().proposingUpdates, 2, SECONDS); while (!proposal.await(250, MILLISECONDS)) { spinner.update(); } spinner.endTask(proposal.getState() == EXECUTED ? KetchText.get().accepted : KetchText.get().failed); } }
KetchText.get().queuedProposalFailedToApply);
private void waitForQueue(Proposal proposal, ProgressSpinner spinner) throws InterruptedException { spinner.beginTask(KetchText.get().waitingForQueue, 1, SECONDS); while (!proposal.awaitStateChange(QUEUED, 250, MILLISECONDS)) { spinner.update(); } switch (proposal.getState()) { case RUNNING: default: spinner.endTask(KetchText.get().starting); break; case EXECUTED: spinner.endTask(KetchText.get().accepted); break; case ABORTED: spinner.endTask(KetchText.get().failed); break; } }
private void waitForQueue(Proposal proposal, ProgressSpinner spinner) throws InterruptedException { spinner.beginTask(KetchText.get().waitingForQueue, 1, SECONDS); while (!proposal.awaitStateChange(QUEUED, 250, MILLISECONDS)) { spinner.update(); } switch (proposal.getState()) { case RUNNING: default: spinner.endTask(KetchText.get().starting); break; case EXECUTED: spinner.endTask(KetchText.get().accepted); break; case ABORTED: spinner.endTask(KetchText.get().failed); break; } }
} catch (IOException e) { log.error(KetchText.get().leaderFailedToStore, e); lock.lock(); try {
} catch (IOException e) { log.error(KetchText.get().leaderFailedToStore, e); lock.lock(); try {
private boolean isOnlyTxnNamespace(Collection<ReceiveCommand> cmdList) { // Be paranoid and reject non txnNamespace names, this // is a programming error in Ketch that should not occur. String txnNamespace = getSystem().getTxnNamespace(); for (ReceiveCommand cmd : cmdList) { if (!cmd.getRefName().startsWith(txnNamespace)) { cmd.setResult(REJECTED_OTHER_REASON, MessageFormat.format( KetchText.get().outsideTxnNamespace, cmd.getRefName(), txnNamespace)); ReceiveCommand.abort(cmdList); return false; } } return true; } }
private boolean isOnlyTxnNamespace(Collection<ReceiveCommand> cmdList) { // Be paranoid and reject non txnNamespace names, this // is a programming error in Ketch that should not occur. String txnNamespace = getSystem().getTxnNamespace(); for (ReceiveCommand cmd : cmdList) { if (!cmd.getRefName().startsWith(txnNamespace)) { cmd.setResult(REJECTED_OTHER_REASON, MessageFormat.format( KetchText.get().outsideTxnNamespace, cmd.getRefName(), txnNamespace)); ReceiveCommand.abort(cmdList); return false; } } return true; } }
/** * Initializes local replica by reading accepted and committed references. * <p> * Loads accepted and committed references from the reference database of * the local replica and stores their current ObjectIds in memory. * * @param repo * repository to initialize state from. * @throws IOException * cannot read repository state. */ void initialize(Repository repo) throws IOException { RefDatabase refdb = repo.getRefDatabase(); if (refdb instanceof RefTreeDatabase) { RefTreeDatabase treeDb = (RefTreeDatabase) refdb; String txnNamespace = getSystem().getTxnNamespace(); if (!txnNamespace.equals(treeDb.getTxnNamespace())) { throw new IOException(MessageFormat.format( KetchText.get().mismatchedTxnNamespace, txnNamespace, treeDb.getTxnNamespace())); } refdb = treeDb.getBootstrap(); } initialize(refdb.exactRef( getSystem().getTxnAccepted(), getSystem().getTxnCommitted())); }
/** * Initializes local replica by reading accepted and committed references. * <p> * Loads accepted and committed references from the reference database of * the local replica and stores their current ObjectIds in memory. * * @param repo * repository to initialize state from. * @throws IOException * cannot read repository state. */ void initialize(Repository repo) throws IOException { RefDatabase refdb = repo.getRefDatabase(); if (refdb instanceof RefTreeDatabase) { RefTreeDatabase treeDb = (RefTreeDatabase) refdb; String txnNamespace = getSystem().getTxnNamespace(); if (!txnNamespace.equals(treeDb.getTxnNamespace())) { throw new IOException(MessageFormat.format( KetchText.get().mismatchedTxnNamespace, txnNamespace, treeDb.getTxnNamespace())); } refdb = treeDb.getBootstrap(); } initialize(refdb.exactRef( getSystem().getTxnAccepted(), getSystem().getTxnCommitted())); }