Neo4j transaction template that automates the retry-on-exception logic. It uses the builder pattern for configuration, with copy-semantics, so you can iteratively build up instances for different scenarios.

First instantiate and configure the template using the fluent API methods, and then invoke execute which will begin/commit transactions in a loop for the specified number of times.

By default all exceptions (except Errors and TransactionTerminatedException) cause a retry, and the monitor does nothing, but these can be overridden with custom behavior. A bit more narrow and typical exception to retry on is TransientFailureException, which aims to represent exceptions that are most likely to succeed after a retry.

示例#1
0
			  public Monitor_Adapter( TransactionTemplate outerInstance )
			  {
				  this._outerInstance = outerInstance;
			  }
//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()
        {
            _monitor  = new CountingMonitor();
            _template = (new TransactionTemplate()).With(DatabaseRule.GraphDatabaseAPI).monitor(_monitor).retries(5).backoff(3, TimeUnit.MILLISECONDS);
        }