code: public void publish(Boolean dontStop) {
          // null is as good as false according to Boolean.valueOf() so if null, interpret as false
          if (dontStop == null || !dontStop) {
              IConnection conn = Red5.getConnectionLocal();
              if (conn instanceof IStreamCapableConnection) {
                  IStreamCapableConnection streamConn = (IStreamCapableConnection) conn;
                  Number streamId = conn.getStreamId();
                  IClientStream stream = streamConn.getStreamById(streamId);
                  if (stream instanceof IBroadcastStream) {
                      IBroadcastStream bs = (IBroadcastStream) stream;
                      if (bs.getPublishedName() != null) {
                          IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs.getPublishedName());
                          if (bsScope != null) {
                              bsScope.unsubscribe(bs.getProvider());
                              if (conn instanceof BaseConnection) {
                                  ((BaseConnection) conn).unregisterBasicScope(bsScope);
                              }
                          }
                          bs.close();
                          streamConn.deleteStreamById(streamId);
                      }
                  }
              }
          }
      }
docs: {@inheritDoc}