Skip to content

Commit 304f226

Browse files
authored
Merge pull request #474 from bstansberry/WFARQ-181
[WFARQ-181] Handle a CancellationException from a shutdown op the sam…
2 parents 2061081 + 2f08784 commit 304f226

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

common/src/main/java/org/jboss/as/arquillian/container/CommonManagedDeployableContainer.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import java.net.DatagramSocket;
1313
import java.net.ServerSocket;
1414
import java.net.Socket;
15+
import java.util.concurrent.CancellationException;
1516
import java.util.concurrent.TimeUnit;
1617
import java.util.concurrent.TimeoutException;
1718

@@ -196,11 +197,18 @@ protected void stopInternal(final Integer timeout) throws LifecycleException {
196197
logger.error("The management client does not seem to be active. Forcibly destroying the process.");
197198
process.destroyForcibly();
198199
} else {
199-
final ModelNode result = client.getControllerClient().execute(op);
200-
if (!Operations.isSuccessfulOutcome(result)) {
200+
String shutdownFailureMessage = null;
201+
try {
202+
final ModelNode result = client.getControllerClient().execute(op);
203+
if (!Operations.isSuccessfulOutcome(result)) {
204+
shutdownFailureMessage = Operations.getFailureDescription(result).asString();
205+
}
206+
} catch (CancellationException ce) {
207+
shutdownFailureMessage = ce.toString();
208+
}
209+
if (shutdownFailureMessage != null) {
201210
// Don't fail stopping, but we should log an error
202-
logger.errorf("Failed to shutdown the server: %s",
203-
Operations.getFailureDescription(result).asString());
211+
logger.errorf("Failed to shutdown the server: %s", shutdownFailureMessage);
204212
process.destroyForcibly();
205213
}
206214
}

0 commit comments

Comments
 (0)