Package io.airlift.dbpool

Examples of io.airlift.dbpool.H2EmbeddedDataSource


    @Singleton
    @ForLocalStorageManager
    public IDBI createLocalStorageManagerDBI(DatabaseLocalStorageManagerConfig config)
            throws Exception
    {
        return new DBI(new H2EmbeddedDataSource(new H2EmbeddedDataSourceConfig()
                .setFilename(new File(config.getDataDirectory(), "db/StorageManager").getAbsolutePath())
                .setMaxConnections(500)
                .setMaxConnectionWait(new Duration(1, SECONDS))));
    }
View Full Code Here


    @BeforeMethod
    public void setup()
            throws Exception
    {
        H2EmbeddedDataSourceConfig dataSourceConfig = new H2EmbeddedDataSourceConfig().setFilename("mem:");
        DataSource dataSource = new H2EmbeddedDataSource(dataSourceConfig);
        DBI h2Dbi = new DBI(dataSource);
        h2Dbi.registerMapper(new NativePartitionKey.Mapper(new TypeRegistry()));
        handle = h2Dbi.open();
        dao = handle.attach(ShardManagerDao.class);
View Full Code Here

    private static IDBI createDataSource(TypeRegistry typeRegistry, File databaseDir, String name)
            throws Exception
    {
        H2EmbeddedDataSourceConfig dataSourceConfig = new H2EmbeddedDataSourceConfig();
        dataSourceConfig.setFilename(new File(databaseDir, name).getAbsolutePath());
        H2EmbeddedDataSource dataSource = new H2EmbeddedDataSource(dataSourceConfig);
        DBI dbi = new DBI(dataSource);

        dbi.registerMapper(new TableColumnMapper(typeRegistry));
        dbi.registerMapper(new ColumnMetadataMapper(typeRegistry));
        dbi.registerMapper(new NativePartitionKey.Mapper(typeRegistry));
View Full Code Here

    @BeforeMethod
    public void setup()
            throws Exception
    {
        H2EmbeddedDataSourceConfig dataSourceConfig = new H2EmbeddedDataSourceConfig().setFilename("mem:");
        DataSource dataSource = new H2EmbeddedDataSource(dataSourceConfig);
        DBI h2Dbi = new DBI(dataSource);
        h2Dbi.registerMapper(new RaptorPartitionKey.Mapper(new TypeRegistry()));
        handle = h2Dbi.open();
        dao = handle.attach(ShardManagerDao.class);
View Full Code Here

    @Singleton
    @ForLocalStorageManager
    public IDBI createLocalStorageManagerDBI(DatabaseLocalStorageManagerConfig config)
            throws Exception
    {
        return new DBI(new H2EmbeddedDataSource(new H2EmbeddedDataSourceConfig()
                .setFilename(new File(config.getDataDirectory(), "db/StorageManager").getAbsolutePath())
                .setMaxConnections(500)
                .setMaxConnectionWait(new Duration(1, SECONDS))));
    }
View Full Code Here

    @BeforeMethod
    public void setup()
            throws Exception
    {
        H2EmbeddedDataSourceConfig dataSourceConfig = new H2EmbeddedDataSourceConfig().setFilename("mem:");
        DataSource dataSource = new H2EmbeddedDataSource(dataSourceConfig);
        DBI h2Dbi = new DBI(dataSource);
        handle = h2Dbi.open();
        dao = handle.attach(ShardManagerDao.class);

        ShardManagerDao.Utils.createShardTablesWithRetry(dao);
View Full Code Here

    private static IDBI createDataSource(File databaseDir, String name)
            throws Exception
    {
        H2EmbeddedDataSourceConfig dataSourceConfig = new H2EmbeddedDataSourceConfig();
        dataSourceConfig.setFilename(new File(databaseDir, name).getAbsolutePath());
        H2EmbeddedDataSource dataSource = new H2EmbeddedDataSource(dataSourceConfig);
        return new DBI(dataSource);
    }
View Full Code Here

    @Singleton
    @ForLocalStorageManager
    public IDBI createLocalStorageManagerDBI(DatabaseLocalStorageManagerConfig config)
            throws Exception
    {
        return new DBI(new H2EmbeddedDataSource(new H2EmbeddedDataSourceConfig()
                .setFilename(new File(config.getDataDirectory(), "db/StorageManager").getAbsolutePath())
                .setMaxConnections(500)
                .setMaxConnectionWait(new Duration(1, SECONDS))));
    }
View Full Code Here

TOP

Related Classes of io.airlift.dbpool.H2EmbeddedDataSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.