Details
-
Task
-
Resolution: Done
-
Major
-
0.2
-
None
Description
The current SPI is somewhat confusing, especially the distinction between RepositoryConnectionFactory and RepositorySource, and what the meaning of the RepositoryConnectionFactories interface is. The original idea was to pattern after JDBC DataSource, but a number of things are not handled well in DataSource (like connection pooling, which is done above the sources). Plus, the current design extracted interfaces when there was similar behavior/methods rather than designing the interfaces to be easily understood and used, and this resulted in some confusing names and concepts that overlapped or were too generic.
There should be a RepositorySource interface that defines all of the methods: getName(), getConnection(), and the management methods like shutdown(), shutdownNow(), isShutdown(), isTerminated(), awaitTermination(), etc. Also, if a RepositorySource would benefit from pooling connections, it should implement the pooling and can include any pooling parameters in the source's JavaBean properties. This means that no pooling is ever done above the RepositorySource, and that the RepositorySource bean properties fully specify and control the behavior of the source.
To make it easier to implement RepositorySource with pooling, the RepositoryConnectionPool class should be kept but should not share any interfaces, and an AbstractRepositorySource implement most of the RepositorySource functionality by delegating to a pool that it owns and manages.