use of org.dcache.util.CDCExecutorServiceDecorator in project dcache by dCache.
the class UnpinProcessor method run.
@Override
public void run() {
final ExecutorService executor = new CDCExecutorServiceDecorator(Executors.newSingleThreadExecutor());
NDC.push("BackgroundUnpinner-" + _count.incrementAndGet());
try {
Semaphore idle = new Semaphore(MAX_RUNNING);
unpin(idle, executor);
idle.acquire(MAX_RUNNING);
} catch (InterruptedException e) {
LOGGER.debug(e.toString());
} catch (JDOException | DataAccessException e) {
LOGGER.error("Database failure while unpinning: {}", e.getMessage());
} catch (RemoteConnectFailureException e) {
LOGGER.error("Remote connection failure while unpinning: {}", e.getMessage());
} catch (RuntimeException e) {
LOGGER.error("Unexpected failure while unpinning", e);
} finally {
executor.shutdown();
NDC.pop();
}
}
Aggregations