Package redis.clients.jedis.exceptions

Examples of redis.clients.jedis.exceptions.JedisException


  if (master == null) {
      if (sentinelAvailable) {
    // can connect to sentinel, but master name seems to not
    // monitored
    throw new JedisException("Can connect to sentinel, but "
      + masterName + " seems to be not monitored...");
      } else {
    throw new JedisConnectionException(
      "All sentinels down, cannot determine where is "
        + masterName + " master is running...");
View Full Code Here


    Thread.sleep(sleepInterval);
      } catch (InterruptedException e) {
      }
  }

  throw new JedisException("Node handshaking is not ended");
    }
View Full Code Here

    Thread.sleep(sleepInterval);
      } catch (InterruptedException e) {
      }
  }

  throw new JedisException("Node recognize check error");
    }
View Full Code Here

    private void process(Client client) {
  do {
      List<Object> reply = client.getObjectMultiBulkReply();
      final Object firstObj = reply.get(0);
      if (!(firstObj instanceof byte[])) {
    throw new JedisException("Unknown message type: " + firstObj);
      }
      final byte[] resp = (byte[]) firstObj;
      if (Arrays.equals(SUBSCRIBE.raw, resp)) {
    subscribedChannels = ((Long) reply.get(2)).intValue();
    final byte[] bchannel = (byte[]) reply.get(1);
    onSubscribe(bchannel, subscribedChannels);
      } else if (Arrays.equals(UNSUBSCRIBE.raw, resp)) {
    subscribedChannels = ((Long) reply.get(2)).intValue();
    final byte[] bchannel = (byte[]) reply.get(1);
    onUnsubscribe(bchannel, subscribedChannels);
      } else if (Arrays.equals(MESSAGE.raw, resp)) {
    final byte[] bchannel = (byte[]) reply.get(1);
    final byte[] bmesg = (byte[]) reply.get(2);
    onMessage(bchannel, bmesg);
      } else if (Arrays.equals(PMESSAGE.raw, resp)) {
    final byte[] bpattern = (byte[]) reply.get(1);
    final byte[] bchannel = (byte[]) reply.get(2);
    final byte[] bmesg = (byte[]) reply.get(3);
    onPMessage(bpattern, bchannel, bmesg);
      } else if (Arrays.equals(PSUBSCRIBE.raw, resp)) {
    subscribedChannels = ((Long) reply.get(2)).intValue();
    final byte[] bpattern = (byte[]) reply.get(1);
    onPSubscribe(bpattern, subscribedChannels);
      } else if (Arrays.equals(PUNSUBSCRIBE.raw, resp)) {
    subscribedChannels = ((Long) reply.get(2)).intValue();
    final byte[] bpattern = (byte[]) reply.get(1);
    onPUnsubscribe(bpattern, subscribedChannels);
      } else {
    throw new JedisException("Unknown message type: " + firstObj);
      }
  } while (isSubscribed());
    }
View Full Code Here

      return;
  }
  try {
      internalPool.returnObject(resource);
  } catch (Exception e) {
      throw new JedisException(
        "Could not return the resource to the pool", e);
  }
    }
View Full Code Here

    protected void returnBrokenResourceObject(final T resource) {
  try {
      internalPool.invalidateObject(resource);
  } catch (Exception e) {
      throw new JedisException(
        "Could not return the resource to the pool", e);
  }
    }
View Full Code Here

    protected void closeInternalPool() {
  try {
      internalPool.close();
  } catch (Exception e) {
      throw new JedisException("Could not destroy the pool", e);
  }
    }
View Full Code Here

  do {
      List<Object> reply = client.getRawObjectMultiBulkReply();
      final Object firstObj = reply.get(0);
      if (!(firstObj instanceof byte[])) {
    throw new JedisException("Unknown message type: " + firstObj);
      }
      final byte[] resp = (byte[]) firstObj;
      if (Arrays.equals(SUBSCRIBE.raw, resp)) {
    subscribedChannels = ((Long) reply.get(2)).intValue();
    final byte[] bchannel = (byte[]) reply.get(1);
    final String strchannel = (bchannel == null) ? null
      : SafeEncoder.encode(bchannel);
    onSubscribe(strchannel, subscribedChannels);
      } else if (Arrays.equals(UNSUBSCRIBE.raw, resp)) {
    subscribedChannels = ((Long) reply.get(2)).intValue();
    final byte[] bchannel = (byte[]) reply.get(1);
    final String strchannel = (bchannel == null) ? null
      : SafeEncoder.encode(bchannel);
    onUnsubscribe(strchannel, subscribedChannels);
      } else if (Arrays.equals(MESSAGE.raw, resp)) {
    final byte[] bchannel = (byte[]) reply.get(1);
    final byte[] bmesg = (byte[]) reply.get(2);
    final String strchannel = (bchannel == null) ? null
      : SafeEncoder.encode(bchannel);
    final String strmesg = (bmesg == null) ? null : SafeEncoder
      .encode(bmesg);
    onMessage(strchannel, strmesg);
      } else if (Arrays.equals(PMESSAGE.raw, resp)) {
    final byte[] bpattern = (byte[]) reply.get(1);
    final byte[] bchannel = (byte[]) reply.get(2);
    final byte[] bmesg = (byte[]) reply.get(3);
    final String strpattern = (bpattern == null) ? null
      : SafeEncoder.encode(bpattern);
    final String strchannel = (bchannel == null) ? null
      : SafeEncoder.encode(bchannel);
    final String strmesg = (bmesg == null) ? null : SafeEncoder
      .encode(bmesg);
    onPMessage(strpattern, strchannel, strmesg);
      } else if (Arrays.equals(PSUBSCRIBE.raw, resp)) {
    subscribedChannels = ((Long) reply.get(2)).intValue();
    final byte[] bpattern = (byte[]) reply.get(1);
    final String strpattern = (bpattern == null) ? null
      : SafeEncoder.encode(bpattern);
    onPSubscribe(strpattern, subscribedChannels);
      } else if (Arrays.equals(PUNSUBSCRIBE.raw, resp)) {
    subscribedChannels = ((Long) reply.get(2)).intValue();
    final byte[] bpattern = (byte[]) reply.get(1);
    final String strpattern = (bpattern == null) ? null
      : SafeEncoder.encode(bpattern);
    onPUnsubscribe(strpattern, subscribedChannels);
      } else {
    throw new JedisException("Unknown message type: " + firstObj);
      }
  } while (isSubscribed());

  /* Invalidate instance since this thread is no longer listening */
  this.client = null;
View Full Code Here

    throw new JedisDataException(
      "value sent to redis cannot be null");
      }
      return str.getBytes(Protocol.CHARSET);
  } catch (UnsupportedEncodingException e) {
      throw new JedisException(e);
  }
    }
View Full Code Here

    public static String encode(final byte[] data) {
  try {
      return new String(data, Protocol.CHARSET);
  } catch (UnsupportedEncodingException e) {
      throw new JedisException(e);
  }
    }
View Full Code Here

TOP

Related Classes of redis.clients.jedis.exceptions.JedisException

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.