本文整理汇总了Java中bitronix.tm.resource.jdbc.PoolingDataSource.setMinPoolSize方法的典型用法代码示例。如果您正苦于以下问题:Java PoolingDataSource.setMinPoolSize方法的具体用法?Java PoolingDataSource.setMinPoolSize怎么用?Java PoolingDataSource.setMinPoolSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bitronix.tm.resource.jdbc.PoolingDataSource
的用法示例。
在下文中一共展示了PoolingDataSource.setMinPoolSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDataSource
import bitronix.tm.resource.jdbc.PoolingDataSource; //导入方法依赖的package包/类
@Override
public DataSource createDataSource(IsolationLevel isolationLevel, Class<?> qualifier,
Consumer<Closeable> closeableRegistrar) {
Properties props = new Properties();
initializeProperties(props);
PoolingDataSource btmDataSource = new PoolingDataSource();
btmDataSource.setUniqueName((qualifier == null ? "" : qualifier.getSimpleName()) + "_" + isolationLevel.name());
btmDataSource.setClassName(databaseIntegrationInfo.getDataSourceClass().getName());
btmDataSource.setIsolationLevel(isolationLevel.name());
btmDataSource.setDriverProperties(props);
btmDataSource.setShareTransactionConnections(true);
btmDataSource.setMaxPoolSize(10);
btmDataSource.setAllowLocalTransactions(true);
btmDataSource.setMinPoolSize(1);
customizeDataSource(btmDataSource);
closeableRegistrar.accept(btmDataSource::close);
return new P6DataSource(btmDataSource);
}
示例2: setUp
import bitronix.tm.resource.jdbc.PoolingDataSource; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
TransactionManagerServices.getConfiguration().setJournal("null").setGracefulShutdownInterval(2);
TransactionManagerServices.getTransactionManager();
MockitoXADataSource.setStaticCloseXAConnectionException(null);
MockitoXADataSource.setStaticGetXAConnectionException(null);
pds = new PoolingDataSource();
pds.setMinPoolSize(1);
pds.setMaxPoolSize(2);
pds.setMaxIdleTime(1);
pds.setClassName(MockitoXADataSource.class.getName());
pds.setUniqueName("pds");
pds.setAllowLocalTransactions(true);
pds.setAcquisitionTimeout(1);
pds.init();
}
示例3: testRegisterTwoLrc
import bitronix.tm.resource.jdbc.PoolingDataSource; //导入方法依赖的package包/类
public void testRegisterTwoLrc() throws Exception {
BitronixTransactionManager tm = TransactionManagerServices.getTransactionManager();
PoolingDataSource lrcDs1 = new PoolingDataSource();
lrcDs1.setClassName(LrcXADataSource.class.getName());
lrcDs1.setUniqueName(DATASOURCE1_NAME + "_lrc");
lrcDs1.setMinPoolSize(POOL_SIZE);
lrcDs1.setMaxPoolSize(POOL_SIZE);
lrcDs1.setAllowLocalTransactions(true);
lrcDs1.getDriverProperties().setProperty("driverClassName", MockDriver.class.getName());
lrcDs1.getDriverProperties().setProperty("url", "");
lrcDs1.init();
PoolingDataSource lrcDs2 = new PoolingDataSource();
lrcDs2.setClassName(LrcXADataSource.class.getName());
lrcDs2.setUniqueName(DATASOURCE2_NAME + "_lrc");
lrcDs2.setMinPoolSize(POOL_SIZE);
lrcDs2.setMaxPoolSize(POOL_SIZE);
lrcDs2.setAllowLocalTransactions(true);
lrcDs2.getDriverProperties().setProperty("driverClassName", MockDriver.class.getName());
lrcDs2.getDriverProperties().setProperty("url", "");
lrcDs2.init();
tm.begin();
Connection c1 = lrcDs1.getConnection();
c1.createStatement();
c1.close();
Connection c2 = lrcDs2.getConnection();
try {
c2.createStatement();
fail("expected SQLException");
} catch (SQLException ex) {
assertTrue(ex.getMessage().startsWith("error enlisting a ConnectionJavaProxy of a JdbcPooledConnection from datasource pds2_lrc in state ACCESSIBLE with usage count 1 wrapping a JDBC LrcXAConnection on a JDBC LrcConnectionJavaProxy on Mock"));
assertTrue(ex.getCause().getMessage().matches("cannot enlist more than one non-XA resource, tried enlisting an XAResourceHolderState with uniqueName=pds2_lrc XAResource=a JDBC LrcXAResource in state NO_TX with XID null, already enlisted: an XAResourceHolderState with uniqueName=pds1_lrc XAResource=a JDBC LrcXAResource in state STARTED \\(started\\) with XID a Bitronix XID .*"));
}
c2.close();
tm.commit();
lrcDs2.close();
lrcDs1.close();
}
示例4: actualDataSource
import bitronix.tm.resource.jdbc.PoolingDataSource; //导入方法依赖的package包/类
@Bean(destroyMethod = "close")
public DataSource actualDataSource() {
PoolingDataSource poolingDataSource = new PoolingDataSource();
poolingDataSource.setClassName(dataSourceClassName);
poolingDataSource.setUniqueName(getClass().getName());
poolingDataSource.setMinPoolSize(0);
poolingDataSource.setMaxPoolSize(5);
poolingDataSource.setAllowLocalTransactions(true);
poolingDataSource.setDriverProperties(new Properties());
poolingDataSource.getDriverProperties().put("user", jdbcUser);
poolingDataSource.getDriverProperties().put("password", jdbcPassword);
poolingDataSource.getDriverProperties().put("url", jdbcUrl);
return poolingDataSource;
}
开发者ID:vladmihalcea,项目名称:high-performance-java-persistence,代码行数:15,代码来源:JTATransactionManagerConfiguration.java
示例5: actualDataSource
import bitronix.tm.resource.jdbc.PoolingDataSource; //导入方法依赖的package包/类
public DataSource actualDataSource() {
PoolingDataSource poolingDataSource = new PoolingDataSource();
poolingDataSource.setClassName(dataSourceClassName);
poolingDataSource.setUniqueName(getClass().getName());
poolingDataSource.setMinPoolSize(0);
poolingDataSource.setMaxPoolSize(5);
poolingDataSource.setAllowLocalTransactions(true);
poolingDataSource.setDriverProperties(new Properties());
poolingDataSource.getDriverProperties().put("user", jdbcUser);
poolingDataSource.getDriverProperties().put("password", jdbcPassword);
poolingDataSource.getDriverProperties().put("url", jdbcUrl);
return poolingDataSource;
}
开发者ID:vladmihalcea,项目名称:high-performance-java-persistence,代码行数:14,代码来源:HSQLDBJtaTransactionManagerConfiguration.java
示例6: actualDataSource
import bitronix.tm.resource.jdbc.PoolingDataSource; //导入方法依赖的package包/类
public DataSource actualDataSource() {
PoolingDataSource poolingDataSource = new PoolingDataSource();
poolingDataSource.setClassName(dataSourceClassName);
poolingDataSource.setUniqueName(getClass().getName());
poolingDataSource.setMinPoolSize(0);
poolingDataSource.setMaxPoolSize(5);
poolingDataSource.setAllowLocalTransactions(true);
poolingDataSource.setDriverProperties(new Properties());
poolingDataSource.getDriverProperties().put("user", jdbcUser);
poolingDataSource.getDriverProperties().put("password", jdbcPassword);
poolingDataSource.getDriverProperties().put("databaseName", jdbcDatabase);
poolingDataSource.getDriverProperties().put("serverName", jdbcHost);
poolingDataSource.getDriverProperties().put("portNumber", jdbcPort);
return poolingDataSource;
}
开发者ID:vladmihalcea,项目名称:high-performance-java-persistence,代码行数:16,代码来源:PostgreSQLJTATransactionManagerConfiguration.java
示例7: dataSource
import bitronix.tm.resource.jdbc.PoolingDataSource; //导入方法依赖的package包/类
@Bean
public javax.sql.DataSource dataSource() {
// TODO: make it as configurable
PoolingDataSource dataSource0 = new PoolingDataSource();
dataSource0.setClassName("com.mysql.jdbc.jdbc2.optional.MysqlXADataSource");
try {
//Each datasource must be assigned a unique name. This is required for distributed crash recovery.
dataSource0.setUniqueName(InetAddress.getLocalHost().getHostAddress());
} catch (UnknownHostException e) {
}
dataSource0.setAutomaticEnlistingEnabled(true);
dataSource0.setAllowLocalTransactions(true);
dataSource0.setShareTransactionConnections(true);
dataSource0.setUseTmJoin(true);
dataSource0.setMinPoolSize(1);
dataSource0.setMaxPoolSize(100);
Properties driverProperties = new Properties();
driverProperties.put("url", this.getDataSource().getUrl());
driverProperties.put("user", this.getDataSource().getUsername());
driverProperties.put("password", this.getDataSource().getPassword());
driverProperties.put("password", this.getDataSource().getPassword());
// driverProperties.put("journal", this.getDataSource().getPassword());
// driverProperties.put("log-part1-filename", "btm1.tlog");
// driverProperties.put("log-part2-filename", "btm2.tlog");
dataSource0.setDriverProperties(driverProperties);
dataSource0.init();
return dataSource0;
}
示例8: setupPoolingDataSource
import bitronix.tm.resource.jdbc.PoolingDataSource; //导入方法依赖的package包/类
/**
* Configure a datasource for our engine use. It is configured for MySQL
*/
private static void setupPoolingDataSource() {
PoolingDataSource pds = new PoolingDataSource();
pds.setMaxPoolSize(10);
pds.setMinPoolSize(10);
pds.setUniqueName(DS_NAME);
pds.setClassName("com.mysql.jdbc.jdbc2.optional.MysqlXADataSource");
pds.setAllowLocalTransactions(true);
pds.getDriverProperties().put("user", USER);
pds.getDriverProperties().put("password", PASSWORD);
pds.getDriverProperties().put("url", URL);
pds.getDriverProperties().put("databaseName", DB_NAME);
pds.init();
}
示例9: setUp
import bitronix.tm.resource.jdbc.PoolingDataSource; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
EventRecorder.clear();
Iterator<String> it = ResourceRegistrar.getResourcesUniqueNames().iterator();
while (it.hasNext()) {
String name = it.next();
ResourceRegistrar.unregister(ResourceRegistrar.get(name));
}
// change disk journal into mock journal
Field field = TransactionManagerServices.class.getDeclaredField("journalRef");
field.setAccessible(true);
@SuppressWarnings("unchecked")
AtomicReference<Journal> journalRef = (AtomicReference<Journal>) field.get(TransactionManagerServices.class);
journalRef.set(new MockJournal());
poolingDataSource1 = new PoolingDataSource();
poolingDataSource1.setClassName(MockitoXADataSource.class.getName());
poolingDataSource1.setUniqueName("pds1");
poolingDataSource1.setMinPoolSize(5);
poolingDataSource1.setMaxPoolSize(5);
poolingDataSource1.setAutomaticEnlistingEnabled(true);
poolingDataSource1.init();
poolingDataSource2 = new PoolingDataSource();
poolingDataSource2.setClassName(MockitoXADataSource.class.getName());
poolingDataSource2.setUniqueName("pds2");
poolingDataSource2.setMinPoolSize(5);
poolingDataSource2.setMaxPoolSize(5);
poolingDataSource2.setAutomaticEnlistingEnabled(true);
poolingDataSource2.init();
TransactionManagerServices.getConfiguration().setGracefulShutdownInterval(3);
btm = TransactionManagerServices.getTransactionManager();
}
示例10: testPoolNotStartingTransactionManager
import bitronix.tm.resource.jdbc.PoolingDataSource; //导入方法依赖的package包/类
public void testPoolNotStartingTransactionManager() throws Exception {
if (log.isDebugEnabled()) { log.debug("*** Starting testPoolNotStartingTransactionManager"); }
// make sure TM is not running
TransactionManagerServices.getTransactionManager().shutdown();
PoolingDataSource pds = new PoolingDataSource();
pds.setMinPoolSize(1);
pds.setMaxPoolSize(2);
pds.setMaxIdleTime(1);
pds.setClassName(MockitoXADataSource.class.getName());
pds.setUniqueName("pds2");
pds.setAllowLocalTransactions(true);
pds.setAcquisitionTimeout(1);
pds.init();
assertFalse(TransactionManagerServices.isTransactionManagerRunning());
Connection c = pds.getConnection();
Statement stmt = c.createStatement();
stmt.close();
c.close();
assertFalse(TransactionManagerServices.isTransactionManagerRunning());
pds.close();
assertFalse(TransactionManagerServices.isTransactionManagerRunning());
}
示例11: testCustomizerCall
import bitronix.tm.resource.jdbc.PoolingDataSource; //导入方法依赖的package包/类
@Test public void testCustomizerCall() throws Exception{
String name = "pds";
PoolingDataSource pds = new PoolingDataSource();
pds.setUniqueName(name);
pds.setXaDataSource(new MockitoXADataSource());
pds.setMinPoolSize(1);
pds.setMaxPoolSize(1);
pds.setXaDataSource(new MockitoXADataSource());
pds.addConnectionCustomizer(customizer);
pds.init();
Connection connection = pds.getConnection(); // onAcquire, onLease
connection.close(); // onRelease
connection = pds.getConnection(); // onLease
connection.close(); // onRelease
pds.close(); // onDestroy
InOrder callOrder = inOrder(customizer);
callOrder.verify(customizer).onAcquire(any(Connection.class), eq(name));
callOrder.verify(customizer).onLease(any(Connection.class), eq(name));
callOrder.verify(customizer).onRelease(any(Connection.class), eq(name));
callOrder.verify(customizer).onLease(any(Connection.class), eq(name));
callOrder.verify(customizer).onRelease(any(Connection.class), eq(name));
callOrder.verify(customizer).onDestroy(any(Connection.class), eq(name));
}
示例12: setUp
import bitronix.tm.resource.jdbc.PoolingDataSource; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
Iterator<String> it = ResourceRegistrar.getResourcesUniqueNames().iterator();
while (it.hasNext()) {
String name = it.next();
ResourceRegistrar.unregister(ResourceRegistrar.get(name));
}
EventRecorder.clear();
// change disk journal into mock journal
Field field = TransactionManagerServices.class.getDeclaredField("journalRef");
field.setAccessible(true);
@SuppressWarnings("unchecked")
AtomicReference<Journal> journalRef = (AtomicReference<Journal>) field.get(TransactionManagerServices.class);
journalRef.set(new MockJournal());
poolingDataSource1 = new PoolingDataSource();
poolingDataSource1.setClassName(MockitoXADataSource.class.getName());
poolingDataSource1.setUniqueName("pds1");
poolingDataSource1.setMinPoolSize(5);
poolingDataSource1.setMaxPoolSize(5);
poolingDataSource1.setAutomaticEnlistingEnabled(true);
poolingDataSource1.init();
tm = TransactionManagerServices.getTransactionManager();
}
示例13: setUp
import bitronix.tm.resource.jdbc.PoolingDataSource; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
Iterator<String> it = ResourceRegistrar.getResourcesUniqueNames().iterator();
while (it.hasNext()) {
String name = it.next();
ResourceRegistrar.unregister(ResourceRegistrar.get(name));
}
EventRecorder.clear();
// change disk journal into mock journal
Field field = TransactionManagerServices.class.getDeclaredField("journalRef");
field.setAccessible(true);
@SuppressWarnings("unchecked")
AtomicReference<Journal> journalRef = (AtomicReference<Journal>) field.get(TransactionManagerServices.class);
journalRef.set(new MockJournal());
poolingDataSource1 = new PoolingDataSource();
poolingDataSource1.setClassName(MockitoXADataSource.class.getName());
poolingDataSource1.setUniqueName("pds1");
poolingDataSource1.setMinPoolSize(5);
poolingDataSource1.setMaxPoolSize(5);
poolingDataSource1.setAutomaticEnlistingEnabled(true);
poolingDataSource1.init();
poolingDataSource2 = new PoolingDataSource();
poolingDataSource2.setClassName(MockitoXADataSource.class.getName());
poolingDataSource2.setUniqueName("pds2");
poolingDataSource2.setMinPoolSize(5);
poolingDataSource2.setMaxPoolSize(5);
poolingDataSource2.setAutomaticEnlistingEnabled(true);
poolingDataSource2.init();
tm = TransactionManagerServices.getTransactionManager();
}
示例14: setUp
import bitronix.tm.resource.jdbc.PoolingDataSource; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
Iterator<String> it = ResourceRegistrar.getResourcesUniqueNames().iterator();
while (it.hasNext()) {
String name = it.next();
ResourceRegistrar.unregister(ResourceRegistrar.get(name));
}
pds = new PoolingDataSource();
pds.setClassName(MockitoXADataSource.class.getName());
pds.setUniqueName("mock-xads");
pds.setMinPoolSize(1);
pds.setMaxPoolSize(1);
pds.init();
new File(TransactionManagerServices.getConfiguration().getLogPart1Filename()).delete();
new File(TransactionManagerServices.getConfiguration().getLogPart2Filename()).delete();
EventRecorder.clear();
Connection connection1 = pds.getConnection();
PooledConnectionProxy handle = (PooledConnectionProxy) connection1;
xaResource = (MockXAResource) handle.getPooledConnection().getXAResource();
connection1.close();
// test the clustered recovery as its logic is more complex and covers the non-clustered logic
TransactionManagerServices.getConfiguration().setCurrentNodeOnlyRecovery(true);
// recoverer needs the journal to be open to be run manually
journal = TransactionManagerServices.getJournal();
journal.open();
}
示例15: testRegisterTwoLrcJms
import bitronix.tm.resource.jdbc.PoolingDataSource; //导入方法依赖的package包/类
public void testRegisterTwoLrcJms() throws Exception {
BitronixTransactionManager tm = TransactionManagerServices.getTransactionManager();
PoolingConnectionFactory pcf = new PoolingConnectionFactory();
pcf.setClassName(LrcXAConnectionFactory.class.getName());
pcf.setUniqueName("pcf_lrc");
pcf.setMaxPoolSize(1);
pcf.getDriverProperties().setProperty("connectionFactoryClassName", MockConnectionFactory.class.getName());
pcf.init();
PoolingDataSource lrcDs2 = new PoolingDataSource();
lrcDs2.setClassName(LrcXADataSource.class.getName());
lrcDs2.setUniqueName(DATASOURCE2_NAME + "_lrc");
lrcDs2.setMinPoolSize(POOL_SIZE);
lrcDs2.setMaxPoolSize(POOL_SIZE);
lrcDs2.setAllowLocalTransactions(true);
lrcDs2.getDriverProperties().setProperty("driverClassName", MockDriver.class.getName());
lrcDs2.getDriverProperties().setProperty("url", "");
lrcDs2.init();
tm.begin();
javax.jms.Connection c = pcf.createConnection();
javax.jms.Session s = c.createSession(true, 0);
javax.jms.MessageProducer p = s.createProducer(null);
p.send(null);
c.close();
Connection c2 = lrcDs2.getConnection();
try {
c2.createStatement();
fail("expected SQLException");
} catch (SQLException ex) {
assertTrue(ex.getMessage().startsWith("error enlisting a ConnectionJavaProxy of a JdbcPooledConnection from datasource pds2_lrc in state ACCESSIBLE with usage count 1 wrapping a JDBC LrcXAConnection on a JDBC LrcConnectionJavaProxy on Mock"));
assertTrue(ex.getCause().getMessage().startsWith("cannot enlist more than one non-XA resource, tried enlisting an XAResourceHolderState with uniqueName=pds2_lrc XAResource=a JDBC LrcXAResource in state NO_TX with XID null, already enlisted: an XAResourceHolderState with uniqueName=pcf_lrc XAResource=a JMS LrcXAResource in state STARTED of session Mock for Session"));
}
c2.close();
tm.commit();
lrcDs2.close();
pcf.close();
}