How to shutdown WildFly gracefully
This tutorial shows how you can shutdown WildFly gracefully.
WildFly can be suspended or shut down gracefully. This allows permits running requests to complete normally, without accepting new requests. Moreover, you can specify a timeout to define how long the suspend or shut down operation will wait for active requests to complete.
You can shutdown WildFly from the Command Line Interface as follows:
:shutdown
This command will trigger an immediate shutdown. The server will just care to close all socket bindings, however all active request will be abruptly teminated.
If you want to shut down the server gracefully, specify the timeout value, in seconds, for the server to wait for active requests to complete. The default is 0, which will shut down the server immediately. A value of -1 will cause the server to wait indefinitely for all active requests to complete before shutting down.
:shutdown(timeout=60)

In Domain mode, to stop all servers in a managed domain gracefully:
:stop-servers(timeout=60)
In order to stop just a single server in a managed domain gracefully:
/host=master/server-config=server-one:stop(timeout=60)
In order to stop all servers in a server group gracefully.
/server-group=main-server-group:stop-servers(timeout=60)
Finally, if you want to ensure that your requests will be allowed to complete, without shutting down the server, then you need to suspend it. Check this tutorial to learn how to suspend WildFly: Suspending and resuming WildFly
Recommended Articles
How to Gracefully Shutdown JBoss/WildFly Using CLI & Management API
Learn how to remotely shutdown JBoss/WildFly using CLI or HTTP Management API for local or remote servers.
Configure No-Request-Timeout in WildFly for Efficient Network Performance
Learn how to adjust the no-request-timeout attribute in WildFly to optimize connection efficiency and network performance.
Upgrade WildFly 8.0.0 to 8.1.0 with a Single Patch: A Step-by-Step Guide
Learn how to apply a patch to upgrade your WildFly 8.0.0 application server to the latest 8.1.0 version in this step-by-step tutorial.
Configure Max-Post-Size in WildFly Application Server for Secure API Requests
Learn how to set and configure the max-post-size in WildFly application server for secure API requests, with examples and best practices.