Esempio n. 1
0
 public Map<String, String> getNodes() {
   synchronized (recordsGuard) {
     Map<String, String> nodes = new HashMap<String, String>();
     for (Entry<String, MessageFlowRecord> entry : records.entrySet()) {
       RemotingConnection fwdConnection = entry.getValue().getBridge().getForwardingConnection();
       if (fwdConnection != null) {
         nodes.put(entry.getKey(), fwdConnection.getRemoteAddress());
       }
     }
     return nodes;
   }
 }
Esempio n. 2
0
    @Override
    public void run() {
      while (!closed) {
        try {
          long now = System.currentTimeMillis();

          Set<Object> idsToRemove = new HashSet<Object>();

          for (ConnectionEntry entry : connections.values()) {
            RemotingConnection conn = entry.connection;

            boolean flush = true;

            if (entry.ttl != -1) {
              if (!conn.checkDataReceived()) {
                if (now >= entry.lastCheck + entry.ttl) {
                  idsToRemove.add(conn.getID());

                  flush = false;
                }
              } else {
                entry.lastCheck = now;
              }
            }

            if (flush) {
              conn.flush();
            }
          }

          for (Object id : idsToRemove) {
            RemotingConnection conn = removeConnection(id);
            if (conn != null) {
              conn.fail(HornetQMessageBundle.BUNDLE.clientExited(conn.getRemoteAddress()));
            }
          }

          if (latch.await(pauseInterval, TimeUnit.MILLISECONDS)) return;
        } catch (Throwable e) {
          HornetQServerLogger.LOGGER.errorOnFailureCheck(e);
        }
      }
    }