public interface ServerDataSourceImplementation
Bear in mind the following points when working with DataSources (whether custom or built-in) on the Smart GWT Server:
transactionaland non-transactional operations on the same DataSource instance in a single HTTP request can lead to connection leaks if you are using the built-in Hibernate or JPA DataSource.
datasources.pool.enabledis set, DataSource instances are automatically cached in an in-memory pool. This caching is smart: if the underlying
.ds.xmlfile changes, cached instances are discarded and rebuilt.
.ds.xmlfile) is read the first time the DataSource is requested; thereafter, we will only re-read the configuration file if its last-changed timestamp changes. This scheme combines the performance benefits of caching with the with the convenience of being able to change a
.ds.xmlfile and pick up the changes without restarting the server.
RPCManager.getDataSource(). If pooling is enabled, this is the only way to obtain a DataSource instance with the guarantee that it will be returned to the pool at the end of request processing.
DynamicDSGeneratorto provide DataSources to the framework dynamically:
DataSource.fromXML()APIs to construct your DataSources from an XML document or String of XML text
new DataSource(), as this will introduce thread-safety issues
DynamicDSGenerator, pooling is inappropriate because the returned DataSource for a given name might be different each time the generator is called. For this reason, pooling of dynamic DataSources is disabled by default. To enable pooling for dynamically-generated DataSources, set the
poolDynamicDataSourcesto true. NOTE: Here, "dynamic DataSource" means a DataSource whose name would cause the framework to invoke a DynamicDSGenerator, which doesn't necessarily mean that the generator would actually create a dynamic DataSource. As the server-side documentation for
DynamicDSGenerator.getDataSource()states, a generator can simply return null to decline the opportunity to create a dynamic DataSource. Therefore, if the proper operation of pooling is important to you, avoid patterns of
DynamicDSGeneratorusage that involve registering more generically than you need to. In particular, avoid the
addDynamicDSGenerator()signature that does not take a prefix or regex parameter - this will cause the pooling subsystem to regard all DataSources as dynamic, and will effectively disable all DataSource pooling.