code: public void add(final ItemReference ref, final Transaction transaction)
                      throws ProtocolException, OutOfCacheSpace, StreamIsFull, TransactionException, PersistenceException, SevereMessageStoreException
      {
  
          // default lock id
          long lockId = NO_LOCK_ID;
  
          // delivery delay is set, hence DELIVERY_DELAY_LOCK_ID will be used to lock the Item
          if (ref.getDeliveryDelay() > 0)
              lockId = DELIVERY_DELAY_LOCK_ID;
  
          add(ref, lockId, transaction);
  
      }
docs: Add an {@link ItemReference} to a reference stream under a transaction. An Item
  can only be added onto one stream at a time. .
  <p>
  A reference to an item can only be put to an {@link ReferenceStream} in the same
  transaction that the item is put to an {@link ItemStream}. This is so that
  we can perform reference counting on commits.
  </p>
  <p>
  A reference can only be placed into a {@link ReferenceStream} that is contained
  directly in the same {@link ItemStream} as the referred {@link Item}.
  </p>
  <p>This method can be overridden by subclass implementors in order to
  customize the behaviour of the stream. Any override should call the superclass
  implementation to maintain correct behaviour.</p>
  
  @param ref
  @param transaction
  @throws SevereMessageStoreException
  @throws {@link OutOfCacheSpace} if there is not enough space in the
  unstoredCache and the storage strategy is {@link AbstractItem#STORE_NEVER}.
  @throws {@link StreamIsFull} if the size of the stream would exceed the
  maximum permissable size if an add were performed.
  @throws {@ProtocolException} Thrown if an add is attempted when the
  transaction cannot allow any further work to be added i.e. after
  completion of the transaction.
  @throws {@TransactionException} Thrown if an unexpected error occurs.
  @throws {@PersistenceException} Thrown if a database error occurs.