@RetryTransaction(2)
public void updateOrInsertServerInfo() {
logger.info("start update/insert server info");
List<ServerInfoEntity> entities = serverInfoDao.findAll();
if (entities != null && entities.size() == 1) {
ServerInfoEntity entity = entities.get(0);
if (!entity.isResourceInitialized()) {
entity.setResourceInitialized(true);
entity.setVersion(Configuration
.getNonEmptyString("serengeti.version"));
serverInfoDao.update(entity);
logger.info("updated server info.");
}
} else {
ServerInfoEntity entity = new ServerInfoEntity();
entity.setResourceInitialized(true);
entity.setVersion(Configuration
.getNonEmptyString("serengeti.version"));
serverInfoDao.insert(entity);
logger.info("inserted server info.");
}
}