what is the purpose of PoolDataSource.close()? Do you want to close all connections present in pool when your application shuts down? If yes, You can use UniversalConnectionPoolManager API to destroy the connection pool. PLease refer below javadoc for the same: https://docs.oracle.com/en/database/oracle/oracle-database/19/jjucp/overview-using-ucp-manager.html#GUID-3C734CAE-3DF8-4AC7-ADAA-925EF9BFF38D
Please note that the UCP automatically closes all connections on JVM exit using JVM shutdown hooks.