Java Code Examples for com.sun.jmx.snmp.SnmpDefinitions#snmpRspWrongValue()
The following examples show how to use
com.sun.jmx.snmp.SnmpDefinitions#snmpRspWrongValue() .
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: JvmMemoryImpl.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Setter for the "JvmMemoryGCCall" variable. */ public void setJvmMemoryGCCall(EnumJvmMemoryGCCall x) throws SnmpStatusException { if (x.intValue() == JvmMemoryGCCallStart.intValue()) { final Map<Object, Object> m = JvmContextFactory.getUserData(); try { ManagementFactory.getMemoryMXBean().gc(); if (m != null) m.put("jvmMemory.getJvmMemoryGCCall", JvmMemoryGCCallStarted); } catch (Exception ex) { if (m != null) m.put("jvmMemory.getJvmMemoryGCCall", JvmMemoryGCCallFailed); } return; } throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue); }
Example 2
Source File: JvmMemoryImpl.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * Setter for the "JvmMemoryGCCall" variable. */ public void setJvmMemoryGCCall(EnumJvmMemoryGCCall x) throws SnmpStatusException { if (x.intValue() == JvmMemoryGCCallStart.intValue()) { final Map<Object, Object> m = JvmContextFactory.getUserData(); try { ManagementFactory.getMemoryMXBean().gc(); if (m != null) m.put("jvmMemory.getJvmMemoryGCCall", JvmMemoryGCCallStarted); } catch (Exception ex) { if (m != null) m.put("jvmMemory.getJvmMemoryGCCall", JvmMemoryGCCallFailed); } return; } throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue); }
Example 3
Source File: JvmMemPoolEntryImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Setter for the "JvmMemPoolCollectThreshold" variable. */ public void setJvmMemPoolCollectThreshold(Long x) throws SnmpStatusException { final long val = x.longValue(); if (val < 0 ) throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue); // This should never throw an exception has the checks have // already been performed in checkJvmMemPoolCollectThreshold(). // pool.setCollectionUsageThreshold(val); }
Example 4
Source File: JvmThreadingImpl.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Checker for the "JvmThreadContentionMonitoring" variable. */ public void checkJvmThreadContentionMonitoring( EnumJvmThreadContentionMonitoring x) throws SnmpStatusException { //Can't be set externaly to unsupported state. if(JvmThreadContentionMonitoringUnsupported.intValue()==x.intValue()) { log.debug("checkJvmThreadContentionMonitoring", "Try to set to illegal unsupported value"); throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue); } if ((JvmThreadContentionMonitoringEnabled.intValue()==x.intValue()) || (JvmThreadContentionMonitoringDisabled.intValue()==x.intValue())) { // The value is valid, but is the feature supported ? ThreadMXBean mbean = getThreadMXBean(); if(mbean.isThreadContentionMonitoringSupported()) return; log.debug("checkJvmThreadContentionMonitoring", "Unsupported operation, can't set state"); throw new SnmpStatusException(SnmpDefinitions.snmpRspInconsistentValue); } log.debug("checkJvmThreadContentionMonitoring", "Try to set to unknown value"); throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue); }
Example 5
Source File: JvmThreadingImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Checker for the "JvmThreadContentionMonitoring" variable. */ public void checkJvmThreadContentionMonitoring( EnumJvmThreadContentionMonitoring x) throws SnmpStatusException { //Can't be set externaly to unsupported state. if(JvmThreadContentionMonitoringUnsupported.intValue()==x.intValue()) { log.debug("checkJvmThreadContentionMonitoring", "Try to set to illegal unsupported value"); throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue); } if ((JvmThreadContentionMonitoringEnabled.intValue()==x.intValue()) || (JvmThreadContentionMonitoringDisabled.intValue()==x.intValue())) { // The value is valid, but is the feature supported ? ThreadMXBean mbean = getThreadMXBean(); if(mbean.isThreadContentionMonitoringSupported()) return; log.debug("checkJvmThreadContentionMonitoring", "Unsupported operation, can't set state"); throw new SnmpStatusException(SnmpDefinitions.snmpRspInconsistentValue); } log.debug("checkJvmThreadContentionMonitoring", "Try to set to unknown value"); throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue); }
Example 6
Source File: JvmMemPoolEntryImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Setter for the "JvmMemPoolCollectThreshold" variable. */ public void setJvmMemPoolCollectThreshold(Long x) throws SnmpStatusException { final long val = x.longValue(); if (val < 0 ) throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue); // This should never throw an exception has the checks have // already been performed in checkJvmMemPoolCollectThreshold(). // pool.setCollectionUsageThreshold(val); }
Example 7
Source File: JvmMemPoolEntryImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Checker for the "JvmMemPoolThreshold" variable. */ public void checkJvmMemPoolThreshold(Long x) throws SnmpStatusException { // if threshold is -1, it means that low memory detection is not // supported. if (!pool.isUsageThresholdSupported()) throw new SnmpStatusException(SnmpDefinitions.snmpRspInconsistentValue); final long val = x.longValue(); if (val < 0 ) throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue); }
Example 8
Source File: JvmMemPoolEntryImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Setter for the "JvmMemPoolCollectThreshold" variable. */ public void setJvmMemPoolCollectThreshold(Long x) throws SnmpStatusException { final long val = x.longValue(); if (val < 0 ) throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue); // This should never throw an exception has the checks have // already been performed in checkJvmMemPoolCollectThreshold(). // pool.setCollectionUsageThreshold(val); }
Example 9
Source File: JvmMemPoolEntryImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Setter for the "JvmMemPoolCollectThreshold" variable. */ public void setJvmMemPoolCollectThreshold(Long x) throws SnmpStatusException { final long val = x.longValue(); if (val < 0 ) throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue); // This should never throw an exception has the checks have // already been performed in checkJvmMemPoolCollectThreshold(). // pool.setCollectionUsageThreshold(val); }
Example 10
Source File: JvmMemPoolEntryImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Setter for the "JvmMemPoolThreshold" variable. */ public void setJvmMemPoolThreshold(Long x) throws SnmpStatusException { final long val = x.longValue(); if (val < 0 ) throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue); // This should never throw an exception has the checks have // already been performed in checkJvmMemPoolThreshold(). // pool.setUsageThreshold(val); }
Example 11
Source File: JvmThreadingImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Checker for the "JvmThreadContentionMonitoring" variable. */ public void checkJvmThreadContentionMonitoring( EnumJvmThreadContentionMonitoring x) throws SnmpStatusException { //Can't be set externaly to unsupported state. if(JvmThreadContentionMonitoringUnsupported.intValue()==x.intValue()) { log.debug("checkJvmThreadContentionMonitoring", "Try to set to illegal unsupported value"); throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue); } if ((JvmThreadContentionMonitoringEnabled.intValue()==x.intValue()) || (JvmThreadContentionMonitoringDisabled.intValue()==x.intValue())) { // The value is valid, but is the feature supported ? ThreadMXBean mbean = getThreadMXBean(); if(mbean.isThreadContentionMonitoringSupported()) return; log.debug("checkJvmThreadContentionMonitoring", "Unsupported operation, can't set state"); throw new SnmpStatusException(SnmpDefinitions.snmpRspInconsistentValue); } log.debug("checkJvmThreadContentionMonitoring", "Try to set to unknown value"); throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue); }
Example 12
Source File: JvmMemPoolEntryImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Checker for the "JvmMemPoolThreshold" variable. */ public void checkJvmMemPoolThreshold(Long x) throws SnmpStatusException { // if threshold is -1, it means that low memory detection is not // supported. if (!pool.isUsageThresholdSupported()) throw new SnmpStatusException(SnmpDefinitions.snmpRspInconsistentValue); final long val = x.longValue(); if (val < 0 ) throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue); }
Example 13
Source File: JvmMemPoolEntryImpl.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Checker for the "JvmMemPoolCollectThreshold" variable. */ public void checkJvmMemPoolCollectThreshold(Long x) throws SnmpStatusException { // if threshold is -1, it means that low memory detection is not // supported. if (!pool.isCollectionUsageThresholdSupported()) throw new SnmpStatusException(SnmpDefinitions.snmpRspInconsistentValue); final long val = x.longValue(); if (val < 0 ) throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue); }
Example 14
Source File: SnmpSubRequestHandler.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
static final int mapErrorStatusToV1(int errorStatus, int reqPduType) { // Map v2 codes onto v1 codes // if (errorStatus == SnmpDefinitions.snmpRspNoError) return SnmpDefinitions.snmpRspNoError; if (errorStatus == SnmpDefinitions.snmpRspGenErr) return SnmpDefinitions.snmpRspGenErr; if (errorStatus == SnmpDefinitions.snmpRspNoSuchName) return SnmpDefinitions.snmpRspNoSuchName; if ((errorStatus == SnmpStatusException.noSuchInstance) || (errorStatus == SnmpStatusException.noSuchObject) || (errorStatus == SnmpDefinitions.snmpRspNoAccess) || (errorStatus == SnmpDefinitions.snmpRspInconsistentName) || (errorStatus == SnmpDefinitions.snmpRspAuthorizationError)){ return SnmpDefinitions.snmpRspNoSuchName; } else if ((errorStatus == SnmpDefinitions.snmpRspAuthorizationError) || (errorStatus == SnmpDefinitions.snmpRspNotWritable)) { if (reqPduType == SnmpDefinitions.pduWalkRequest) return SnmpDefinitions.snmpRspReadOnly; else return SnmpDefinitions.snmpRspNoSuchName; } else if ((errorStatus == SnmpDefinitions.snmpRspNoCreation)) { return SnmpDefinitions.snmpRspNoSuchName; } else if ((errorStatus == SnmpDefinitions.snmpRspWrongType) || (errorStatus == SnmpDefinitions.snmpRspWrongLength) || (errorStatus == SnmpDefinitions.snmpRspWrongEncoding) || (errorStatus == SnmpDefinitions.snmpRspWrongValue) || (errorStatus == SnmpDefinitions.snmpRspWrongLength) || (errorStatus == SnmpDefinitions.snmpRspInconsistentValue)) { if ((reqPduType == SnmpDefinitions.pduSetRequestPdu) || (reqPduType == SnmpDefinitions.pduWalkRequest)) return SnmpDefinitions.snmpRspBadValue; else return SnmpDefinitions.snmpRspNoSuchName; } else if ((errorStatus == SnmpDefinitions.snmpRspResourceUnavailable) || (errorStatus == SnmpDefinitions.snmpRspCommitFailed) || (errorStatus == SnmpDefinitions.snmpRspUndoFailed)) { return SnmpDefinitions.snmpRspGenErr; } // At this point we should have a V1 error code // if (errorStatus == SnmpDefinitions.snmpRspTooBig) return SnmpDefinitions.snmpRspTooBig; if( (errorStatus == SnmpDefinitions.snmpRspBadValue) || (errorStatus == SnmpDefinitions.snmpRspReadOnly)) { if ((reqPduType == SnmpDefinitions.pduSetRequestPdu) || (reqPduType == SnmpDefinitions.pduWalkRequest)) return errorStatus; else return SnmpDefinitions.snmpRspNoSuchName; } // We have a snmpRspGenErr, or something which is not defined // in RFC1905 => return a snmpRspGenErr // return SnmpDefinitions.snmpRspGenErr; }
Example 15
Source File: JvmMemoryImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * Checker for the "JvmMemoryGCCall" variable. */ public void checkJvmMemoryGCCall(EnumJvmMemoryGCCall x) throws SnmpStatusException { if (x.intValue() != JvmMemoryGCCallStart.intValue()) throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue); }
Example 16
Source File: JvmMemoryImpl.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Checker for the "JvmMemoryGCCall" variable. */ public void checkJvmMemoryGCCall(EnumJvmMemoryGCCall x) throws SnmpStatusException { if (x.intValue() != JvmMemoryGCCallStart.intValue()) throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue); }
Example 17
Source File: SnmpSubRequestHandler.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
static final int mapErrorStatusToV2(int errorStatus, int reqPduType) { // Map v1 codes onto v2 codes // if (errorStatus == SnmpDefinitions.snmpRspNoError) return SnmpDefinitions.snmpRspNoError; if (errorStatus == SnmpDefinitions.snmpRspGenErr) return SnmpDefinitions.snmpRspGenErr; if (errorStatus == SnmpDefinitions.snmpRspTooBig) return SnmpDefinitions.snmpRspTooBig; // For get / getNext / getBulk the only global error // (PDU-level) possible is genErr. // if ((reqPduType != SnmpDefinitions.pduSetRequestPdu) && (reqPduType != SnmpDefinitions.pduWalkRequest)) { if(errorStatus == SnmpDefinitions.snmpRspAuthorizationError) return errorStatus; else return SnmpDefinitions.snmpRspGenErr; } // Map to noSuchName // if ((errorStatus == SnmpDefinitions.snmpRspNoSuchName) || // (errorStatus == SnmpStatusException.noSuchInstance) || // (errorStatus == SnmpStatusException.noSuchObject)) // return SnmpDefinitions.snmpRspNoSuchName; // SnmpStatusException.noSuchInstance and // SnmpStatusException.noSuchObject can't happen... if (errorStatus == SnmpDefinitions.snmpRspNoSuchName) return SnmpDefinitions.snmpRspNoAccess; // Map to notWritable if (errorStatus == SnmpDefinitions.snmpRspReadOnly) return SnmpDefinitions.snmpRspNotWritable; // Map to wrongValue if (errorStatus == SnmpDefinitions.snmpRspBadValue) return SnmpDefinitions.snmpRspWrongValue; // Other valid V2 codes if ((errorStatus == SnmpDefinitions.snmpRspNoAccess) || (errorStatus == SnmpDefinitions.snmpRspInconsistentName) || (errorStatus == SnmpDefinitions.snmpRspAuthorizationError) || (errorStatus == SnmpDefinitions.snmpRspNotWritable) || (errorStatus == SnmpDefinitions.snmpRspNoCreation) || (errorStatus == SnmpDefinitions.snmpRspWrongType) || (errorStatus == SnmpDefinitions.snmpRspWrongLength) || (errorStatus == SnmpDefinitions.snmpRspWrongEncoding) || (errorStatus == SnmpDefinitions.snmpRspWrongValue) || (errorStatus == SnmpDefinitions.snmpRspWrongLength) || (errorStatus == SnmpDefinitions.snmpRspInconsistentValue) || (errorStatus == SnmpDefinitions.snmpRspResourceUnavailable) || (errorStatus == SnmpDefinitions.snmpRspCommitFailed) || (errorStatus == SnmpDefinitions.snmpRspUndoFailed)) return errorStatus; // Ivalid V2 code => genErr return SnmpDefinitions.snmpRspGenErr; }
Example 18
Source File: JvmMemoryImpl.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
/** * Checker for the "JvmMemoryGCCall" variable. */ public void checkJvmMemoryGCCall(EnumJvmMemoryGCCall x) throws SnmpStatusException { if (x.intValue() != JvmMemoryGCCallStart.intValue()) throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue); }
Example 19
Source File: JvmMemoryImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * Checker for the "JvmMemoryGCCall" variable. */ public void checkJvmMemoryGCCall(EnumJvmMemoryGCCall x) throws SnmpStatusException { if (x.intValue() != JvmMemoryGCCallStart.intValue()) throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue); }
Example 20
Source File: SnmpSubRequestHandler.java From hottub with GNU General Public License v2.0 | 4 votes |
static final int mapErrorStatusToV2(int errorStatus, int reqPduType) { // Map v1 codes onto v2 codes // if (errorStatus == SnmpDefinitions.snmpRspNoError) return SnmpDefinitions.snmpRspNoError; if (errorStatus == SnmpDefinitions.snmpRspGenErr) return SnmpDefinitions.snmpRspGenErr; if (errorStatus == SnmpDefinitions.snmpRspTooBig) return SnmpDefinitions.snmpRspTooBig; // For get / getNext / getBulk the only global error // (PDU-level) possible is genErr. // if ((reqPduType != SnmpDefinitions.pduSetRequestPdu) && (reqPduType != SnmpDefinitions.pduWalkRequest)) { if(errorStatus == SnmpDefinitions.snmpRspAuthorizationError) return errorStatus; else return SnmpDefinitions.snmpRspGenErr; } // Map to noSuchName // if ((errorStatus == SnmpDefinitions.snmpRspNoSuchName) || // (errorStatus == SnmpStatusException.noSuchInstance) || // (errorStatus == SnmpStatusException.noSuchObject)) // return SnmpDefinitions.snmpRspNoSuchName; // SnmpStatusException.noSuchInstance and // SnmpStatusException.noSuchObject can't happen... if (errorStatus == SnmpDefinitions.snmpRspNoSuchName) return SnmpDefinitions.snmpRspNoAccess; // Map to notWritable if (errorStatus == SnmpDefinitions.snmpRspReadOnly) return SnmpDefinitions.snmpRspNotWritable; // Map to wrongValue if (errorStatus == SnmpDefinitions.snmpRspBadValue) return SnmpDefinitions.snmpRspWrongValue; // Other valid V2 codes if ((errorStatus == SnmpDefinitions.snmpRspNoAccess) || (errorStatus == SnmpDefinitions.snmpRspInconsistentName) || (errorStatus == SnmpDefinitions.snmpRspAuthorizationError) || (errorStatus == SnmpDefinitions.snmpRspNotWritable) || (errorStatus == SnmpDefinitions.snmpRspNoCreation) || (errorStatus == SnmpDefinitions.snmpRspWrongType) || (errorStatus == SnmpDefinitions.snmpRspWrongLength) || (errorStatus == SnmpDefinitions.snmpRspWrongEncoding) || (errorStatus == SnmpDefinitions.snmpRspWrongValue) || (errorStatus == SnmpDefinitions.snmpRspWrongLength) || (errorStatus == SnmpDefinitions.snmpRspInconsistentValue) || (errorStatus == SnmpDefinitions.snmpRspResourceUnavailable) || (errorStatus == SnmpDefinitions.snmpRspCommitFailed) || (errorStatus == SnmpDefinitions.snmpRspUndoFailed)) return errorStatus; // Ivalid V2 code => genErr return SnmpDefinitions.snmpRspGenErr; }