コード例 #1
0
        public virtual IList <Future <TO> > Multiple <FROM, TO, EX>(int threads, ThrowingFunction <FROM, TO, EX> function, FROM parameter) where EX : Exception
        {
            IList <Future <TO> > result = new List <Future <TO> >(threads);

            for (int i = 0; i < threads; i++)
            {
                result.Add(_executor.submit(Task(function, function.ToString() + ":task=" + i, parameter, NULL_CONSUMER)));
            }
            return(result);
        }
コード例 #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public <FROM, TO, EX extends Exception> java.util.concurrent.Future<TO> executeAndAwait(org.neo4j.function.ThrowingFunction<FROM,TO,EX> function, FROM parameter, System.Predicate<Thread> threadCondition, long timeout, java.util.concurrent.TimeUnit unit) throws java.util.concurrent.ExecutionException
        public virtual Future <TO> ExecuteAndAwait <FROM, TO, EX>(ThrowingFunction <FROM, TO, EX> function, FROM parameter, System.Predicate <Thread> threadCondition, long timeout, TimeUnit unit) where EX : Exception
        {
            FailableConcurrentTransfer <Thread> transfer = new FailableConcurrentTransfer <Thread>();
            Future <TO> future = _executor.submit(Task(function, function.ToString(), parameter, transfer));

            try
            {
                Predicates.awaitEx(transfer, throwingPredicate(threadCondition), timeout, unit);
            }
            catch (Exception e)
            {
                throw new ExecutionException(e);
            }
            return(future);
        }
コード例 #3
0
 public virtual Future <TO> Execute <FROM, TO, EX>(ThrowingFunction <FROM, TO, EX> function, FROM parameter) where EX : Exception
 {
     return(_executor.submit(Task(function, function.ToString(), parameter, NULL_CONSUMER)));
 }