private void handleContextException(final ContextClientCodeException e) {

    LOG.log(Level.SEVERE, "ContextClientCodeException", e);

    final ByteString exception = ByteString.copyFrom(this.exceptionCodec.toBytes(e.getCause()));

    final ReefServiceProtos.ContextStatusProto.Builder contextStatusBuilder =
        ReefServiceProtos.ContextStatusProto.newBuilder()
            .setContextId(e.getContextID())
            .setContextState(ReefServiceProtos.ContextStatusProto.State.FAIL)
            .setError(exception);

    if (e.getParentID().isPresent()) {
      contextStatusBuilder.setParentId(e.getParentID().get());
    }

    final ReefServiceProtos.ContextStatusProto contextStatus = contextStatusBuilder.build();

    LOG.log(Level.SEVERE, "Sending heartbeat: {0}", contextStatus);

    this.heartBeatManager.sendContextStatus(contextStatus);
  }
private void handleContextException ( final ContextClientCodeException e ) { LOG . log ( Level . SEVERE , "ContextClientCodeException" , e ) ; final ByteString exception = ByteString . copyFrom ( this . exceptionCodec . toBytes ( e . getCause ( ) ) ) ; final ReefServiceProtos . ContextStatusProto . Builder contextStatusBuilder = ReefServiceProtos . ContextStatusProto . newBuilder ( ) . setContextId ( e . getContextID ( ) ) . setContextState ( ReefServiceProtos . ContextStatusProto . State . FAIL ) . setError ( exception ) ; if ( e . getParentID ( ) . isPresent ( ) ) { contextStatusBuilder . setParentId ( e . getParentID ( ) . get ( ) ) ; } final ReefServiceProtos . ContextStatusProto contextStatus = contextStatusBuilder . build ( ) ; LOG . log ( Level . SEVERE , "Sending heartbeat: {0}" , contextStatus ) ; this . heartBeatManager . sendContextStatus ( contextStatus ) ; }
THIS ASSUMES THAT IT IS CALLED ON A THREAD HOLDING THE LOCK ON THE HeartBeatManager.