public override void HandleSchedulingError(Exception t) { // if the connection is closing, don't output any logs if (!WillClose()) { string message; Neo4jError error; if (ExceptionUtils.hasCause(t, typeof(RejectedExecutionException))) { error = Neo4jError.From(Org.Neo4j.Kernel.Api.Exceptions.Status_Request.NoThreadsAvailable, Org.Neo4j.Kernel.Api.Exceptions.Status_Request.NoThreadsAvailable.code().description()); message = string.Format("Unable to schedule bolt session '{0}' for execution since there are no available threads to " + "serve it at the moment. You can retry at a later time or consider increasing max thread pool size for bolt connector(s).", Id()); } else { error = Neo4jError.FatalFrom(t); message = string.Format("Unexpected error during scheduling of bolt session '{0}'.", Id()); } _log.error(message, t); _userLog.error(message); _machine.markFailed(error); } // this will ensure that the scheduled job will be executed on this thread (fork-join pool) // and it will either send a failure response to the client or close the connection and its // related resources (if closing) ProcessNextBatch(1, true); // we close the connection directly to enforce the client to stop waiting for // any more messages responses besides the failure message. Close(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldNotProcessMessageWithPendingError() internal virtual void ShouldNotProcessMessageWithPendingError() { _state.ResponseHandler = null; _state.markFailed(Neo4jError.From(new Exception())); assertFalse(_state.canProcessMessage()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldConvertDeadlockException() public virtual void ShouldConvertDeadlockException() { // When Neo4jError error = Neo4jError.From(new DeadlockDetectedException(null)); // Then assertEquals(Org.Neo4j.Kernel.Api.Exceptions.Status_Transaction.DeadlockDetected, error.Status()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldAssignUnknownStatusToUnpredictedException() public virtual void ShouldAssignUnknownStatusToUnpredictedException() { // Given Exception cause = new Exception("This is not an error we know how to handle."); Neo4jError error = Neo4jError.From(cause); // Then assertThat(error.Status(), equalTo(Org.Neo4j.Kernel.Api.Exceptions.Status_General.UnknownError)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldHandleMarkFailedWithoutResponseHandler() internal virtual void ShouldHandleMarkFailedWithoutResponseHandler() { _state.ResponseHandler = null; Neo4jError error = Neo4jError.From(new Exception()); _state.markFailed(error); assertEquals(error, _state.PendingError); assertFalse(_state.hasPendingIgnore()); }
public override void MarkFailed(Neo4jError error) { if (_responseHandler != null) { _responseHandler.markFailed(error); } else { _pendingError = error; } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldHandleMarkFailedWitResponseHandler() internal virtual void ShouldHandleMarkFailedWitResponseHandler() { _state.ResponseHandler = _responseHandler; Neo4jError error = Neo4jError.From(new Exception()); _state.markFailed(error); verify(_responseHandler).markFailed(error); assertNull(_state.PendingError); assertFalse(_state.hasPendingIgnore()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSetStatusToDatabaseUnavailableOnDatabaseShutdownException() public virtual void ShouldSetStatusToDatabaseUnavailableOnDatabaseShutdownException() { // Given DatabaseShutdownException ex = new DatabaseShutdownException(); // When Neo4jError error = Neo4jError.From(ex); // Then assertThat(error.Status(), equalTo(Org.Neo4j.Kernel.Api.Exceptions.Status_General.DatabaseUnavailable)); assertThat(error.Cause(), equalTo(ex)); }
public override bool Equals(object o) { if (this == o) { return(true); } if (o == null || this.GetType() != o.GetType()) { return(false); } Neo4jError that = ( Neo4jError )o; return((_status != null ? _status.Equals(that._status) : that._status == null) && !(!string.ReferenceEquals(_message, null) ?!_message.Equals(that._message) :!string.ReferenceEquals(that._message, null))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldResetPendingFailureAndIgnored() internal virtual void ShouldResetPendingFailureAndIgnored() { _state.ResponseHandler = null; Neo4jError error = Neo4jError.From(new Exception()); _state.markIgnored(); _state.markFailed(error); assertEquals(error, _state.PendingError); assertTrue(_state.hasPendingIgnore()); _state.resetPendingFailedAndIgnored(); assertNull(_state.PendingError); assertFalse(_state.hasPendingIgnore()); }
public virtual void ResetPendingFailedAndIgnored() { _pendingError = null; _pendingIgnore = false; }