protected void modified()

in src/main/java/org/apache/sling/datasource/internal/DataSourceFactory.java [213:230]


    protected void modified(Map<String, ?> config) throws Exception {
        String name = getDataSourceName(config);
        String svcPropName = getSvcPropName(config);

        if (!this.name.equals(name) || !this.svcPropName.equals(svcPropName)) {
            log.info("Change in datasource name/service property name detected. DataSource would be recreated");
            deactivate();
            activate(bundleContext, config);
            return;
        }

        //Other modifications can be applied at runtime itself
        //Tomcat Connection Pool is decoupled from DataSource so can be closed and reset
        dataSource.setPoolProperties(createPoolConfig(config));
        closeConnectionPool();
        dataSource.createPool();
        log.info("Updated DataSource [{}] with properties {}", name, dataSource.getPoolProperties().toString());
    }