Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. serviceRegistration = bundleContext.registerService(IConnector.class.getName(), new Connector(), null);
  2.  
  3. serviceRegistration = bundleContext.registerService(Connector.class.getName(), new Connector(), null);
  4.  
  5. userDBConnectorTracker = new ServiceTracker(context, IConnector.class.getName(), this);
  6.  
  7. userDBConnectorTracker = new ServiceTracker(context, Connector.class.getName(), this);
  8.  
  9. public class HikariCPDataSource {
  10.  
  11. private static HikariConfig config = new HikariConfig();
  12. private static HikariDataSource ds;
  13.  
  14. static {
  15. config.setJdbcUrl("jdbc:h2:mem:test");
  16. config.setUsername("user");
  17. config.setPassword("password");
  18. config.addDataSourceProperty("cachePrepStmts", "true");
  19. config.addDataSourceProperty("prepStmtCacheSize", "250");
  20. config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
  21. ds = new HikariDataSource(config);
  22. }
  23.  
  24. public static Connection getConnection() throws SQLException {
  25. return ds.getConnection();
  26. }
  27.  
  28. private HikariCPDataSource(){}
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement