src/main/java/org/embulk/output/JdbcOutputPlugin.java in embulk-output-jdbc-0.2.0 vs src/main/java/org/embulk/output/JdbcOutputPlugin.java in embulk-output-jdbc-0.2.1

- old
+ new

@@ -1,19 +1,14 @@ package org.embulk.output; -import java.nio.file.Paths; -import java.util.Set; -import java.util.HashSet; import java.util.Properties; import java.sql.Driver; import java.io.IOException; import java.sql.Connection; import java.sql.SQLException; import com.google.common.base.Optional; import com.google.common.base.Throwables; -import org.embulk.spi.Exec; -import org.embulk.spi.PluginClassLoader; import org.embulk.config.Config; import org.embulk.config.ConfigDefault; import org.embulk.output.jdbc.AbstractJdbcOutputPlugin; import org.embulk.output.jdbc.BatchInsert; import org.embulk.output.jdbc.StandardBatchInsert; @@ -21,12 +16,10 @@ import org.embulk.output.jdbc.JdbcOutputConnection; public class JdbcOutputPlugin extends AbstractJdbcOutputPlugin { - private final static Set<String> loadedJarGlobs = new HashSet<String>(); - public interface GenericPluginTask extends PluginTask { @Config("driver_path") @ConfigDefault("null") public Optional<String> getDriverPath(); @@ -60,17 +53,11 @@ protected GenericOutputConnector getConnector(PluginTask task, boolean retryableMetadataOperation) { GenericPluginTask t = (GenericPluginTask) task; if (t.getDriverPath().isPresent()) { - synchronized (loadedJarGlobs) { - String glob = t.getDriverPath().get(); - if (!loadedJarGlobs.contains(glob)) { - loadDriverJar(glob); - loadedJarGlobs.add(glob); - } - } + loadDriverJar(t.getDriverPath().get()); } Properties props = new Properties(); if (t.getUser().isPresent()) { props.setProperty("user", t.getUser().get()); @@ -81,16 +68,9 @@ props.putAll(t.getOptions()); return new GenericOutputConnector(t.getUrl(), props, t.getDriverClass(), t.getSchema().orNull()); - } - - private void loadDriverJar(String glob) - { - // TODO match glob - PluginClassLoader loader = (PluginClassLoader) getClass().getClassLoader(); - loader.addPath(Paths.get(glob)); } private static class GenericOutputConnector implements JdbcOutputConnector {