Package org.snmp4j.agent.agentx.master.index.AgentXIndexRegistry

Examples of org.snmp4j.agent.agentx.master.index.AgentXIndexRegistry.IndexEntry


      else if (indexValues.get(indexValue) != null) {
        return AgentXProtocol.AGENTX_INDEX_ALREADY_ALLOCATED;
      }
      else {
        if (!testOnly) {
          IndexEntry newEntry = new IndexEntry(sessionID, indexValue);
          indexValues.put(newEntry, newEntry);
        }
        return AgentXProtocol.AGENTX_SUCCESS;
      }
    }
View Full Code Here


      }
    }

    public synchronized int release(int sessionID,
                                    Variable indexValue, boolean testOnly) {
      IndexEntry removeKey = new IndexEntry(sessionID, indexValue);
      IndexEntry contained = (IndexEntry) indexValues.get(removeKey);
      if ((contained != null) && (contained.getSessionID() == sessionID)) {
        if (!testOnly) {
          Object r = indexValues.remove(contained);
          usedValues.put(r,r);
        }
        return AgentXProtocol.AGENTX_SUCCESS;
View Full Code Here

      return AgentXProtocol.AGENTX_INDEX_NOT_ALLOCATED;
    }

    public synchronized void release(int sessionID) {
      for (Iterator it = indexValues.values().iterator(); it.hasNext();) {
        IndexEntry entry = (IndexEntry) it.next();
        if (entry.getSessionID() == sessionID) {
          it.remove();
          usedValues.put(entry, entry);
        }
      }
    }
View Full Code Here

      return context;
    }

    public synchronized Variable newIndex(int sessionID, boolean testOnly) {
      try {
        IndexEntry last = null;
        if (!usedValues.isEmpty()) {
          last = (IndexEntry) usedValues.lastKey();
        }
        if (!indexValues.isEmpty()) {
          IndexEntry lastAllocated = (IndexEntry) indexValues.lastKey();
          if (last == null) {
            last = lastAllocated;
          }
          else if (lastAllocated.compareTo(last) > 0) {
            last = lastAllocated;
          }
        }
        else if (last == null) {
          return anyIndex(sessionID, testOnly);
View Full Code Here

            nextIndex = ((IndexEntry)indexValues.lastKey()).
                getIndexValue().toSubIndex(true);
          }
        }
        else {
          IndexEntry last = (IndexEntry) usedValues.firstKey();
          nextIndex = last.getIndexValue().toSubIndex(true);
        }
        nextIndex = nextIndex.nextPeer();
        Variable nextIndexValue = (Variable) indexType.getVariable().clone();
        nextIndexValue.fromSubIndex(nextIndex, true);
        int status = allocate(sessionID, nextIndexValue, testOnly);
View Full Code Here

TOP

Related Classes of org.snmp4j.agent.agentx.master.index.AgentXIndexRegistry.IndexEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.