Exemplo n.º 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();
      }
    }
Exemplo n.º 2
0
 public void poison() {
   jpsh.unsubscribe();
 }
Exemplo n.º 3
0
 public void removeChannel(String... channel) {
   jpsh.unsubscribe(channel);
 }