Skip to content
This repository has been archived by the owner on Jan 3, 2019. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Minor refactoring
  • Loading branch information
ajs6f committed Dec 8, 2013
1 parent 9946b25 commit 833e68e
Showing 1 changed file with 20 additions and 12 deletions.
Expand Up @@ -66,8 +66,13 @@ public class SparqlIndexer implements Indexer {

private static final Logger LOGGER = getLogger(SparqlIndexer.class);

/**
* Number of threads to use for operating against the triplestore.
*/
private static final Integer THREAD_POOL_SIZE = 5;

private ListeningExecutorService executorService =
listeningDecorator(newFixedThreadPool(10));
listeningDecorator(newFixedThreadPool(THREAD_POOL_SIZE));

/**
* Remove any current triples about the Fedora object and replace them with
Expand Down Expand Up @@ -187,17 +192,20 @@ public void run() {

@Override
public void run() {
try (final OutputStream buffer = new ByteArrayOutputStream()) {
final IndentedWriter out = new IndentedWriter(buffer);
update.output(out);
LOGGER.trace(
"Executed update/remove operation:\n{}",
buffer.toString());
out.close();
} catch (final IOException e) {
LOGGER.error(
"Couldn't retrieve execution of update/remove operation!",
e);
LOGGER.debug("Completed Sparql update/removal.");
if (LOGGER.isTraceEnabled()) {
try (
final OutputStream buffer = new ByteArrayOutputStream()) {
final IndentedWriter out = new IndentedWriter(buffer);
update.output(out);
LOGGER.trace("Executed update/remove operation:\n{}",
buffer.toString());
out.close();
} catch (final IOException e) {
LOGGER.error(
"Couldn't retrieve execution of update/remove operation!",
e);
}
}
}
}, executorService);
Expand Down

0 comments on commit 833e68e

Please sign in to comment.