Created
September 12, 2019 07:34
-
-
Save epaga/1e9527d9fcf81170f466eb4309a26357 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Connection nonCloseableConnection = (Connection)Proxy.newProxyInstance( Connection.class.getClassLoader(), | |
new Class[] { Connection.class }, | |
(proxy, method, methodArgs) -> { | |
if (method.getName().equals("close")) { | |
return null; | |
} else { | |
return method.invoke( alreadyExistingConnection, methodArgs ); | |
} | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment