本文整理汇总了Java中com.sun.jmx.snmp.SnmpStatusException类的典型用法代码示例。如果您正苦于以下问题:Java SnmpStatusException类的具体用法?Java SnmpStatusException怎么用?Java SnmpStatusException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SnmpStatusException类属于com.sun.jmx.snmp包,在下文中一共展示了SnmpStatusException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: get
import com.sun.jmx.snmp.SnmpStatusException; //导入依赖的package包/类
/**
* 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);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:JvmOSMeta.java
示例2: mapSetException
import com.sun.jmx.snmp.SnmpStatusException; //导入依赖的package包/类
public static int mapSetException(int errorStatus, int version)
throws SnmpStatusException {
final int errorCode = errorStatus;
if (version == SnmpDefinitions.snmpVersionOne)
return errorCode;
int mappedErrorCode = errorCode;
// Now take care of V2 errorCodes that can be stored
// in the varbind itself:
if (errorCode == SnmpStatusException.noSuchObject)
// noSuchObject => notWritable
mappedErrorCode = SnmpStatusException.snmpRspNotWritable;
else if (errorCode == SnmpStatusException.noSuchInstance)
// noSuchInstance => notWritable
mappedErrorCode = SnmpStatusException.snmpRspNotWritable;
return mappedErrorCode;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:SnmpRequestTree.java
示例3: getNext
import com.sun.jmx.snmp.SnmpStatusException; //导入依赖的package包/类
public final SnmpOid getNext(SnmpOid index) {
int pos = 0;
if (index == null) {
if( (datas!= null) && (datas.length >= 1) )
return new SnmpOid(0);
}
try {
pos = (int) index.getOidArc(0);
}catch(SnmpStatusException e) {
return null;
}
if(pos < (datas.length - 1))
return new SnmpOid(pos+1);
else
return null;
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:18,代码来源:SnmpLoadedClassData.java
示例4: set
import com.sun.jmx.snmp.SnmpStatusException; //导入依赖的package包/类
/**
* Generic handling of the <CODE>set</CODE> operation.
* <p> The default implementation of this method is to
* call the generated
* <CODE>set(req,oid,depth+1)</CODE> method.
* <p>
* <pre>
* public void set(SnmpMibSubRequest req, int depth)
* throws SnmpStatusException {
* final SnmpOid oid = req.getEntryOid();
* final int action = getRowAction(req,oid,depth+1);
*
* set(req,oid,depth+1);
* endRowAction(req,oid,depth+1,action);
* }
* </pre>
* <p> You should not need to override this method in any cases, because
* it will eventually call
* <CODE>set(SnmpMibSubRequest req, int depth)</CODE> on the generated
* derivative of <CODE>SnmpMibEntry</CODE>. If you need to implement
* specific policies for minimizing the accesses made to some remote
* underlying resources, or if you need to implement some consistency
* checks between the different values provided in the varbind list,
* you should then rather override
* <CODE>set(SnmpMibSubRequest req, int depth)</CODE> on the generated
* derivative of <CODE>SnmpMibEntry</CODE>.
* <p>
*
*/
@Override
public void set(SnmpMibSubRequest req, int depth)
throws SnmpStatusException {
if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMibTable.class.getName(),
"set", "Entering set");
}
final SnmpOid oid = req.getEntryOid();
final int action = getRowAction(req,oid,depth+1);
if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMibTable.class.getName(),
"set", "Calling set for " + req.getSize() + " varbinds");
}
set(req,oid,depth+1);
if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMibTable.class.getName(),
"set", "Calling endRowAction");
}
endRowAction(req,oid,depth+1,action);
if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpMibTable.class.getName(),
"set", "RowAction finished");
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:63,代码来源:SnmpMibTable.java
示例5: check
import com.sun.jmx.snmp.SnmpStatusException; //导入依赖的package包/类
/**
* Check the value of a scalar variable
*/
public void check(SnmpValue x, long var, Object data)
throws SnmpStatusException {
switch((int) var) {
case 2:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
case 1:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
default:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:17,代码来源:JvmRTClassPathEntryMeta.java
示例6: getNextVarEntryId
import com.sun.jmx.snmp.SnmpStatusException; //导入依赖的package包/类
/**
* Returns the arc of the next columnar object following "var".
*/
public long getNextVarEntryId( SnmpOid rowOid, long var, Object data )
throws SnmpStatusException {
long nextvar = node.getNextVarId(var, data);
while (!isReadableEntryId(rowOid, nextvar, data))
nextvar = node.getNextVarId(nextvar, data);
return nextvar;
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:JvmRTLibraryPathTableMeta.java
示例7: get
import com.sun.jmx.snmp.SnmpStatusException; //导入依赖的package包/类
/**
* Get the value of a scalar variable
*/
public SnmpValue get(long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 2:
return new SnmpString(node.getJvmRTClassPathItem());
case 1:
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:17,代码来源:JvmRTClassPathEntryMeta.java
示例8: check
import com.sun.jmx.snmp.SnmpStatusException; //导入依赖的package包/类
/**
* 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);
default:
throw new SnmpStatusException(SnmpStatusException.snmpRspNotWritable);
}
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:17,代码来源:JvmMemGCEntryMeta.java
示例9: getAttributeName
import com.sun.jmx.snmp.SnmpStatusException; //导入依赖的package包/类
/**
* Return the name of the attribute corresponding to the SNMP variable identified by "id".
*/
public String getAttributeName(long id)
throws SnmpStatusException {
switch((int)id) {
case 6:
return "JvmThreadCpuTimeMonitoring";
case 5:
return "JvmThreadContentionMonitoring";
case 4:
return "JvmThreadTotalStartedCount";
case 3:
return "JvmThreadPeakCount";
case 2:
return "JvmThreadDaemonCount";
case 1:
return "JvmThreadCount";
case 10: {
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
}
case 7:
return "JvmThreadPeakCountReset";
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:37,代码来源:JvmThreadingMeta.java
示例10: getJvmThreadInstLockOwnerPtr
import com.sun.jmx.snmp.SnmpStatusException; //导入依赖的package包/类
/**
* Getter for the "JvmThreadInstLockedOwnerId" variable.
*/
public String getJvmThreadInstLockOwnerPtr() throws SnmpStatusException {
long id = info.getLockOwnerId();
if(id == -1)
return new String("0.0");
SnmpOid oid = JvmThreadInstanceTableMetaImpl.makeOid(id);
return getJvmThreadInstIndexOid() + "." + oid.toString();
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:14,代码来源:JvmThreadInstanceEntryImpl.java
示例11: setJvmMemoryGCVerboseLevel
import com.sun.jmx.snmp.SnmpStatusException; //导入依赖的package包/类
/**
* Setter for the "JvmMemoryGCVerboseLevel" variable.
*/
public void setJvmMemoryGCVerboseLevel(EnumJvmMemoryGCVerboseLevel x)
throws SnmpStatusException {
if (JvmMemoryGCVerboseLevelVerbose.intValue() == x.intValue())
ManagementFactory.getMemoryMXBean().setVerbose(true);
else
ManagementFactory.getMemoryMXBean().setVerbose(false);
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:JvmMemoryImpl.java
示例12: getJvmThreadInstIndexOid
import com.sun.jmx.snmp.SnmpStatusException; //导入依赖的package包/类
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;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:JvmThreadInstanceEntryImpl.java
示例13: getJvmMemPoolCollectThreshold
import com.sun.jmx.snmp.SnmpStatusException; //导入依赖的package包/类
/**
* Getter for the "JvmMemPoolCollectThreshold" variable.
*/
public Long getJvmMemPoolCollectThreshold() throws SnmpStatusException {
if (!pool.isCollectionUsageThresholdSupported())
return JvmMemoryImpl.Long0;
final long val = pool.getCollectionUsageThreshold();
if (val > -1) return new Long(val);
else return JvmMemoryImpl.Long0;
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:JvmMemPoolEntryImpl.java
示例14: get
import com.sun.jmx.snmp.SnmpStatusException; //导入依赖的package包/类
/**
* Get the value of a scalar variable
*/
public SnmpValue get(long var, Object data)
throws SnmpStatusException {
switch((int)var) {
case 2:
return new SnmpString(node.getJvmRTLibraryPathItem());
case 1:
throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
default:
break;
}
throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:17,代码来源:JvmRTLibraryPathEntryMeta.java
示例15: getJvmMemPoolCollectThreshdSupport
import com.sun.jmx.snmp.SnmpStatusException; //导入依赖的package包/类
/**
* Getter for the "JvmMemPoolThreshdSupport" variable.
*/
public EnumJvmMemPoolCollectThreshdSupport
getJvmMemPoolCollectThreshdSupport()
throws SnmpStatusException {
if (pool.isCollectionUsageThresholdSupported())
return EnumJvmMemPoolCollectThreshdSupported;
else
return EnumJvmMemPoolCollectThreshdUnsupported;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:JvmMemPoolEntryImpl.java
示例16: setJvmThreadCpuTimeMonitoring
import com.sun.jmx.snmp.SnmpStatusException; //导入依赖的package包/类
/**
* Setter for the "JvmThreadCpuTimeMonitoring" variable.
*/
public void setJvmThreadCpuTimeMonitoring(EnumJvmThreadCpuTimeMonitoring x)
throws SnmpStatusException {
ThreadMXBean mbean = getThreadMXBean();
// We can trust the received value, it has been checked in
// checkJvmThreadCpuTimeMonitoring
if(JvmThreadCpuTimeMonitoringEnabled.intValue() == x.intValue())
mbean.setThreadCpuTimeEnabled(true);
else
mbean.setThreadCpuTimeEnabled(false);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:JvmThreadingImpl.java
示例17: setRowStatusFail
import com.sun.jmx.snmp.SnmpStatusException; //导入依赖的package包/类
static void setRowStatusFail(SnmpMibSubRequest req, int errorStatus)
throws SnmpStatusException {
final SnmpVarBind statusvb = req.getRowStatusVarBind();
final SnmpStatusException x = new SnmpStatusException(errorStatus);
req.registerSetException(statusvb,x);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:SnmpMibTable.java
示例18: skipEntryVariable
import com.sun.jmx.snmp.SnmpStatusException; //导入依赖的package包/类
public boolean skipEntryVariable( SnmpOid rowOid, long var, Object data, int pduVersion) {
try {
JvmRTClassPathEntryMBean entry = (JvmRTClassPathEntryMBean) getEntry(rowOid);
synchronized (this) {
node.setInstance(entry);
return node.skipVariable(var, data, pduVersion);
}
} catch (SnmpStatusException x) {
return false;
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:JvmRTClassPathTableMeta.java
示例19: snmpV1Trap
import com.sun.jmx.snmp.SnmpStatusException; //导入依赖的package包/类
/**
* Sends a trap using SNMP V1 trap format.
* <BR>The trap is sent to the specified <CODE>InetAddress</CODE>
* destination using the specified parameters (and the ACL file is not
* used).
* Note that if the specified <CODE>InetAddress</CODE> destination is null,
* then the ACL file mechanism is used.
*
* @param addr The <CODE>InetAddress</CODE> destination of the trap.
* @param agentAddr The agent address to be used for the trap.
* @param cs The community string to be used for the trap.
* @param enterpOid The enterprise OID to be used for the trap.
* @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.
* @param time The time stamp (overwrite the current time).
*
* @exception IOException An I/O error occurred while sending the trap.
* @exception SnmpStatusException If the trap exceeds the limit defined
* by <CODE>bufferSize</CODE>.
*
* @since 1.5
*/
public void snmpV1Trap(InetAddress addr,
SnmpIpAddress agentAddr,
String cs,
SnmpOid enterpOid,
int generic,
int specific,
SnmpVarBindList varBindList,
SnmpTimeticks time)
throws IOException, SnmpStatusException {
snmpV1Trap(addr,
trapPort,
agentAddr,
cs,
enterpOid,
generic,
specific,
varBindList,
time);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:43,代码来源:SnmpAdaptorServer.java
示例20: snmpV1Trap
import com.sun.jmx.snmp.SnmpStatusException; //导入依赖的package包/类
/**
* 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) ;
}
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:62,代码来源:SnmpAdaptorServer.java
注:本文中的com.sun.jmx.snmp.SnmpStatusException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论