Java Code Examples for org.davidmoten.rx.jdbc.Database#from()
The following examples show how to use
org.davidmoten.rx.jdbc.Database#from() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EmployeeRepository.java From webflux-rxjava2-jdbc-example with Apache License 2.0 | 5 votes |
public EmployeeRepository() throws Exception { Connection connection = DriverManager.getConnection("jdbc:h2:./build/mydatabase", "sa", "sa"); NonBlockingConnectionPool pool = Pools.nonBlocking() .maxPoolSize(Runtime.getRuntime().availableProcessors() * 5) .connectionProvider(ConnectionProvider.from(connection)) .build(); this.db = Database.from(pool); }
Example 2
Source File: DatabaseConfiguration.java From Hands-On-Reactive-Programming-in-Spring-5 with MIT License | 5 votes |
@Bean public Database database( @Value("${spring.datasource.url}") String uri, @Value("${rxjava2jdbc.pool.size}") Integer poolSize ) { Database db = Database .from(uri, poolSize); initializeDatabase(db) .block(); return db; }
Example 3
Source File: DatabaseCreator.java From rxjava2-jdbc with Apache License 2.0 | 5 votes |
private static Database createDerby(int maxSize, boolean withStoredProcs) { return Database.from(Pools.nonBlocking() // .connectionProvider(connectionProviderDerby(nextUrlDerby(), withStoredProcs)) // .maxPoolSize(maxSize) // .scheduler(Schedulers.from(Executors.newFixedThreadPool(maxSize))) // .build()); }
Example 4
Source File: DatabaseCreator.java From rxjava2-jdbc with Apache License 2.0 | 5 votes |
public static Database create(int maxSize, boolean big, Scheduler scheduler) { NonBlockingConnectionPool pool = Pools.nonBlocking() // .connectionProvider(connectionProvider(nextUrl(), big)) // .maxPoolSize(maxSize) // .scheduler(scheduler) // .build(); return Database.from(pool, () -> { pool.close(); scheduler.shutdown(); }); }
Example 5
Source File: RxJdbcConfig.java From FrameworkBenchmarks with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Bean public Database database(DataSourceProperties dsProps) throws SQLException { NonBlockingConnectionPool pool = Pools.nonBlocking() .maxPoolSize(Runtime.getRuntime().availableProcessors() * 2) .connectionProvider(ConnectionProvider.from(dsProps.getUrl(), dsProps.getUsername(), dsProps.getPassword())) .build(); Database db = Database.from(pool); return db; }
Example 6
Source File: WalletServiceImpl.java From Hands-On-Reactive-Programming-in-Spring-5 with MIT License | 4 votes |
public WalletServiceImpl(String dbUri, int poolSize) { this.database = Database.from(dbUri, poolSize); }