Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Exposing the mayInterrupt flag for cancellation.

  • Loading branch information...
commit 0ae00e908ecca0ba723867c46bdf7ef778c2ba15 1 parent 11b6ebe
Tamas Cservenak cstamas authored
8 src/main/java/org/sonatype/sisu/charger/ChargeFuture.java
@@ -10,7 +10,13 @@
10 10 */
11 11 public interface ChargeFuture<E>
12 12 {
13   - boolean cancel();
  13 + /**
  14 + * Cancels the Charge.
  15 + *
  16 + * @param mayInterruptIfRunning
  17 + * @return
  18 + */
  19 + boolean cancel( boolean mayInterruptIfRunning );
14 20
15 21 /**
16 22 * Returns true if charge "is done with work" according to it's strategy (does not mean all the Ammunition is
4 src/main/java/org/sonatype/sisu/charger/internal/Charge.java
@@ -53,7 +53,7 @@ public synchronized void exec( final ExecutorService service )
53 53 }
54 54 }
55 55
56   - public boolean cancel()
  56 + public boolean cancel( final boolean mayInterruptIfRunning )
57 57 {
58 58 if ( isDone() )
59 59 {
@@ -63,7 +63,7 @@ public boolean cancel()
63 63 {
64 64 for ( ChargeWrapperFuture<E> future : ammunitionFutures )
65 65 {
66   - future.cancel( false );
  66 + future.cancel( mayInterruptIfRunning );
67 67 }
68 68
69 69 return true;
4 src/main/java/org/sonatype/sisu/charger/internal/DefaultChargeFuture.java
@@ -27,9 +27,9 @@ public DefaultChargeFuture( final Charge<E> charge )
27 27 *
28 28 * @return
29 29 */
30   - public boolean cancel()
  30 + public boolean cancel( final boolean mayInterruptIfRunning )
31 31 {
32   - return charge.cancel();
  32 + return charge.cancel( mayInterruptIfRunning );
33 33 }
34 34
35 35 /**

0 comments on commit 0ae00e9

Please sign in to comment.
Something went wrong with that request. Please try again.