Package org.eclipse.jetty.nosql.kvs

Examples of org.eclipse.jetty.nosql.kvs.KeyValueStoreClientException


   
    this._builder = getClientBuilder(_serverString);
    try {
      this._client = _builder.build();
    } catch (IOException error) {
      throw(new KeyValueStoreClientException(error));
    }
    return true;
  }
View Full Code Here


  public boolean shutdown() throws KeyValueStoreClientException {
    if (_client != null) {
      try {
        _client.shutdown();
      } catch (IOException error) {
        throw(new KeyValueStoreClientException(error));
      } finally {
        _client = null;
      }
    }
    return true;
View Full Code Here

    return this._client != null && !this._client.isShutdown();
  }

  public byte[] get(String key) throws KeyValueStoreClientException {
    if (!isAlive()) {
      throw(new KeyValueStoreClientException(new IllegalStateException("client not established")));
    }
    byte[] raw = null;
    try {
      raw = _client.get(key);
    } catch (Exception error) {
      throw(new KeyValueStoreClientException(error));
    }
    return raw;
  }
View Full Code Here

    return this.set(key, raw, FOREVER);
  }

  public boolean set(String key, byte[] raw, int exp) throws KeyValueStoreClientException {
    if (!isAlive()) {
      throw(new KeyValueStoreClientException(new IllegalStateException("client not established")));
    }
    boolean result = false;
    try {
      result = _client.set(key, exp, raw);
    } catch (Exception error) {
      throw(new KeyValueStoreClientException(error));
    }
    return result;
  }
View Full Code Here

    return this.add(key, raw, FOREVER);
  }

  public boolean add(String key, byte[] raw, int exp) throws KeyValueStoreClientException {
    if (!isAlive()) {
      throw(new KeyValueStoreClientException(new IllegalStateException("client not established")));
    }
    boolean result = false;
    try {
      result = _client.add(key, exp, raw);
    } catch (Exception error) {
      throw(new KeyValueStoreClientException(error));
    }
    return result;
  }
View Full Code Here

    return result;
  }

  public boolean delete(String key) throws KeyValueStoreClientException {
    if (!isAlive()) {
      throw(new KeyValueStoreClientException(new IllegalStateException("client not established")));
    }
    boolean result = false;
    try {
      result = _client.delete(key);
    } catch (Exception error) {
      throw(new KeyValueStoreClientException(error));
    }
    return result;
  }
View Full Code Here

        this._client = new MemcachedClient(AddrUtil.getAddresses(_serverString));
      } else {
        this._client = new MemcachedClient(cf, AddrUtil.getAddresses(_serverString));
      }
    } catch (IOException error) {
      throw(new KeyValueStoreClientException(error));
    }
    return true;
  }
View Full Code Here

    return _client != null;
  }

  public byte[] get(String key) throws KeyValueStoreClientException {
    if (!isAlive()) {
      throw(new KeyValueStoreClientException(new IllegalStateException("client not established")));
    }
    byte[] raw = null;
    try {
      Future<byte[]> f = _client.asyncGet(key, _transcoder);
      raw = f.get(_timeoutInMs, TimeUnit.MILLISECONDS);
    } catch (Exception error) {
      throw(new KeyValueStoreClientException(error));
    }
    return raw;
  }
View Full Code Here

    return this.set(key, raw, FOREVER);
  }

  public boolean set(String key, byte[] raw, int exp) throws KeyValueStoreClientException {
    if (!isAlive()) {
      throw(new KeyValueStoreClientException(new IllegalStateException("client not established")));
    }
    boolean result;
    try {
      Future<Boolean> f = _client.set(key, exp, raw, _transcoder);
      result = f.get(_timeoutInMs, TimeUnit.MILLISECONDS);
    } catch (Exception error) {
      throw(new KeyValueStoreClientException(error));
    }
    return result;
  }
View Full Code Here

    return this.add(key, raw, FOREVER);
  }

  public boolean add(String key, byte[] raw, int exp) throws KeyValueStoreClientException {
    if (!isAlive()) {
      throw(new KeyValueStoreClientException(new IllegalStateException("client not established")));
    }
    boolean result;
    try {
      Future<Boolean> f = _client.add(key, exp, raw, _transcoder);
      result = f.get(_timeoutInMs, TimeUnit.MILLISECONDS);
    } catch (Exception error) {
      throw(new KeyValueStoreClientException(error));
    }
    return result;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.nosql.kvs.KeyValueStoreClientException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.