private void scheduleKeepAlive() {
    if (keepAlive != null)
      keepAlive.cancel();
    keepAlive = context.schedule(interval, () -> {
      keepAlive = null;
      if (state.getState().active()) {
        keepAlive();
      }
    });
  }
private void scheduleKeepAlive ( ) { if ( keepAlive != null ) keepAlive . cancel ( ) ; keepAlive = context . schedule ( interval , ( ) -> { keepAlive = null ; if ( state . getState ( ) . active ( ) ) { keepAlive ( ) ; } } ) ; }
Schedules a keep-alive request.