com.sun.jmx.snmp.SnmpStatusException Java Examples

The following examples show how to use com.sun.jmx.snmp.SnmpStatusException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JvmCompilationMeta.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Set the value of a scalar variable
 */
public SnmpValue set(SnmpValue x, long var, Object data)
    throws SnmpStatusException {
    switch((int)var) {
        case 3:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 2:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 1:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        default:
            break;
    }
    throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
 
Example #2
Source File: JvmMemManagerEntryMeta.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the value of a scalar variable
 */
public void check(SnmpValue x, long var, Object data)
    throws SnmpStatusException {
    switch((int) var) {
        case 3:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 2:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 1:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        default:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
    }
}
 
Example #3
Source File: JvmOSMeta.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get the value of a scalar variable
 */
public SnmpValue get(long var, Object data)
    throws SnmpStatusException {
    switch((int)var) {
        case 4:
            return new SnmpInt(node.getJvmOSProcessorCount());

        case 3:
            return new SnmpString(node.getJvmOSVersion());

        case 2:
            return new SnmpString(node.getJvmOSArch());

        case 1:
            return new SnmpString(node.getJvmOSName());

        default:
            break;
    }
    throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
 
Example #4
Source File: SnmpRequestTree.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void registerCheckException(SnmpVarBind var,
                                   SnmpStatusException exception)
    throws SnmpStatusException {
    // The index in the exception must correspond to
    // the SNMP index ...
    //
    // We throw the exception in order to abort the SET operation
    // in an atomic way.
    final int errorCode = exception.getStatus();
    final int mappedErrorCode = mapSetException(errorCode,
                                                version);

    if (errorCode != mappedErrorCode)
        throw new
            SnmpStatusException(mappedErrorCode, getVarIndex(var)+1);
    else
        throw new SnmpStatusException(exception, getVarIndex(var)+1);
}
 
Example #5
Source File: JvmMemPoolEntryImpl.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for the "JvmMemPoolCollectThreshdCount" variable.
 */
public Long getJvmMemPoolCollectThreshdCount()
    throws SnmpStatusException {
    if (!pool.isCollectionUsageThresholdSupported())
        return JvmMemoryImpl.Long0;
    final long val = pool.getCollectionUsageThresholdCount();
    if (val > -1) return  new Long(val);
    else return JvmMemoryImpl.Long0;
}
 
Example #6
Source File: SnmpLoadedClassData.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public final boolean contains(SnmpOid index) {
    int pos = 0;

    try {
        pos = (int) index.getOidArc(0);
    }catch(SnmpStatusException e) {
        return false;
    }

    return (pos < datas.length);
}
 
Example #7
Source File: JvmRTClassPathTableMeta.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void set(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
    throws SnmpStatusException {
    if (req.getSize() == 0) return;

    JvmRTClassPathEntryMBean entry = (JvmRTClassPathEntryMBean) getEntry(rowOid);
    synchronized (this) {
        node.setInstance(entry);
        node.set(req,depth);
    }
}
 
Example #8
Source File: JvmThreadInstanceTableMeta.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void get(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
    throws SnmpStatusException {
    JvmThreadInstanceEntryMBean entry = (JvmThreadInstanceEntryMBean) getEntry(rowOid);
    synchronized (this) {
        node.setInstance(entry);
        node.get(req,depth);
    }
}
 
Example #9
Source File: JvmRTBootClassPathTableMeta.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void createNewEntry(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
    throws SnmpStatusException {
    if (factory != null)
        factory.createNewEntry(req, rowOid, depth, this);
    else
        throw new SnmpStatusException(
            SnmpStatusException.snmpRspNoAccess);
}
 
Example #10
Source File: JvmRTLibraryPathTableMeta.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public synchronized void addEntry(SnmpOid rowOid, ObjectName objname,
             Object entry)
    throws SnmpStatusException {
    if (! (entry instanceof JvmRTLibraryPathEntryMBean) )
        throw new ClassCastException("Entries for Table \"" +
                       "JvmRTLibraryPathTable" + "\" must implement the \"" +
                       "JvmRTLibraryPathEntryMBean" + "\" interface.");
    super.addEntry(rowOid, objname, entry);
}
 
Example #11
Source File: JvmMemManagerTableMeta.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void createNewEntry(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
    throws SnmpStatusException {
    if (factory != null)
        factory.createNewEntry(req, rowOid, depth, this);
    else
        throw new SnmpStatusException(
            SnmpStatusException.snmpRspNoAccess);
}
 
Example #12
Source File: JvmMemPoolTableMeta.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void createNewEntry(SnmpMibSubRequest req, SnmpOid rowOid, int depth)
    throws SnmpStatusException {
    if (factory != null)
        factory.createNewEntry(req, rowOid, depth, this);
    else
        throw new SnmpStatusException(
            SnmpStatusException.snmpRspNoAccess);
}
 
Example #13
Source File: JvmRTLibraryPathTableMeta.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public synchronized void addEntry(SnmpOid rowOid, ObjectName objname,
             Object entry)
    throws SnmpStatusException {
    if (! (entry instanceof JvmRTLibraryPathEntryMBean) )
        throw new ClassCastException("Entries for Table \"" +
                       "JvmRTLibraryPathTable" + "\" must implement the \"" +
                       "JvmRTLibraryPathEntryMBean" + "\" interface.");
    super.addEntry(rowOid, objname, entry);
}
 
Example #14
Source File: SnmpMibTable.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Search the position at which the given oid should be inserted
 * in the OID table (tableoids).
 *
 * <p>
 * @param oid The OID we would like to insert.
 *
 * @param fail Tells whether a SnmpStatusException must be generated
 *             if the given OID is already present in the table.
 *
 * @return The position at which the OID should be inserted in
 *         the table. When the OID is found, it returns the next
 *         position. Note that it is not valid to insert twice the
 *         same OID. This feature is only an optimization to improve
 *         the getNextOid() behaviour.
 *
 * @exception SnmpStatusException if the OID is already present in the
 *            table and <code>fail</code> is <code>true</code>.
 *
 **/
private int getInsertionPoint(SnmpOid oid, boolean fail)
    throws SnmpStatusException {

    final int failStatus = SnmpStatusException.snmpRspNotWritable;
    int low= 0;
    int max= size - 1;
    SnmpOid pos;
    int comp;
    int curr= low + (max-low)/2;
    while (low <= max) {

        // XX pos= (SnmpOid) oids.elementAt(curr);
        pos= tableoids[curr];

        // never know ...we might find something ...
        //
        comp= oid.compareTo(pos);

        if (comp == 0) {
            if (fail)
                throw new SnmpStatusException(failStatus,curr);
            else
                return curr+1;
        }

        if (comp>0) {
            low= curr +1;
        } else {
            max= curr -1;
        }
        curr= low + (max-low)/2;
    }
    return curr;
}
 
Example #15
Source File: JvmThreadInstanceEntryImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static String getJvmThreadInstIndexOid()
    throws SnmpStatusException {
    if (jvmThreadInstIndexOid == null) {
        final SnmpOidTable  table = new JVM_MANAGEMENT_MIBOidTable();
        final SnmpOidRecord record =
            table.resolveVarName("jvmThreadInstIndex");
        jvmThreadInstIndexOid = record.getOid();
    }
    return jvmThreadInstIndexOid;
}
 
Example #16
Source File: JvmMemManagerTableMetaImpl.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected SnmpOid getNextOid(SnmpOid oid, Object userData)
    throws SnmpStatusException {
    final boolean dbg = log.isDebugOn();
    if (dbg) log.debug("getNextOid", "previous=" + oid);


    // Get the data handler.
    //
    SnmpTableHandler handler = getHandler(userData);
    if (handler == null) {
        // This should never happen.
        // If we get here it's a bug.
        //
        if (dbg) log.debug("getNextOid", "handler is null!");
        throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
    }

    // Get the next oid
    //
    final SnmpOid next = handler.getNext(oid);
    if (dbg) log.debug("getNextOid", "next=" + next);

    // if next is null: we reached the end of the table.
    //
    if (next == null)
        throw new SnmpStatusException(SnmpStatusException.noSuchInstance);

    return next;
}
 
Example #17
Source File: JvmMemManagerTableMetaImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
protected SnmpOid getNextOid(SnmpOid oid, Object userData)
    throws SnmpStatusException {
    final boolean dbg = log.isDebugOn();
    if (dbg) log.debug("getNextOid", "previous=" + oid);


    // Get the data handler.
    //
    SnmpTableHandler handler = getHandler(userData);
    if (handler == null) {
        // This should never happen.
        // If we get here it's a bug.
        //
        if (dbg) log.debug("getNextOid", "handler is null!");
        throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
    }

    // Get the next oid
    //
    final SnmpOid next = handler.getNext(oid);
    if (dbg) log.debug("getNextOid", "next=" + next);

    // if next is null: we reached the end of the table.
    //
    if (next == null)
        throw new SnmpStatusException(SnmpStatusException.noSuchInstance);

    return next;
}
 
Example #18
Source File: JvmClassLoadingMeta.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set the value of a scalar variable
 */
public SnmpValue set(SnmpValue x, long var, Object data)
    throws SnmpStatusException {
    switch((int)var) {
        case 4:
            if (x instanceof SnmpInt) {
                try  {
                    node.setJvmClassesVerboseLevel( new EnumJvmClassesVerboseLevel (((SnmpInt)x).toInteger()));
                } catch(IllegalArgumentException e)  {
                    throw new SnmpStatusException(SnmpStatusException.snmpRspWrongValue);
                }
                return new SnmpInt(node.getJvmClassesVerboseLevel());
            } else {
                throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
            }

        case 3:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 2:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 1:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        default:
            break;
    }
    throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
 
Example #19
Source File: SnmpMibTable.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
static void checkRowStatusFail(SnmpMibSubRequest req, int errorStatus)
    throws SnmpStatusException {

    final SnmpVarBind statusvb  = req.getRowStatusVarBind();
    final SnmpStatusException x = new SnmpStatusException(errorStatus);
    req.registerCheckException(statusvb,x);
}
 
Example #20
Source File: JvmMemGCTableMetaImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
protected SnmpOid getNextOid(SnmpOid oid, Object userData)
    throws SnmpStatusException {
    final boolean dbg = log.isDebugOn();
    try {
        if (dbg) log.debug("getNextOid", "previous=" + oid);

        // Get the data handler.
        //
        SnmpTableHandler handler = getHandler(userData);
        if (handler == null) {
            // This should never happen.
            // If we get here it's a bug.
            //
            if (dbg) log.debug("getNextOid", "handler is null!");
            throw new
                SnmpStatusException(SnmpStatusException.noSuchInstance);
        }


        // Get the next oid, using the GC filter.
        //
        final SnmpOid next = filter.getNext(handler,oid);
        if (dbg) log.debug("getNextOid", "next=" + next);

        // if next is null: we reached the end of the table.
        //
        if (next == null)
            throw new
                SnmpStatusException(SnmpStatusException.noSuchInstance);

        return next;
    } catch (RuntimeException x) {
        // debug. This should never happen.
        //
        if (dbg) log.debug("getNextOid",x);
        throw x;
    }
}
 
Example #21
Source File: JvmThreadingImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Getter for the "JvmThreadPeakCount" variable.
 */
public Long getJvmThreadPeakCount() throws SnmpStatusException {
    return  new Long(getThreadMXBean().getPeakThreadCount());
}
 
Example #22
Source File: JvmRuntimeMeta.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Get the value of a scalar variable
 */
public SnmpValue get(long var, Object data)
    throws SnmpStatusException {
    switch((int)var) {
        case 23: {
            throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
            }

        case 22: {
            throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
            }

        case 21: {
            throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
            }

        case 9:
            return new SnmpInt(node.getJvmRTBootClassPathSupport());

        case 20: {
            throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
            }

        case 8:
            return new SnmpString(node.getJvmRTManagementSpecVersion());

        case 7:
            return new SnmpString(node.getJvmRTSpecVersion());

        case 6:
            return new SnmpString(node.getJvmRTSpecVendor());

        case 5:
            return new SnmpString(node.getJvmRTSpecName());

        case 4:
            return new SnmpString(node.getJvmRTVMVersion());

        case 3:
            return new SnmpString(node.getJvmRTVMVendor());

        case 12:
            return new SnmpCounter64(node.getJvmRTStartTimeMs());

        case 11:
            return new SnmpCounter64(node.getJvmRTUptimeMs());

        case 2:
            return new SnmpString(node.getJvmRTVMName());

        case 1:
            return new SnmpString(node.getJvmRTName());

        case 10:
            return new SnmpInt(node.getJvmRTInputArgsCount());

        default:
            break;
    }
    throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
 
Example #23
Source File: SnmpRequestTree.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public void add(SnmpMibNode meta, int depth, SnmpOid entryoid,
                SnmpVarBind varbind, boolean isnew)
    throws SnmpStatusException {
    registerNode(meta,depth,entryoid,varbind,isnew,null);
}
 
Example #24
Source File: JvmThreadInstanceEntryImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Getter for the "JvmThreadInstState" variable.
 */
public Byte[] getJvmThreadInstState()
    throws SnmpStatusException {
    return ThreadStateMap.getState(info);
}
 
Example #25
Source File: SnmpAdaptorServer.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sends a trap using SNMP V1 trap format.
 * <BR>The trap is sent to each destination defined in the ACL file
 * (if available).
 * If no ACL file or no destinations are available, the trap is sent
 * to the local host.
 *
 * @param generic The generic number of the trap.
 * @param specific The specific number of the trap.
 * @param varBindList A list of <CODE>SnmpVarBind</CODE> instances or null.
 *
 * @exception IOException An I/O error occurred while sending the trap.
 * @exception SnmpStatusException If the trap exceeds the limit defined
 *            by <CODE>bufferSize</CODE>.
 */
@Override
public void snmpV1Trap(int generic, int specific,
                       SnmpVarBindList varBindList)
    throws IOException, SnmpStatusException {

    if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) {
        SNMP_ADAPTOR_LOGGER.logp(Level.FINER, dbgTag,
            "snmpV1Trap", "generic=" + generic +
              ", specific=" + specific);
    }

    // First, make an SNMP V1 trap pdu
    //
    SnmpPduTrap pdu = new SnmpPduTrap() ;
    pdu.address = null ;
    pdu.port = trapPort ;
    pdu.type = pduV1TrapPdu ;
    pdu.version = snmpVersionOne ;
    pdu.community = null ;
    pdu.enterprise = enterpriseOid ;
    pdu.genericTrap = generic ;
    pdu.specificTrap = specific ;
    pdu.timeStamp = getSysUpTime();

    if (varBindList != null) {
        pdu.varBindList = new SnmpVarBind[varBindList.size()] ;
        varBindList.copyInto(pdu.varBindList);
    }
    else
        pdu.varBindList = null ;

    // If the local host cannot be determined, we put 0.0.0.0 in agentAddr
    try {
        if (address != null)
            pdu.agentAddr = handleMultipleIpVersion(address.getAddress());
        else pdu.agentAddr =
          handleMultipleIpVersion(InetAddress.getLocalHost().getAddress());
    } catch (UnknownHostException e) {
        byte[] zeroedAddr = new byte[4];
        pdu.agentAddr = handleMultipleIpVersion(zeroedAddr) ;
    }

    // Next, send the pdu to all destinations defined in ACL
    //
    sendTrapPdu(pdu) ;
}
 
Example #26
Source File: JvmMemPoolEntryMeta.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Set the value of a scalar variable
 */
public SnmpValue set(SnmpValue x, long var, Object data)
    throws SnmpStatusException {
    switch((int)var) {
        case 33:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 32:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 31:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 133:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 132:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 131:
            if (x instanceof SnmpCounter64) {
                node.setJvmMemPoolCollectThreshold(((SnmpCounter64)x).toLong());
                return new SnmpCounter64(node.getJvmMemPoolCollectThreshold());
            } else {
                throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
            }

        case 13:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 12:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 11:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 10:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 112:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 111:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 110:
            if (x instanceof SnmpCounter64) {
                node.setJvmMemPoolThreshold(((SnmpCounter64)x).toLong());
                return new SnmpCounter64(node.getJvmMemPoolThreshold());
            } else {
                throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
            }

        case 5:
            if (x instanceof SnmpCounter64) {
                node.setJvmMemPoolPeakReset(((SnmpCounter64)x).toLong());
                return new SnmpCounter64(node.getJvmMemPoolPeakReset());
            } else {
                throw new SnmpStatusException(SnmpStatusException.snmpRspWrongType);
            }

        case 4:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 3:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 2:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 23:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 1:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 22:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 21:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        default:
            break;
    }
    throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
 
Example #27
Source File: SnmpMibGroup.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
void findHandlingNode(SnmpVarBind varbind,
                      long[] oid, int depth,
                      SnmpRequestTree handlers)
    throws SnmpStatusException {

    int length = oid.length;

    if (handlers == null)
        throw new SnmpStatusException(SnmpStatusException.snmpRspGenErr);

    final Object data = handlers.getUserData();

    if (depth >= length) {
        // Nothing is left... the oid is not valid
        throw new SnmpStatusException(SnmpStatusException.noAccess);
    }

    long arc = oid[depth];

    if (isNestedArc(arc)) {
        // This arc leads to a subgroup: delegates the search to the
        // method defined in SnmpMibOid
        super.findHandlingNode(varbind,oid,depth,handlers);
    } else if (isTable(arc)) {
        // This arc leads to a table: forward the search to the table.

        // Gets the table
        SnmpMibTable table = getTable(arc);

        // Forward the search to the table
        table.findHandlingNode(varbind,oid,depth+1,handlers);

    } else {
        // If it's not a variable, throws an exception
        validateVarId(arc, data);

        // The trailing .0 is missing in the OID
        if (depth+2 > length) {
            throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
        }

        // There are too many arcs left in the OID (there should remain
        // a single trailing .0)
        if (depth+2 < length) {
            throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
        }

        // The last trailing arc is not .0
        if (oid[depth+1] != 0L) {
            throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
        }

        // It's one of our variable, register this node.
        handlers.add(this,depth,varbind);
    }
}
 
Example #28
Source File: JvmRTInputArgsEntryImpl.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Getter for the "JvmRTInputArgsIndex" variable.
 */
public Integer getJvmRTInputArgsIndex() throws SnmpStatusException {
    return new Integer(index);
}
 
Example #29
Source File: JvmMemoryImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Getter for the "JvmMemoryHeapInitSize" variable.
 */
public Long getJvmMemoryHeapInitSize() throws SnmpStatusException {
    final long val = getHeapMemoryUsage().getInit();
    if (val > -1) return new Long(val);
    else return Long0;
}
 
Example #30
Source File: JvmRuntimeMeta.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Check the value of a scalar variable
 */
public void check(SnmpValue x, long var, Object data)
    throws SnmpStatusException {
    switch((int) var) {
        case 23: {
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
            }

        case 22: {
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
            }

        case 21: {
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
            }

        case 9:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 20: {
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
            }

        case 8:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 7:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 6:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 5:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 4:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 3:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 12:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 11:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 2:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 1:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        case 10:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);

        default:
            throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
    }
}