Beispiel #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();
      }
    }
Beispiel #2
0
 public void poison() {
   jpsh.unsubscribe();
 }
Beispiel #3
0
 public void removeChannel(String... channel) {
   jpsh.unsubscribe(channel);
 }
Beispiel #4
0
 public void addChannel(String... channel) {
   jpsh.subscribe(channel);
 }