コード例 #1
0
  @Test(expected = JedisConnectionException.class)
  public void unsubscribeWhenNotSusbscribed() throws InterruptedException {
    JedisPubSub pubsub =
        new JedisPubSub() {
          public void onMessage(String channel, String message) {}

          public void onPMessage(String pattern, String channel, String message) {}

          public void onSubscribe(String channel, int subscribedChannels) {}

          public void onUnsubscribe(String channel, int subscribedChannels) {}

          public void onPUnsubscribe(String pattern, int subscribedChannels) {}

          public void onPSubscribe(String pattern, int subscribedChannels) {}
        };
    pubsub.unsubscribe();
  }
コード例 #2
0
    /** Interrupt the thread and stop the blocking subscription. */
    private void shutdown() {
      running.getAndSet(false);
      this.interrupt();

      try {
        if (subscriber != null) {
          subscriber.unsubscribe();
        }
      } finally {
        JedisUtils.closeJedis(sentinelJedis);
      }
    }
コード例 #3
0
 @Override
 public void onPSubscribe(String pattern, int subscribedChannels) {
   setReady();
   super.onPSubscribe(pattern, subscribedChannels);
 }
コード例 #4
0
 @Override
 public void onSubscribe(String channel, int subscribedChannels) {
   setReady();
   super.onSubscribe(channel, subscribedChannels);
 }
コード例 #5
0
ファイル: Jedis.java プロジェクト: jsncpr/jedis
 public void psubscribe(JedisPubSub jedisPubSub, String... patterns) {
   client.setTimeoutInfinite();
   jedisPubSub.proceedWithPatterns(client, patterns);
   client.rollbackTimeout();
 }
コード例 #6
0
ファイル: Jedis.java プロジェクト: jsncpr/jedis
 public void subscribe(JedisPubSub jedisPubSub, String... channels) {
   client.setTimeoutInfinite();
   jedisPubSub.proceed(client, channels);
   client.rollbackTimeout();
 }