return ret;
}
- protected abstract T createTransaction(final LogicalDatastoreType key);
+ protected abstract T createTransaction(LogicalDatastoreType key);
/**
* Returns immutable Iterable of all subtransactions.
Future<?> future;
do {
future = commitFuture;
- } while (future == null);
+ }
+ while (future == null);
return future.cancel(false);
}
return ret;
}
- abstract ProxyHistory createHistoryProxy(final LocalHistoryIdentifier historyId,
- final AbstractClientConnection<ShardBackendInfo> connection);
+ abstract ProxyHistory createHistoryProxy(LocalHistoryIdentifier historyId,
+ AbstractClientConnection<ShardBackendInfo> connection);
private void createHistoryCallback(final Response<?, ?> response) {
LOG.debug("Create history response {}", response);
context().executeInActor(this::shutdown);
}
- abstract Long resolveShardForPath(final YangInstanceIdentifier path);
+ abstract Long resolveShardForPath(YangInstanceIdentifier path);
}
abstract boolean isSnapshotOnly();
- abstract void doDelete(final YangInstanceIdentifier path);
+ abstract void doDelete(YangInstanceIdentifier path);
- abstract void doMerge(final YangInstanceIdentifier path, final NormalizedNode<?, ?> data);
+ abstract void doMerge(YangInstanceIdentifier path, NormalizedNode<?, ?> data);
- abstract void doWrite(final YangInstanceIdentifier path, final NormalizedNode<?, ?> data);
+ abstract void doWrite(YangInstanceIdentifier path, NormalizedNode<?, ?> data);
- abstract CheckedFuture<Boolean, ReadFailedException> doExists(final YangInstanceIdentifier path);
+ abstract CheckedFuture<Boolean, ReadFailedException> doExists(YangInstanceIdentifier path);
- abstract CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> doRead(
- final YangInstanceIdentifier path);
+ abstract CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> doRead(YangInstanceIdentifier path);
abstract void doSeal();
abstract FrontendTransaction createReadyTransaction(TransactionIdentifier id, DataTreeModification mod)
throws RequestException;
- abstract ShardDataTreeCohort createReadyCohort(final TransactionIdentifier id, final DataTreeModification mod);
+ abstract ShardDataTreeCohort createReadyCohort(TransactionIdentifier id, DataTreeModification mod);
}
}
// Sequence has already been checked
- abstract @Nullable TransactionSuccess<?> handleRequest(final TransactionRequest<?> request,
- final RequestEnvelope envelope, final long now) throws RequestException;
+ abstract @Nullable TransactionSuccess<?> handleRequest(TransactionRequest<?> request,
+ RequestEnvelope envelope, long now) throws RequestException;
private void recordResponse(final long sequence, final Object response) {
if (replayQueue.isEmpty()) {
@SuppressWarnings("checkstyle:IllegalCatch")
@Override
protected void handleNonRaftCommand(final Object message) {
- try (final MessageTracker.Context context = appendEntriesReplyTracker.received(message)) {
+ try (MessageTracker.Context context = appendEntriesReplyTracker.received(message)) {
final Optional<Error> maybeError = context.error();
if (maybeError.isPresent()) {
LOG.trace("{} : AppendEntriesReply failed to arrive at the expected interval {}", persistenceId(),
ShardDataChangeListenerPublisher newInstance();
<L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> DataChangeListenerRegistration<L>
- registerDataChangeListener(final YangInstanceIdentifier path,final L listener, final DataChangeScope scope);
+ registerDataChangeListener(YangInstanceIdentifier path, L listener, DataChangeScope scope);
}
interface ShardDataTreeNotificationPublisher {
long PUBLISH_DELAY_THRESHOLD_IN_MS = TimeUnit.MILLISECONDS.convert(1, TimeUnit.SECONDS);
- void publishChanges(final DataTreeCandidate candidate, String logContext);
+ void publishChanges(DataTreeCandidate candidate, String logContext);
}
switch (version) {
case BORON:
// Boron snapshots use Java Serialization
- try (final ObjectInputStream ois = new ObjectInputStream(is)) {
+ try (ObjectInputStream ois = new ObjectInputStream(is)) {
return (ShardDataTreeSnapshot) ois.readObject();
} catch (ClassNotFoundException e) {
LOG.error("Failed to serialize data tree snapshot", e);
@Override
public void serialize(final OutputStream os) throws IOException {
- try (final DataOutputStream dos = new DataOutputStream(os)) {
+ try (DataOutputStream dos = new DataOutputStream(os)) {
final PayloadVersion version = version();
version.writeTo(dos);
versionedSerialize(dos, version);
}
public static void writeDataTreeCandidate(final DataOutput out, DataTreeCandidate candidate) throws IOException {
- try (final NormalizedNodeDataOutput writer = NormalizedNodeInputOutput.newDataOutput(out)) {
+ try (NormalizedNodeDataOutput writer = NormalizedNodeInputOutput.newDataOutput(out)) {
writer.writeYangInstanceIdentifier(candidate.getRootPath());
final DataTreeCandidateNode node = candidate.getRootNode();
}
try {
- try (final InputStream is = new ByteArrayInputStream(bytes)) {
+ try (InputStream is = new ByteArrayInputStream(bytes)) {
return deserialize(is);
}
} catch (IOException e) {
}
public static ShardDataTreeSnapshot deserialize(final InputStream is) throws IOException {
- try (final DataInputStream dis = new DataInputStream(is)) {
+ try (DataInputStream dis = new DataInputStream(is)) {
final ShardDataTreeSnapshot ret = AbstractVersionedShardDataTreeSnapshot.deserialize(dis);
// Make sure we consume all bytes, otherwise something went very wrong
*/
public abstract Optional<NormalizedNode<?, ?>> getRootNode();
- public abstract void serialize(final OutputStream os) throws IOException;
+ public abstract void serialize(OutputStream os) throws IOException;
@Deprecated
private static boolean isLegacyStream(final byte[] bytes) {
ArgumentCaptor<DOMDataTreeCandidate> candidateCapt = ArgumentCaptor.forClass(DOMDataTreeCandidate.class);
new IntegrationTestKit(getSystem(), datastoreContextBuilder) {
{
- try (final AbstractDataStore dataStore = setupDistributedDataStore("transactionIntegrationTest",
+ try (AbstractDataStore dataStore = setupDistributedDataStore("transactionIntegrationTest",
"test-1")) {
final ObjectRegistration<DOMDataTreeCommitCohort> cohortReg =
dataStore.registerCommitCohort(TEST_ID, cohort);
new IntegrationTestKit(getSystem(), datastoreContextBuilder) {
{
- try (final AbstractDataStore dataStore =
+ try (AbstractDataStore dataStore =
setupDistributedDataStore("transactionIntegrationTest", "test-1")) {
dataStore.registerCommitCohort(TEST_ID, failedCohort);
Thread.sleep(1000); // Registration is asynchronous
Mockito.doReturn(ThreePhaseCommitStep.NOOP_ABORT_FUTURE).when(stepToAbort).abort();
new IntegrationTestKit(getSystem(), datastoreContextBuilder) {
{
- try (final AbstractDataStore dataStore =
+ try (AbstractDataStore dataStore =
setupDistributedDataStore("transactionIntegrationTest", "test-1")) {
dataStore.registerCommitCohort(TEST_ID, cohortToAbort);
Thread.sleep(1000); // Registration is asynchronous
// Create the write Tx.
- try (final DOMStoreWriteTransaction writeTx = writeOnly ? dataStore.newWriteOnlyTransaction()
+ try (DOMStoreWriteTransaction writeTx = writeOnly ? dataStore.newWriteOnlyTransaction()
: dataStore.newReadWriteTransaction()) {
assertNotNull("newReadWriteTransaction returned null", writeTx);
@Test
public void testWaitTillReadyCountDown() {
- try (final DistributedDataStore distributedDataStore = new DistributedDataStore(actorContext, UNKNOWN_ID)) {
+ try (DistributedDataStore distributedDataStore = new DistributedDataStore(actorContext, UNKNOWN_ID)) {
doReturn(datastoreContext).when(actorContext).getDatastoreContext();
doReturn(shardElectionTimeout).when(datastoreContext).getShardLeaderElectionTimeout();
doReturn(FiniteDuration.apply(5000, TimeUnit.MILLISECONDS)).when(shardElectionTimeout).duration();