Class RequestManager


  • public class RequestManager
    extends java.lang.Object
    Since:
    2.11
    • Constructor Summary

      Constructors 
      Constructor Description
      RequestManager​(java.util.concurrent.ExecutorService parallel, org.eclipse.xtext.service.OperationCanceledManager operationCanceledManager)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addRequest​(AbstractRequest<?> request)  
      protected java.util.concurrent.CompletableFuture<java.lang.Void> cancel()
      Cancel all requests in the queue.
      protected org.eclipse.xtext.service.OperationCanceledManager getOperationCanceledManager()  
      protected java.util.concurrent.ExecutorService getParallelExecutorService()  
      protected boolean isCancelException​(java.lang.Throwable t)
      Check if the given throwable is an indicator for a cancellation.
      <V> java.util.concurrent.CompletableFuture<V> runRead​(org.eclipse.xtext.xbase.lib.Functions.Function1<? super org.eclipse.xtext.util.CancelIndicator,​? extends V> cancellable)
      Run the given cancellable logic as a read request.
      <U,​V>
      java.util.concurrent.CompletableFuture<V>
      runWrite​(org.eclipse.xtext.xbase.lib.Functions.Function0<? extends U> nonCancellable, org.eclipse.xtext.xbase.lib.Functions.Function2<? super org.eclipse.xtext.util.CancelIndicator,​? super U,​? extends V> cancellable)
      Perform the given write and run the cancellable logic afterwards.
      void shutdown()
      An orderly shutdown of this request manager.
      protected <V> java.util.concurrent.CompletableFuture<V> submit​(AbstractRequest<V> request)
      Submit the given request.
      protected void submitRequest​(AbstractRequest<?> request)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RequestManager

        @Inject
        public RequestManager​(java.util.concurrent.ExecutorService parallel,
                              org.eclipse.xtext.service.OperationCanceledManager operationCanceledManager)
    • Method Detail

      • shutdown

        public void shutdown()
        An orderly shutdown of this request manager.
      • getOperationCanceledManager

        protected final org.eclipse.xtext.service.OperationCanceledManager getOperationCanceledManager()
      • getParallelExecutorService

        protected final java.util.concurrent.ExecutorService getParallelExecutorService()
      • runRead

        public <V> java.util.concurrent.CompletableFuture<V> runRead​(org.eclipse.xtext.xbase.lib.Functions.Function1<? super org.eclipse.xtext.util.CancelIndicator,​? extends V> cancellable)
        Run the given cancellable logic as a read request.
      • runWrite

        public <U,​V> java.util.concurrent.CompletableFuture<V> runWrite​(org.eclipse.xtext.xbase.lib.Functions.Function0<? extends U> nonCancellable,
                                                                              org.eclipse.xtext.xbase.lib.Functions.Function2<? super org.eclipse.xtext.util.CancelIndicator,​? super U,​? extends V> cancellable)
        Perform the given write and run the cancellable logic afterwards.
      • submit

        protected <V> java.util.concurrent.CompletableFuture<V> submit​(AbstractRequest<V> request)
        Submit the given request.
      • submitRequest

        protected void submitRequest​(AbstractRequest<?> request)
      • cancel

        protected java.util.concurrent.CompletableFuture<java.lang.Void> cancel()
        Cancel all requests in the queue.
      • isCancelException

        protected boolean isCancelException​(java.lang.Throwable t)
        Check if the given throwable is an indicator for a cancellation.