Example #1
0
 /// <summary> Interrupt all threads and disable construction of new
 /// threads. Any tasks entered after this point will be handled by
 /// the given BlockedExecutionHandler.  A shut down pool cannot be
 /// restarted.
 /// </summary>
 public virtual void  ShutdownNow(IBlockedExecutionHandler handler)
 {
     lock (this)
     {
         BlockedExecutionHandler = handler;
         shutdown_        = true;                 // don't allow new tasks
         minimumPoolSize_ = maximumPoolSize_ = 0; // don't make new threads
         InterruptAll();                          // interrupt all existing threads
     }
 }
Example #2
0
 /// <summary> Terminate threads after processing all elements currently in
 /// queue. Any tasks entered after this point will be handled by the
 /// given BlockedExecutionHandler.  A shut down pool cannot be
 /// restarted.
 ///
 /// </summary>
 public virtual void  ShutdownAfterProcessingCurrentlyQueuedTasks(IBlockedExecutionHandler handler)
 {
     lock (this)
     {
         BlockedExecutionHandler = handler;
         shutdown_ = true;
         if (poolSize_ == 0)
         {
             // disable new thread construction when idle
             minimumPoolSize_ = maximumPoolSize_ = 0;
         }
     }
 }
 /// <summary> Interrupt all threads and disable construction of new
 /// threads. Any tasks entered after this point will be handled by
 /// the given BlockedExecutionHandler.  A shut down pool cannot be
 /// restarted.
 /// </summary>
 public virtual void ShutdownNow(IBlockedExecutionHandler handler)
 {
     lock (this)
     {
         BlockedExecutionHandler = handler;
         shutdown_ = true; // don't allow new tasks
         minimumPoolSize_ = maximumPoolSize_ = 0; // don't make new threads
         InterruptAll(); // interrupt all existing threads
     }
 }
 /// <summary> Terminate threads after processing all elements currently in
 /// queue. Any tasks entered after this point will be handled by the
 /// given BlockedExecutionHandler.  A shut down pool cannot be
 /// restarted.
 /// 
 /// </summary>
 public virtual void ShutdownAfterProcessingCurrentlyQueuedTasks(IBlockedExecutionHandler handler)
 {
     lock (this)
     {
         BlockedExecutionHandler = handler;
         shutdown_ = true;
         if (poolSize_ == 0)
             // disable new thread construction when idle
             minimumPoolSize_ = maximumPoolSize_ = 0;
     }
 }
Example #5
0
 /// <summary> Set the policy for blocked execution to be that the current
 /// thread executes the command if there are no available threads in
 /// the pool.
 ///
 /// </summary>
 public virtual void  RunWhenBlocked()
 {
     BlockedExecutionHandler = new RunWhenBlocked_();
 }
Example #6
0
 /// <summary> Set the policy for blocked execution to be to discard the oldest
 /// unhandled request
 ///
 /// </summary>
 public virtual void  DiscardOldestWhenBlocked()
 {
     BlockedExecutionHandler = new DiscardOldestWhenBlocked_(this);
 }
Example #7
0
 /// <summary> Set the policy for blocked execution to be to
 /// throw a RuntimeException.
 ///
 /// </summary>
 public virtual void  AbortWhenBlocked()
 {
     BlockedExecutionHandler = new AbortWhenBlocked_();
 }
Example #8
0
 /// <summary> Set the policy for blocked execution to be to return without
 /// executing the request.
 ///
 /// </summary>
 public virtual void  DiscardWhenBlocked()
 {
     BlockedExecutionHandler = new DiscardWhenBlocked_();
 }
Example #9
0
 /// <summary> Set the policy for blocked execution to be to wait until a thread
 /// is available, unless the pool has been shut down, in which case
 /// the action is discarded.
 ///
 /// </summary>
 public virtual void  WaitWhenBlocked()
 {
     BlockedExecutionHandler = new WaitWhenBlocked_(this);
 }