Example #1
0
 /**
  * Gets the value stored under the given <code>key</code>.
  *
  * @param key the key to look up
  * @return the value stored under the given <code>key</code>
  * @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 fetch the value
  * @throws NotFoundException if the requested key does not exist
  * @throws UnknownException if any other error occurs
  * @since 2.9
  */
 public ErlangValue read(final OtpErlangString key)
     throws ConnectionException, TimeoutException, NotFoundException, UnknownException {
   try {
     final ResultList result = req_list((RequestList) new RequestList().addRead(key));
     if (result.size() == 1) {
       return result.processReadAt(0);
     }
     throw new UnknownException(result.getResults());
   } catch (final AbortException e) {
     // should not occur (we did not commit anything)
     throw new UnknownException(e);
   }
 }