public class DataSourceManager extends Base
Note that these APIs are only intended for use in cases where your code is not running in the context of an RPCManager
, such as a non-servlet application or some init-time logic. For normal client-server transaction code that has access to an RPCManager, use RPCManager.getDataSource()
instead; this API tracks and frees all DataSource instances it returns at the end of the transaction cycle, so you don't need to worry about your application code leaking DataSource objects.
Scan the client-side documentation for "standaloneDataSource" for details and examples of how to use DataSource features in a non-servlet application
Modifier and Type | Method and Description |
---|---|
static void | clearPooledInstances(java.lang.String dsName) Clears all instances of the named DataSource from the pool |
static void | free(DataSource ds) Frees the parameter DataSource object by returning it to the pool. |
static void | freeDataSource(DataSource ds) Frees the parameter DataSource object by returning it to the pool |
static DataSource | get(java.lang.String name) Returns a DataSource object from the pool, creating a new instance if necessary. |
static DataSource | getDataSource(java.lang.String name) Returns a DataSource object from the pool, creating a new instance if necessary. |
static void | restartPoolManager() Restarts DataSource pooling. |
public static void restartPoolManager() throws java.lang.Exception
java.lang.Exception
public static void clearPooledInstances(java.lang.String dsName) throws java.lang.Exception
dsName
- The name of the DataSource for which we should clear instancesjava.lang.Exception
public static DataSource getDataSource(java.lang.String name) throws java.lang.Exception
DataSourceManager.free(com.isomorphic.datasource.DataSource)
method, or you will leak objects.name
- The name of the DataSource to return an instance ofjava.lang.Exception
public static DataSource get(java.lang.String name) throws java.lang.Exception
DataSourceManager.getDataSource(java.lang.String)
.name
- The name of the DataSource to return an instance ofjava.lang.Exception
public static void freeDataSource(DataSource ds)
ds
- The DataSource instance to free (return to the pool)public static void free(DataSource ds)
DataSourceManager.freeDataSource(com.isomorphic.datasource.DataSource)
.ds
- The DataSource instance to free (return to the pool)