- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {DateTime d =
new DateTime()
DateTimeFormatter formatter;String text;formatter.parseDateTime(text)
Object instant;new DateTime(instant)
- Smart code suggestions by Codota
}
public Integer getCountFromCache(String dbCollectionName){ return countCache.getObject(dbCollectionName); }
@Override public Repository getRepository(String repositoryName) { Repository repo = null; BasicDBObject query = new BasicDBObject(); query.put(Repository.REPOSITORY_FIELD_NAME, repositoryName); query.put(Repository.STATE_FIELD, Repository.StateEnum.normal.toString()); boolean suggestRefresh = false; DBObject object = repoCollection.findOne(query); if (object != null) { repo = cache.getObject(repositoryName); if (repo == null) { suggestRefresh = true; } } else if (cache.getObject(repositoryName) != null) { suggestRefresh = true; } // find something different between the cache and the read db. if (suggestRefresh) { refreshRepositoryCache(); repo = cache.getObject(repositoryName); } if (repo == null) { throw new RepositoryNotExistsException(repositoryName); } return repo; }
@Test public void cacheTest() { ExpirableCache<String> cache = new ExpirableCache<String>(100, 60); for (String i : c) { cache.putObject(i, i); } for (String i : c) { String o = cache.getObject(i); assertTrue(o == c[Integer.valueOf(o)]); } }