All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.lontime.extquartz.common.PooledExtConnectionProvider Maven / Gradle / Ivy

There is a newer version: 1.4.0
Show newest version
package com.github.lontime.extquartz.common;

import java.sql.Connection;
import java.sql.SQLException;

import com.github.lontime.extdatasource.DatasourceInstance;
import com.github.lontime.extquartz.configuration.JobStoreOption;
import org.quartz.utils.ConnectionProvider;

/**
 * PooledExtConnectionProvider.
 * @author lontime
 * @since 1.0
 */
public class PooledExtConnectionProvider implements ConnectionProvider {

    private final JobStoreOption option;

    public PooledExtConnectionProvider(JobStoreOption option1) {
        this.option = option1;
    }

    @Override
    public Connection getConnection() throws SQLException {
        if (option == null || option.getDataSource() == null) {
            return DatasourceInstance.get().getDataSource().getConnection();
        }
        return DatasourceInstance.get().getDataSource(option.getDataSource()).getConnection();
    }

    @Override
    public void shutdown() throws SQLException {

    }

    @Override
    public void initialize() throws SQLException {

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy