List of usage examples for org.springframework.web.client ResourceAccessException ResourceAccessException
public ResourceAccessException(String msg)
From source file:org.venice.piazza.servicecontroller.data.mongodb.accessors.MongoAccessor.java
/** * Returns a Job that matches the specified Id. * // ww w . ja va 2 s . co m * @param jobId * Job Id * @return The Job with the specified Id * @throws InterruptedException */ public Job getJobById(String jobId) throws ResourceAccessException, InterruptedException { BasicDBObject query = new BasicDBObject("jobId", jobId); Job job; try { if ((job = getJobCollection().findOne(query)) == null) { // In case the Job was being updated, or it doesn't exist at this point, try once more. I admit this is // not optimal, but it certainly covers a host of race conditions. Thread.sleep(100); job = getJobCollection().findOne(query); } } catch (MongoTimeoutException mte) { LOGGER.error(mte.getMessage(), mte); throw new ResourceAccessException("MongoDB instance not available."); } return job; }