示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPerform500ConcurrentRequests() throws InterruptedException, java.util.concurrent.ExecutionException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void shouldPerform500ConcurrentRequests()
        {
            PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.apache.http.impl.client.CloseableHttpClient httpClient = org.apache.http.impl.client.HttpClients.custom().setConnectionManager(cm).build();
            CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(cm).build();

            Callable <string> performRequest = new CallableAnonymousInnerClass(this, httpClient);

            int             requestsCount = 500;
            ExecutorService service       = Executors.newFixedThreadPool(requestsCount);

            IList <Callable <string> > requests = new List <Callable <string> >();

            for (int i = 0; i < requestsCount; i++)
            {
                requests.Add(performRequest);
            }

            IList <Future <string> > futures = service.invokeAll(requests);

            service.shutdown();
            service.awaitTermination(1, TimeUnit.HOURS);

            foreach (Future <string> future in futures)
            {
                assertEquals(future.get(), "[]");
            }
        }
示例#2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void notify(final org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
        public virtual void notify(DelegateExecution execution)
        {
            Callable <Void> notification = new CallableAnonymousInnerClass(this, execution);

            performNotification(execution, notification);
        }