Package com.google.code.yanf4j.core

Examples of com.google.code.yanf4j.core.Session


  private final Collection<List<String>> catalogKeys(
      final Collection<String> keyCollections) {
    final Map<Session, List<String>> catalogMap = new HashMap<Session, List<String>>();

    for (String key : keyCollections) {
      Session index = this.sessionLocator.getSessionByKey(key);
      if (!catalogMap.containsKey(index)) {
        List<String> tmpKeys = new ArrayList<String>(100);
        tmpKeys.add(key);
        catalogMap.put(index, tmpKeys);
      } else {
View Full Code Here


    key = this.preProcessKey(key);
    final byte[] keyBytes = ByteUtils.getBytes(key);
    ByteUtils.checkKey(keyBytes);
    final Command command = this.commandFactory.createDeleteCommand(key,
        keyBytes, time, cas, noreply);
    final Session session = this.sendCommand(command);
    if (!command.isNoreply()) {
      this.latchWait(command, opTimeout, session);
      command.getIoBuffer().free();
      this.checkException(command);
      if (command.getResult() == null) {
View Full Code Here

          + address.getPort() + ",maybe it have not been connected");
    }

    Command command = this.commandFactory.createVerbosityCommand(latch,
        level, noreply);
    final Session session = sessionQueue.peek();
    session.write(command);
    if (!noreply) {
      this.latchWait(command, this.opTimeout, session);
    }
  }
View Full Code Here

          + SystemUtils.getRawAddress(address) + ":"
          + address.getPort() + ",maybe it have not been connected");
    }
    Command command = this.commandFactory.createFlushAllCommand(latch,
        exptime, noreply);
    final Session session = sessionQueue.peek();
    session.write(command);
    if (!noreply) {
      this.latchWait(command, timeout, session);
    }
  }
View Full Code Here

          + SystemUtils.getRawAddress(address) + ":"
          + address.getPort() + ",maybe it have not been connected");
    }
    Command command = this.commandFactory.createStatsCommand(address,
        latch, null);
    final Session session = sessionQueue.peek();
    session.write(command);
    this.latchWait(command, timeout, session);
    return (Map<String, String>) command.getResult();
  }
View Full Code Here

      TimeoutException, MemcachedException {
    final byte[] keyBytes = ByteUtils.getBytes(key);
    ByteUtils.checkKey(keyBytes);
    final Command command = this.commandFactory.createIncrDecrCommand(key,
        keyBytes, delta, initValue, exp, cmdType, noreply);
    final Session session = this.sendCommand(command);
    if (!command.isNoreply()) {
      this.latchWait(command, operationTimeout, session);
      command.getIoBuffer().free();
      this.checkException(command);
      if (command.getResult() == null) {
View Full Code Here

  }

  private final <T> boolean sendStoreCommand(Command command, long timeout)
      throws InterruptedException, TimeoutException, MemcachedException {

    final Session session = this.sendCommand(command);
    if (!command.isNoreply()) {
      this.latchWait(command, timeout, session);
      command.getIoBuffer().free();
      this.checkException(command);
      if (command.getResult() == null) {
View Full Code Here

    if (sessions == null || sessions.size() == 0) {
      throw new MemcachedException(
          "The special memcached server has not been connected,"
              + address);
    }
    Session session = sessions.peek();
    CountDownLatch latch = new CountDownLatch(1);
    Command command = this.commandFactory.createStatsCommand(
        session.getRemoteSocketAddress(), latch, "items");
    session.write(command);
    if (!latch.await(5000, TimeUnit.MILLISECONDS)) {
      throw new TimeoutException("Operation timeout");
    }
    if (command.getException() != null) {
      if (command.getException() instanceof MemcachedException) {
View Full Code Here

  private final Collection<List<String>> catalogKeys(
      final Collection<String> keyCollections) {
    final Map<Session, List<String>> catalogMap = new HashMap<Session, List<String>>();

    for (String key : keyCollections) {
      Session index = this.sessionLocator.getSessionByKey(key);
      if (!catalogMap.containsKey(index)) {
        List<String> tmpKeys = new ArrayList<String>(100);
        tmpKeys.add(key);
        catalogMap.put(index, tmpKeys);
      } else {
View Full Code Here

      final Map<String, Integer> keyExpMap) {
    final Map<Session, Map<String, Integer>> catalogMap = new HashMap<Session, Map<String, Integer>>();
    for (Map.Entry<String, Integer> entry : keyExpMap.entrySet()) {
      final String key = entry.getKey();
      final Integer expTime = entry.getValue();
      Session index = this.sessionLocator.getSessionByKey(key);
      if (!catalogMap.containsKey(index)) {
        Map<String, Integer> tmpKeyExpMap = new HashMap<String, Integer>(
            100);
        tmpKeyExpMap.put(key, expTime);
        catalogMap.put(index, tmpKeyExpMap);
View Full Code Here

TOP

Related Classes of com.google.code.yanf4j.core.Session

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.