class GrpcStreamSubscription implements hera.api.model.Subscription<T> {

  @Override
  public void unsubscribe() {
    if (!context.isCancelled()) {
      synchronized (lock) {
        if (!context.isCancelled()) {
          logger.debug("Unsubscribe subscription");
          context.close();
        } else {
          logger.debug("Subscription is already cancelled");
        }
      }
    } else {
      logger.debug("Subscription is already cancelled");
    }
  }

}