/** * Gets the. * * @param params the params * @return the mongo state */ public MongoState get(final ObjectNode params) { final MongoStateConfig config = MongoStateConfig.decorate(params); final String id = config.getId(); MongoState result = null; try { synchronized (this) { result = getCollection().findOne("{_id: #}", id).as(MongoState.class); if (result == null) { result = new MongoState(id, this, params); getCollection().insert(result); } else { result.setService(this); } } result.setCollection(getCollection()); } catch (final Exception e) { LOG.log(Level.WARNING, "get error", e); } return result; }