Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions conciliator.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ cache.ttl=3600
# e.g. 128kB, 128MB, 128GB
cache.size=64MB

#### VIAF data source configuration

datasource.viaf.threadpool.size=3

#### Sample Solr data source configuration

## Name that will appear in OpenRefine's reconciliation interface
Expand Down
1 change: 1 addition & 0 deletions run_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ docker run \
-p 127.0.0.1:8082:8082 \
-e TZ=`cat /etc/timezone` \
-v "$(pwd)/conciliator.log:/opt/conciliator/conciliator.log" \
-v "$(pwd)/conciliator.properties:/opt/conciliator/conciliator.properties" \
conciliator:latest
3 changes: 3 additions & 0 deletions src/main/java/com/codefork/refine/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public class Config {
public static final String PROP_CACHE_TTL = "cache.ttl";
public static final String PROP_CACHE_SIZE = "cache.size";

public static final String PROP_DATASOURCE_THREADPOOL_SIZE = "threadpool.size";

private static final String CONFIG_FILENAME = "conciliator.properties";

private Log log = LogFactory.getLog(Config.class);
Expand All @@ -29,6 +31,7 @@ public Config() {
properties.put(PROP_CACHE_TTL, "3600");
properties.put(PROP_CACHE_SIZE, "64MB");

properties.put("datasource.viaf." + PROP_DATASOURCE_THREADPOOL_SIZE, "3");
properties.put("datasource.orcid.name", "ORCID");
properties.put("datasource.orcidsmartnames.name", "ORCID - Smart Names Mode");
properties.put("datasource.openlibrary.name", "OpenLibrary");
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/codefork/refine/ThreadPool.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public int getPoolSize() {
}

public void setPoolSize(int newSize) {
log.info("Setting thread pool size = " + newSize);
if(newSize > executor.getCorePoolSize()) {
executor.setMaximumPoolSize(newSize);
executor.setCorePoolSize(newSize);
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/codefork/refine/viaf/VIAF.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
@Component("viaf")
public class VIAF extends WebServiceDataSource {

public static final String PROP_THREADPOOL_SIZE = "threadpool.size";

private SAXParserFactory spf;

private VIAFSource viafSource = null;
Expand All @@ -53,6 +55,8 @@ public VIAF(Config config, CacheManager cacheManager, ThreadPoolFactory threadPo

setCacheEnabled(true);

getThreadPool().setPoolSize(Integer.parseInt(getConfigProperties().getProperty(Config.PROP_DATASOURCE_THREADPOOL_SIZE)));

spf = SAXParserFactory.newInstance();
}

Expand Down
3 changes: 2 additions & 1 deletion src/test/java/com/codefork/refine/ConfigTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public void testBasic() throws Exception {
Config config = new Config();
config.merge(properties);
Properties dsProps = config.getDataSourceProperties("viaf");
assertEquals(1, dsProps.size());
assertEquals(2, dsProps.size());
assertEquals(dsProps.getProperty(Config.PROP_DATASOURCE_THREADPOOL_SIZE), "3");
assertEquals(dsProps.getProperty("somekey"), "2000");

Properties dsProps2 = config.getDataSourceProperties("nonexistent");
Expand Down