//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private java.util.concurrent.Future<Object> replicate0(ReplicatedContent command, boolean trackResult, org.neo4j.causalclustering.identity.MemberId leader) throws ReplicationFailureException private Future <object> Replicate0(ReplicatedContent command, bool trackResult, MemberId leader) { _replicationMonitor.startReplication(); try { OperationContext session = _sessionPool.acquireSession(); DistributedOperation operation = new DistributedOperation(command, session.GlobalSession(), session.LocalOperationId()); Progress progress = _progressTracker.start(operation); Org.Neo4j.causalclustering.helper.TimeoutStrategy_Timeout progressTimeout = _progressTimeoutStrategy.newTimeout(); int attempts = 0; try { while (true) { attempts++; if (attempts > 1) { _log.info("Retrying replication. Current attempt: %d Content: %s", attempts, command); } _replicationMonitor.replicationAttempt(); AssertDatabaseAvailable(); // blocking at least until the send has succeeded or failed before retrying _outbound.send(leader, new Org.Neo4j.causalclustering.core.consensus.RaftMessages_NewEntry_Request(_me, operation), true); progress.AwaitReplication(progressTimeout.Millis); if (progress.Replicated) { break; } progressTimeout.Increment(); leader = _leaderProvider.awaitLeader(); } } catch (InterruptedException e) { _progressTracker.abort(operation); throw new ReplicationFailureException("Interrupted while replicating", e); } System.Action <object, Exception> cleanup = (ignored1, ignored2) => _sessionPool.releaseSession(session); if (trackResult) { progress.FutureResult().whenComplete(cleanup); } else { cleanup(null, null); } _replicationMonitor.successfulReplication(); return(progress.FutureResult()); } catch (Exception t) { _replicationMonitor.failedReplication(t); throw t; } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void awaitAndIncrementTimeout(org.neo4j.causalclustering.helper.TimeoutStrategy_Timeout timeout) throws StoreCopyFailedException private void AwaitAndIncrementTimeout(Org.Neo4j.causalclustering.helper.TimeoutStrategy_Timeout timeout) { try { Thread.Sleep(timeout.Millis); timeout.Increment(); } catch (InterruptedException) { throw new StoreCopyFailedException("Thread interrupted"); } }
/// <summary> /// schedules the handshake initiation after the connection attempt /// </summary> private void ScheduleHandshake(SocketChannel ch, HandshakeClient handshakeClient, Org.Neo4j.causalclustering.helper.TimeoutStrategy_Timeout handshakeDelay) { ch.eventLoop().schedule(() => { if (ch.Active) { InitiateHandshake(ch, handshakeClient); } else if (ch.Open) { handshakeDelay.Increment(); ScheduleHandshake(ch, handshakeClient, handshakeDelay); } else { handshakeClient.FailIfNotDone("Channel closed"); } }, handshakeDelay.Millis, MILLISECONDS); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void start() throws java.io.IOException, org.neo4j.causalclustering.catchup.storecopy.DatabaseShutdownException public override void Start() { bool syncedWithUpstream = false; Org.Neo4j.causalclustering.helper.TimeoutStrategy_Timeout timeout = _timeoutStrategy.newTimeout(); int attempt = 0; while (!syncedWithUpstream) { attempt++; MemberId source = null; try { source = _selectionStrategy.bestUpstreamDatabase(); SyncStoreWithUpstream(source); syncedWithUpstream = true; } catch (UpstreamDatabaseSelectionException) { _lastIssue = IssueOf("finding upstream member", attempt); _debugLog.warn(_lastIssue); } catch (StoreCopyFailedException) { _lastIssue = IssueOf(format("copying store files from %s", source), attempt); _debugLog.warn(_lastIssue); } catch (StoreIdDownloadFailedException) { _lastIssue = IssueOf(format("getting store id from %s", source), attempt); _debugLog.warn(_lastIssue); } catch (TopologyLookupException) { _lastIssue = IssueOf(format("getting address of %s", source), attempt); _debugLog.warn(_lastIssue); } try { Thread.Sleep(timeout.Millis); timeout.Increment(); } catch (InterruptedException) { Thread.interrupted(); _lastIssue = "Interrupted while trying to start read replica"; _debugLog.warn(_lastIssue); break; } } if (!syncedWithUpstream) { _userLog.error(_lastIssue); throw new Exception(_lastIssue); } try { _localDatabase.start(); _txPulling.start(); } catch (Exception e) { throw new Exception(e); } }