internal CausalClusteringBackupStrategy(BackupDelegator backupDelegator, AddressResolver addressResolver, LogProvider logProvider, StoreFiles storeFiles) { this._backupDelegator = backupDelegator; this._addressResolver = addressResolver; this._log = logProvider.GetLog(typeof(CausalClusteringBackupStrategy)); this._storeFiles = storeFiles; }
public DurationLogger(Log log, string tag) { this._log = log; this._tag = tag; _start = DateTimeHelper.CurrentUnixTimeMillis(); log.Debug(format("Started: %s", tag)); }
public UpdatePullerScheduler(JobScheduler scheduler, LogProvider logProvider, UpdatePuller updatePullingThread, long pullIntervalMillis) { this._scheduler = scheduler; this._log = logProvider.getLog(this.GetType()); this._updatePuller = updatePullingThread; this._pullIntervalMillis = pullIntervalMillis; }
public SimpleFileStorage(FileSystemAbstraction fileSystem, File directory, string name, ChannelMarshal <T> marshal, LogProvider logProvider) { this._fileSystem = fileSystem; this._log = logProvider.getLog(this.GetType()); this._file = new File(DurableStateStorage.StateDir(directory, name), name); this._marshal = marshal; }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public java.io.File dumpState(Locks lm, LockWorker... workers) throws java.io.IOException public virtual File DumpState(Locks lm, params LockWorker[] workers) { FileStream @out = new FileStream(_file, false); FormattedLogProvider logProvider = FormattedLogProvider.withoutAutoFlush().toOutputStream(@out); try { // * locks held by the lock manager lm.Accept(new DumpLocksVisitor(logProvider.GetLog(typeof(LockWorkFailureDump)))); // * rag manager state; // * workers state Log log = logProvider.getLog(this.GetType()); foreach (LockWorker worker in workers) { // - what each is doing and have up to now log.Info("Worker %s", worker); } return(_file); } finally { @out.Flush(); @out.Close(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void applyTo() public virtual void ApplyTo() { //Test that truncate commands correctly remove entries from the cache. //given AssertableLogProvider logProvider = new AssertableLogProvider(); Log log = logProvider.getLog(this.GetType()); long fromIndex = 2L; TruncateLogCommand truncateLogCommand = new TruncateLogCommand(fromIndex); InFlightCache inFlightCache = new ConsecutiveInFlightCache(); inFlightCache.Put(0L, new RaftLogEntry(0L, valueOf(0))); inFlightCache.Put(1L, new RaftLogEntry(1L, valueOf(1))); inFlightCache.Put(2L, new RaftLogEntry(2L, valueOf(2))); inFlightCache.Put(3L, new RaftLogEntry(3L, valueOf(3))); //when truncateLogCommand.ApplyTo(inFlightCache, log); //then assertNotNull(inFlightCache.Get(0L)); assertNotNull(inFlightCache.Get(1L)); assertNull(inFlightCache.Get(2L)); assertNull(inFlightCache.Get(3L)); logProvider.AssertAtLeastOnce(inLog(this.GetType()).debug("Start truncating in-flight-map from index %d. Current map:%n%s", fromIndex, inFlightCache)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: public TransactionalService(@Context TransactionFacade facade, @Context UriInfo uriInfo, @Context UsageData usage, @Context Log log) public TransactionalService(TransactionFacade facade, UriInfo uriInfo, UsageData usage, Log log) { this._facade = facade; this._usage = usage; this._uriScheme = new TransactionUriBuilder(uriInfo); this._log = log; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void givenAccessGuardWith2ConditionsWhenGrantTwiceAndDenyOnceAndAwaitThenTimeoutAndReturnFalse() public virtual void GivenAccessGuardWith2ConditionsWhenGrantTwiceAndDenyOnceAndAwaitThenTimeoutAndReturnFalse() { // Given Log log = mock(typeof(Log)); DatabaseAvailabilityGuard databaseAvailabilityGuard = GetDatabaseAvailabilityGuard(_clock, log); databaseAvailabilityGuard.Require(_requirement_1); databaseAvailabilityGuard.Require(_requirement_2); // When databaseAvailabilityGuard.Fulfill(_requirement_1); databaseAvailabilityGuard.Fulfill(_requirement_1); databaseAvailabilityGuard.Require(_requirement_2); long start = _clock.millis(); long timeout = 1000; bool result = databaseAvailabilityGuard.IsAvailable(timeout); long end = _clock.millis(); // Then long waitTime = end - start; assertFalse(result); assertThat(waitTime, greaterThanOrEqualTo(timeout)); }
public override void ApplyTo(InFlightCache inFlightCache, Log log) { for (int i = Offset; i < Entries.Length; i++) { inFlightCache.Put(BaseIndex + i, Entries[i]); } }
public override void Start() { this._obligationFulfiller = _dependencies.obligationFulfiller(); this._log = _dependencies.logService().getInternalLog(typeof(BatchingResponseHandler)); this._versionContextSupplier = _dependencies.versionContextSupplier(); this._batchCommitter = new TransactionBatchCommitter(_dependencies.kernelTransactions(), _idReuseSafeZoneTime, _dependencies.commitProcess(), _log); this._stopped = false; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void defaultValueWhenCustomTransactionTimeoutNotSpecified() public virtual void DefaultValueWhenCustomTransactionTimeoutNotSpecified() { Log log = LogProvider.getLog(typeof(HttpServletRequest)); long transactionTimeout = getTransactionTimeout(_request, log); assertEquals("Transaction timeout not specified.", 0, transactionTimeout); LogProvider.assertNoLoggingOccurred(); }
public RaftOutbound(CoreTopologyService coreTopologyService, Outbound <AdvertisedSocketAddress, Message> outbound, System.Func <Optional <ClusterId> > clusterIdentity, LogProvider logProvider, long logThresholdMillis) { this._coreTopologyService = coreTopologyService; this._outbound = outbound; this._clusterIdentity = clusterIdentity; this._log = logProvider.getLog(this.GetType()); this._unknownAddressMonitor = new UnknownAddressMonitor(_log, Clocks.systemClock(), logThresholdMillis); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void applyTo(org.neo4j.causalclustering.core.consensus.log.RaftLog raftLog, org.neo4j.logging.Log log) throws java.io.IOException public override void ApplyTo(RaftLog raftLog, Log log) { if (Index <= raftLog.AppendIndex()) { throw new System.InvalidOperationException("Attempted to append over an existing entry at index " + Index); } raftLog.Append(Entry); }
internal OnlineIndexSamplingJob(long indexId, IndexProxy indexProxy, IndexStoreView storeView, string indexUserDescription, LogProvider logProvider) { this._indexId = indexId; this._indexProxy = indexProxy; this._storeView = storeView; this._log = logProvider.getLog(this.GetType()); this._indexUserDescription = indexUserDescription; }
public override void init() { Log debugLog = _logService.getInternalLog(typeof(DynamicLoggingQueryExecutionMonitor)); this.logger = new DynamicLoggingQueryExecutionMonitor(_config, _fileSystem, _jobScheduler, debugLog); this.logger.init(); _monitoring.addMonitorListener(this.logger); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void retrieveCustomTransactionTimeout() public virtual void RetrieveCustomTransactionTimeout() { when(_request.getHeader(MAX_EXECUTION_TIME_HEADER)).thenReturn("100"); Log log = LogProvider.getLog(typeof(HttpServletRequest)); long transactionTimeout = getTransactionTimeout(_request, log); assertEquals("Transaction timeout should be retrieved.", 100, transactionTimeout); LogProvider.assertNoLoggingOccurred(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setup() public virtual void Setup() { _channel = new EmbeddedChannel(); _log = mock(typeof(Log)); _connection = mock(typeof(BoltConnection)); when(_connection.id()).thenReturn(_channel.id().asLongText()); when(_connection.channel()).thenReturn(_channel); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void defaultValueWhenCustomTransactionTimeoutNotANumber() public virtual void DefaultValueWhenCustomTransactionTimeoutNotANumber() { when(_request.getHeader(MAX_EXECUTION_TIME_HEADER)).thenReturn("aa"); Log log = LogProvider.getLog(typeof(HttpServletRequest)); long transactionTimeout = getTransactionTimeout(_request, log); assertEquals("Transaction timeout not specified.", 0, transactionTimeout); LogProvider.rawMessageMatcher().assertContains("Fail to parse `max-execution-time` " + "header with value: 'aa'. Should be a positive number."); }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected: //ORIGINAL LINE: private ReconnectingChannel(io.netty.bootstrap.Bootstrap bootstrap, io.netty.channel.EventLoop eventLoop, org.neo4j.helpers.SocketAddress destination, final org.neo4j.logging.Log log, org.neo4j.causalclustering.helper.TimeoutStrategy connectionBackoffStrategy) private ReconnectingChannel(Bootstrap bootstrap, EventLoop eventLoop, SocketAddress destination, Log log, TimeoutStrategy connectionBackoffStrategy) { this._bootstrap = bootstrap; this._eventLoop = eventLoop; this._destination = destination; this._log = log; this._cappedLogger = (new CappedLogger(log)).setTimeLimit(20, TimeUnit.SECONDS, Clock.systemUTC()); this._connectionBackoffStrategy = connectionBackoffStrategy; this._connectionBackoff = connectionBackoffStrategy.NewTimeout(); }
private static BatchingTransactionAppender CreateBatchingTransactionAppender(TransactionIdStore transactionIdStore, TransactionMetadataCache transactionMetadataCache, LogFiles logFiles) { Log log = NullLog.Instance; KernelEventHandlers kernelEventHandlers = new KernelEventHandlers(log); DatabasePanicEventGenerator panicEventGenerator = new DatabasePanicEventGenerator(kernelEventHandlers); DatabaseHealth databaseHealth = new DatabaseHealth(panicEventGenerator, log); LogRotationImpl logRotation = new LogRotationImpl(NOOP_LOGROTATION_MONITOR, logFiles, databaseHealth); return(new BatchingTransactionAppender(logFiles, logRotation, transactionMetadataCache, transactionIdStore, IdOrderingQueue.BYPASS, databaseHealth)); }
public CoreStateDownloaderService(JobScheduler jobScheduler, CoreStateDownloader downloader, CommandApplicationProcess applicationProcess, LogProvider logProvider, Org.Neo4j.causalclustering.helper.TimeoutStrategy_Timeout downloaderPauseStrategy, System.Func <DatabaseHealth> dbHealth, Monitors monitors) { this._jobScheduler = jobScheduler; this._downloader = downloader; this._applicationProcess = applicationProcess; this._log = logProvider.getLog(this.GetType()); this._downloaderPauseStrategy = downloaderPauseStrategy; this._dbHealth = dbHealth; this._monitors = monitors; }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void applyTo(org.neo4j.causalclustering.core.consensus.log.RaftLog raftLog, org.neo4j.logging.Log log) throws java.io.IOException public override void ApplyTo(RaftLog raftLog, Log log) { long lastIndex = BaseIndex + Offset; if (lastIndex <= raftLog.AppendIndex()) { throw new System.InvalidOperationException("Attempted to append over an existing entry starting at index " + lastIndex); } raftLog.Append(Arrays.copyOfRange(Entries, Offset, Entries.Length)); }
public EventReporterBuilder(Config config, MetricRegistry registry, Log logger, KernelContext kernelContext, LifeSupport life, FileSystemAbstraction fileSystem, JobScheduler scheduler, ConnectorPortRegister portRegister) { this._config = config; this._registry = registry; this._logger = logger; this._kernelContext = kernelContext; this._life = life; this._fileSystem = fileSystem; this._scheduler = scheduler; this._portRegister = portRegister; }
public TxPullRequestHandler(CatchupServerProtocol protocol, System.Func <StoreId> storeIdSupplier, System.Func <bool> databaseAvailable, System.Func <NeoStoreDataSource> dataSourceSupplier, Monitors monitors, LogProvider logProvider) { this._protocol = protocol; this._storeIdSupplier = storeIdSupplier; this._databaseAvailable = databaseAvailable; DependencyResolver dependencies = dataSourceSupplier().DependencyResolver; this._transactionIdStore = dependencies.ResolveDependency(typeof(TransactionIdStore)); this._logicalTransactionStore = dependencies.ResolveDependency(typeof(LogicalTransactionStore)); this._monitor = monitors.NewMonitor(typeof(TxPullRequestsMonitor)); this._log = logProvider.getLog(this.GetType()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void progressNeverReportMoreThenHundredPercent() public virtual void ProgressNeverReportMoreThenHundredPercent() { AssertableLogProvider logProvider = new AssertableLogProvider(); Log log = logProvider.getLog(this.GetType()); VisibleMigrationProgressMonitor monitor = new VisibleMigrationProgressMonitor(log); monitor.Started(1); MonitorSection(monitor, "First", 100, 1, 10, 99, 170); monitor.Completed(); VerifySectionReportedCorrectly(logProvider); }
public override Lifecycle NewInstance(KernelContext context, Dependencies dependencies) { Config config = dependencies.Config; bool ephemeral = config.Get(GraphDatabaseSettings.ephemeral); FileSystemAbstraction fileSystemAbstraction = dependencies.FileSystem(); DirectoryFactory directoryFactory = directoryFactory(ephemeral); OperationalMode operationalMode = context.DatabaseInfo().OperationalMode; JobScheduler scheduler = dependencies.Scheduler(); IndexDirectoryStructure.Factory directoryStructureFactory = SubProviderDirectoryStructure(context.Directory()); TokenHolders tokenHolders = dependencies.TokenHolders(); Log log = dependencies.LogService.getInternalLog(typeof(FulltextIndexProvider)); AuxiliaryTransactionStateManager auxiliaryTransactionStateManager; try { auxiliaryTransactionStateManager = dependencies.AuxiliaryTransactionStateManager(); } catch (UnsatisfiedDependencyException e) { string message = "Fulltext indexes failed to register as transaction state providers. This means that, if queried, they will not be able to " + "uncommitted transactional changes into account. This is fine if the indexes are opened for non-transactional work, such as for " + "consistency checking. The reason given is: " + e.Message; LogDependencyException(context, log.ErrorLogger(), message); auxiliaryTransactionStateManager = new NullAuxiliaryTransactionStateManager(); } FulltextIndexProvider provider = new FulltextIndexProvider(Descriptor, directoryStructureFactory, fileSystemAbstraction, config, tokenHolders, directoryFactory, operationalMode, scheduler, auxiliaryTransactionStateManager, log); string procedureRegistrationFailureMessage = "Failed to register the fulltext index procedures. The fulltext index provider will be loaded and " + "updated like normal, but it might not be possible to query any fulltext indexes. The reason given is: "; try { dependencies.Procedures().registerComponent(typeof(FulltextAdapter), procContext => provider, true); dependencies.Procedures().registerProcedure(typeof(FulltextProcedures)); } catch (KernelException e) { string message = procedureRegistrationFailureMessage + e.getUserMessage(new NonTransactionalTokenNameLookup(tokenHolders)); // We use the 'warn' logger in this case, because it can occur due to multi-database shenanigans, or due to internal restarts in HA. // These scenarios are less serious, and will _probably_ not prevent FTS from working. Hence we only warn about this. LogDependencyException(context, log.WarnLogger(), message); } catch (UnsatisfiedDependencyException e) { string message = procedureRegistrationFailureMessage + e.Message; LogDependencyException(context, log.ErrorLogger(), message); } return(provider); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldExplainWhoIsBlockingAccess() public virtual void ShouldExplainWhoIsBlockingAccess() { // Given Log log = mock(typeof(Log)); DatabaseAvailabilityGuard databaseAvailabilityGuard = GetDatabaseAvailabilityGuard(_clock, log); // When databaseAvailabilityGuard.Require(_requirement_1); databaseAvailabilityGuard.Require(_requirement_2); // Then assertThat(databaseAvailabilityGuard.DescribeWhoIsBlocking(), equalTo("2 reasons for blocking: Requirement 1, Requirement 2.")); }
public SwitchToMaster(LogService logService, HaIdGeneratorFactory idGeneratorFactory, Config config, System.Func <SlaveFactory> slaveFactorySupplier, System.Func <Locks, ConversationManager> conversationManagerFactory, System.Func <ConversationManager, LifeSupport, Master> masterFactory, System.Func <Master, ConversationManager, MasterServer> masterServerFactory, DelegateInvocationHandler <Master> masterDelegateHandler, ClusterMemberAvailability clusterMemberAvailability, System.Func <NeoStoreDataSource> dataSourceSupplier) { this.ConversationManagerFactory = conversationManagerFactory; this.MasterFactory = masterFactory; this.MasterServerFactory = masterServerFactory; this._userLog = logService.GetUserLog(this.GetType()); this._idGeneratorFactory = idGeneratorFactory; this._config = config; this._slaveFactorySupplier = slaveFactorySupplier; this._masterDelegateHandler = masterDelegateHandler; this._clusterMemberAvailability = clusterMemberAvailability; this._dataSourceSupplier = dataSourceSupplier; }
public override void Close() { _userLog = null; ConversationManagerFactory = null; MasterFactory = null; MasterServerFactory = null; _idGeneratorFactory = null; _config = null; _slaveFactorySupplier = null; _masterDelegateHandler = null; _clusterMemberAvailability = null; _dataSourceSupplier = null; }
/// <summary> /// {@inheritDoc} /// </summary> public override OUTPUT Apply(INPUT retriableInput, System.Func <INPUT, OUTPUT> retriable, System.Predicate <OUTPUT> wasRetrySuccessful) { Log log = _logProvider.getLog(typeof(MultiRetryStrategy)); OUTPUT result = retriable(retriableInput); int currentIteration = 0; while (!wasRetrySuccessful(result) && currentIteration++ < _retries) { log.Debug("Try attempt was unsuccessful for input: %s\n", retriableInput); _sleeper.accept(_delayInMillis); result = retriable(retriableInput); } return(result); }