Пример #1
0
    @Override
    public void run() {
      boolean broken = false;
      try (Jedis rsc = pool.getResource()) {
        try {
          jpsh = new JedisPubSubHandler();
          rsc.subscribe(
              jpsh,
              "redisbungee-" + configuration.getServerId(),
              "redisbungee-allservers",
              "redisbungee-data");
        } catch (Exception e) {
          // FIXME: Extremely ugly hack
          // Attempt to unsubscribe this instance and try again.
          getLogger().log(Level.INFO, "PubSub error, attempting to recover.", e);
          jpsh.unsubscribe();
          broken = true;
        }
      }

      if (broken) {
        run();
      }
    }
Пример #2
0
 public void poison() {
   jpsh.unsubscribe();
 }
Пример #3
0
 public void removeChannel(String... channel) {
   jpsh.unsubscribe(channel);
 }
Пример #4
0
 public void addChannel(String... channel) {
   jpsh.subscribe(channel);
 }