void persistMovie(Movie movie) throws Exception { String newValue = movieObjectWriter.writeValueAsString(movie); String oldValue = movieMap.get(movie.getDbId()); if (!StringUtils.equals(newValue, oldValue)) { // write movie to DB movieMap.put(movie.getDbId(), newValue); } }
void removeMovieFromDb(Movie movie) throws Exception { movieMap.remove(movie.getDbId()); }