예제 #1
0
  public boolean scheduleNodeCollection(int nodeid) {

    LinkableNode node = null;
    // database changed need reload packageiplist
    m_linkdConfig.updatePackageIpListMap();

    // First of all get Linkable Node
    LogUtils.debugf(this, "scheduleNodeCollection: Loading node %d from database", nodeid);
    try {
      node = m_queryMgr.getSnmpNode(nodeid);
      if (node == null) {
        LogUtils.warnf(
            this,
            "scheduleNodeCollection: Failed to get linkable node from database with ID %d. Exiting",
            nodeid);
        return false;
      }
    } catch (final SQLException sqlE) {
      LogUtils.errorf(
          this,
          sqlE,
          "scheduleNodeCollection: SQL Exception while syncing node object with ID %d with database information.",
          nodeid);
      return false;
    }
    synchronized (m_nodes) {
      LogUtils.debugf(this, "adding node %s to the collection", node);
      m_nodes.add(node);
    }

    scheduleCollectionForNode(node);
    return true;
  }
예제 #2
0
  /**
   * Update database when an interface is deleted
   *
   * @param nodeid the nodeid for the node
   * @param ipAddr the ip address of the interface
   * @param ifIndex the ifIndex of the interface
   */
  void deleteInterface(int nodeid, String ipAddr, int ifIndex) {

    LogUtils.debugf(
        this,
        "deleteInterface: marking table entries as deleted for node %d with IP address %s and ifIndex %s",
        nodeid,
        ipAddr,
        (ifIndex > -1 ? "" + ifIndex : "N/A"));

    try {
      m_queryMgr.updateForInterface(nodeid, ipAddr, ifIndex, QueryManager.ACTION_DELETE);
    } catch (SQLException sqlE) {
      LogUtils.errorf(this, sqlE, "deleteInterface: SQL Exception while updating database.");
    }

    // database changed need reload packageiplist
    m_linkdConfig.updatePackageIpListMap();
  }
예제 #3
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();
  }