The DISCONNECT ALL Statement
The DISCONNECT ALL statement serially disconnects all connections in an application.
In a thread-safe application, only the thread that issues the DISCONNECT ALL statement can be processing an SQL statement (in this case, the DISCONNECT ALL statement). If any other thread is executing an SQL statement, the DISCONNECT ALL statement fails when it tries to disconnect that connection. This failure might leave the application in an inconsistent state.
For example, suppose a DISCONNECT ALL statement successfully disconnects connection A and connection B but is unable to disconnect connection C because this connection is processing an SQL statement. The DISCONNECT ALL statement fails, with connections A and B disconnected but connection C open. It is recommended that you issue the DISCONNECT ALL statement in the main function of your application after all threads complete their work.
While the DISCONNECT ALL statement is serially disconnecting application connections, blocks other connection requests. If another thread requests a connect while the DISCONNECT ALL statement executes, this thread must wait until the DISCONNECT ALL statement completes before can send this new connection request to the database server.