コード例 #1
0
 /** This will fire the specified request. */
 void fireRequest(SnmpInformRequest req) {
   if (req != null && req.inProgress()) {
     if (isTraceOn()) {
       trace("fireRequest", "Firing inform request directly. -> " + req.getRequestId());
     }
     req.action();
   }
 }
コード例 #2
0
 void fireRequestList(Vector reqList) {
   // Fire all requests as independent requests.
   while (!reqList.isEmpty()) {
     SnmpInformRequest req = (SnmpInformRequest) reqList.lastElement();
     if (req != null && req.inProgress()) fireRequest(req);
     reqList.removeElementAt(reqList.size() - 1);
   }
 }
コード例 #3
0
  final String reqListToString(Vector vec) {
    StringBuffer s = new StringBuffer(vec.size() * 100);

    Enumeration dbge = vec.elements();
    while (dbge.hasMoreElements()) {
      SnmpInformRequest reqc = (SnmpInformRequest) dbge.nextElement();
      s.append("InformRequestId -> ");
      s.append(reqc.getRequestId());
      s.append(" / Destination -> ");
      s.append(reqc.getAddress());
      s.append(". ");
    }
    String str = s.toString();
    s = null;
    return str;
  }
コード例 #4
0
  private void prepareAndSendRequest() {

    if (readyPool == null || readyPool.isEmpty()) {
      // wait to be signaled by the an active request.
      if (isTraceOn()) {
        trace("prepareAndSendRequest", "Blocking for inform requests");
      }
      readyPool = snmpq.getAllOutstandingRequest(intervalRange);
      if (isBeingDestroyed == true) return;
    } else {
      if (isDebugOn()) {
        debug(
            "prepareAndSendRequest",
            "Inform requests from a previous block left unprocessed. Will try again");
      }
    }

    if (isTraceOn()) {
      trace(
          "prepareAndSendRequest",
          "List of inform requests to send : " + reqListToString(readyPool));
    }

    synchronized (this) {
      if (readyPool.size() < 2) {
        // Fire all requests as independent requests.
        fireRequestList(readyPool);
        return;
      }

      while (!readyPool.isEmpty()) {
        SnmpInformRequest req = (SnmpInformRequest) readyPool.lastElement();
        if (req != null && req.inProgress()) {
          fireRequest(req);
        }
        readyPool.removeElementAt(readyPool.size() - 1);
      }
      readyPool.removeAllElements();
    }
  }