Beispiel #1
0
  void suspendNodeCollection(int nodeid) {
    LogUtils.debugf(
        this, "suspendNodeCollection: suspend collection LinkableNode for node %d", nodeid);

    try {
      m_queryMgr.update(nodeid, QueryManager.ACTION_UPTODATE);
    } catch (SQLException sqlE) {
      LogUtils.errorf(
          this,
          sqlE,
          "suspendNodeCollection: SQL Exception while syncing node object with database information.");
    }

    LinkableNode node = getNode(nodeid);

    if (node == null) {
      LogUtils.warnf(this, "suspendNodeCollection: found null ReadyRunnable");
    } else {
      // get collections
      // get readyRunnuble
      // suspend RR
      Collection<SnmpCollection> collections =
          getSnmpCollections(nodeid, node.getSnmpPrimaryIpAddr(), node.getSysoid());
      LogUtils.debugf(
          this,
          "suspendNodeCollection: fetched SnmpCollections from scratch, iterating over %d objects to wake them up",
          collections.size());
      for (SnmpCollection collection : collections) {
        ReadyRunnable rr = getReadyRunnable(collection);
        if (rr == null) {
          LogUtils.warnf(this, "suspendNodeCollection: suspend: node not found: %d", nodeid);
          return;
        } else {
          rr.suspend();
        }
      }
    }
  }
Beispiel #2
0
  void deleteNode(int nodeid) {
    LogUtils.debugf(this, "deleteNode: deleting LinkableNode for node %s", nodeid);

    try {
      m_queryMgr.update(nodeid, QueryManager.ACTION_DELETE);
    } catch (SQLException sqlE) {
      LogUtils.errorf(
          this,
          sqlE,
          "deleteNode: SQL Exception while syncing node object with database information.");
    }

    LinkableNode node = removeNode(nodeid);

    if (node == null) {
      LogUtils.warnf(this, "deleteNode: node not found: %d", nodeid);
    } else {
      Collection<SnmpCollection> collections =
          getSnmpCollections(nodeid, node.getSnmpPrimaryIpAddr(), node.getSysoid());
      LogUtils.debugf(
          this,
          "deleteNode: fetched SnmpCollections from scratch, iterating over %d objects to wake them up",
          collections.size());
      for (SnmpCollection collection : collections) {
        ReadyRunnable rr = getReadyRunnable(collection);

        if (rr == null) {
          LogUtils.warnf(this, "deleteNode: found null ReadyRunnable");
          return;
        } else {
          rr.unschedule();
        }
      }
    }

    // database changed need reload packageiplist
    m_linkdConfig.updatePackageIpListMap();
  }