private boolean closeInternal(ErrorCode errorCode){
  assert (!Thread.holdsLock(this));
synchronized (this) {
    if (this.errorCode != null) {
      return false;
    }
    if (source.finished && sink.finished) {
      return false;
    }
    this.errorCode=errorCode;
    notifyAll();
  }
  connection.removeStream(id);
  return true;
}

private boolean closeInternal ( ErrorCode errorCode ) { assert ( ! Thread . holdsLock ( this ) ) ; synchronized ( this ) { if ( this . errorCode != null ) { return false ; } if ( source . finished && sink . finished ) { return false ; } this . errorCode = errorCode ; notifyAll ( ) ; } connection . removeStream ( id ) ; return true ; }
returns true if this stream was closed .
