vladmihalcea / flexy-pool

FlexyPool adds metrics and failover strategies to a given Connection Pool, allowing it to resize on demand.
Apache License 2.0
1.09k stars 120 forks source link

Add a new ProxyFactory to use a ConnectionDecorator object instead of a Proxy #20

Closed vladmihalcea closed 9 years ago

vladmihalcea commented 9 years ago

For performance reasons, a Proxy will never be as fast as an actual delegate class. While the Proxy allows the library to be compatible with future Java versions that keep on adding methods to the Connection class hierarchy (as we got used to it by now), the performance penalty might be to much for paying of.

The ConnectionDecorator simply delegates all calls to the actual Connection object. The newer Java 1.7 and 1.8 methods are invoked using reflection, to allow compiling the project with Java 1.6