Source:
public void writeBroadcast( ItemRef item, Optional<ContainerRef> containerRef, Optional<SeriesRef> seriesRef, Broadcast broadcast ) { try { BatchStatement batch = new BatchStatement(); Instant now = clock.now().toInstant(); org.atlasapi.content.v2.model.udt.Broadcast serialized = broadcastTranslator.serialize(broadcast); ImmutableSet<org.atlasapi.content.v2.model.udt.Broadcast> broadcasts = ImmutableSet.of(serialized); batch.add(accessor.addBroadcastToContent( item.getId().longValue(), broadcasts )); batch.add(accessor.setLastUpdated(item.getId().longValue(), now)); if (broadcast.isActivelyPublished() && broadcast.isUpcoming()) { org.atlasapi.content.v2.model.udt.ItemRef itemRef = itemRefTranslator.serialize(item); Map< org.atlasapi.content.v2.model.udt.ItemRef, List<org.atlasapi.content.v2.model.udt.BroadcastRef> > upcomingBroadcasts = ImmutableMap.of( itemRef, ImmutableList.of(broadcastRefTranslator.serialize(broadcast.toRef())) ); if (containerRef.isPresent()) { long id = containerRef.get().getId().longValue(); batch.add(accessor.addItemRefsToContainer( id, ImmutableSet.of(), upcomingBroadcasts, ImmutableMap.of() )); batch.add(accessor.setLastUpdated(id, now)); } if (seriesRef.isPresent()) { long id = seriesRef.get().getId().longValue(); batch.add(accessor.addItemRefsToContainer( id, ImmutableSet.of(itemRef), upcomingBroadcasts, ImmutableMap.of() )); batch.add(accessor.setLastUpdated(id, now)); } } session.execute(batch); sendMessages(ImmutableList.of(new ResourceUpdatedMessage( UUID.randomUUID().toString(), Timestamp.of(clock.now()), item ))); } catch (RuntimeException e) { failureMeter.mark(); Throwables.propagate(e); } }

Target:
public void writeBroadcast( ItemRef item, Optional<ContainerRef> containerRef, Optional<SeriesRef> seriesRef, Broadcast broadcast ) { metricRegistry.meter(writeBroadcast + METER_CALLED).mark(); try { BatchStatement batch = new BatchStatement(); Instant now = clock.now().toInstant(); org.atlasapi.content.v2.model.udt.Broadcast serialized = broadcastTranslator.serialize(broadcast); ImmutableSet<org.atlasapi.content.v2.model.udt.Broadcast> broadcasts = ImmutableSet.of(serialized); batch.add(accessor.addBroadcastToContent( item.getId().longValue(), broadcasts )); batch.add(accessor.setLastUpdated(item.getId().longValue(), now)); if (broadcast.isActivelyPublished() && broadcast.isUpcoming()) { org.atlasapi.content.v2.model.udt.ItemRef itemRef = itemRefTranslator.serialize(item); Map< org.atlasapi.content.v2.model.udt.ItemRef, List<org.atlasapi.content.v2.model.udt.BroadcastRef> > upcomingBroadcasts = ImmutableMap.of( itemRef, ImmutableList.of(broadcastRefTranslator.serialize(broadcast.toRef())) ); if (containerRef.isPresent()) { long id = containerRef.get().getId().longValue(); batch.add(accessor.addItemRefsToContainer( id, ImmutableSet.of(), upcomingBroadcasts, ImmutableMap.of() )); batch.add(accessor.setLastUpdated(id, now)); } if (seriesRef.isPresent()) { long id = seriesRef.get().getId().longValue(); batch.add(accessor.addItemRefsToContainer( id, ImmutableSet.of(itemRef), upcomingBroadcasts, ImmutableMap.of() )); batch.add(accessor.setLastUpdated(id, now)); } } session.execute(batch); sendMessages(ImmutableList.of(new ResourceUpdatedMessage( UUID.randomUUID().toString(), Timestamp.of(clock.now()), item ))); } catch (RuntimeException e) { metricRegistry.meter(writeBroadcast + METER_FAILURE).mark(); Throwables.propagate(e); } }