Exemplo n.º 1
0
 /**
  * Changes the list stored at the given key, i.e. first adds all items in <tt>toAdd</tt> then
  * removes all items in <tt>toRemove</tt>. Assumes en empty list if no value exists at
  * <tt>key</tt>.
  *
  * @param key the key to write the value to
  * @param toAdd a list of values to add to a list
  * @param toRemove a list of values to remove from a list
  * @throws ConnectionException if the connection is not active or a communication error occurs or
  *     an exit signal was received or the remote node sends a message containing an invalid cookie
  * @throws TimeoutException if a timeout occurred while trying to write the value
  * @throws NotAListException if the previously stored value was no list
  * @throws UnknownException if any other error occurs
  * @since 3.9
  */
 public void addDelOnList(
     final OtpErlangObject key, final OtpErlangList toAdd, final OtpErlangList toRemove)
     throws ConnectionException, TimeoutException, NotAListException, UnknownException {
   try {
     final RequestList reqs = new RequestList();
     reqs.addAddDelOnList(key, toAdd, toRemove);
     final ResultList result = req_list(reqs);
     if (result.size() == 1) {
       result.processAddDelOnListAt(0);
     } else {
       throw new UnknownException(result.getResults());
     }
   } catch (final AbortException e) {
     // should not occur (we did not commit anything)
     throw new UnknownException(e);
   }
 }