logger.debug("took object");
if (model != null) {
try {
FutureTask task = null;
if (model instanceof PatientVisitModel) {
task = new FutureTask(getPvtTask((PatientVisitModel) model));
logger.debug("created pvt FutureTask");
}
else if (model instanceof DocumentModel) {
task = new FutureTask(getDocumentTask((DocumentModel) model));
logger.debug("created document FutureTask");
}
logger.debug("start FutureTask");
new Thread(task).start();
task.get(120, TimeUnit.SECONDS);
logger.debug("got result within timeout");
} catch (InterruptedException ex) {
logger.warn(ex);
} catch (ExecutionException ex) {