本文整理汇总了Java中java.lang.management.ManagementPermission类的典型用法代码示例。如果您正苦于以下问题:Java ManagementPermission类的具体用法?Java ManagementPermission怎么用?Java ManagementPermission使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ManagementPermission类属于java.lang.management包,在下文中一共展示了ManagementPermission类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setCollectionUsageThreshold
import java.lang.management.ManagementPermission; //导入依赖的package包/类
public void setCollectionUsageThreshold(long threshold) {
if (!isCollectionUsageThresholdSupported()) {
//lm.13=VM does not support collection usage threshold.
throw new UnsupportedOperationException(Messages.getString("lm.13")); //$NON-NLS-1$
}
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkPermission(new ManagementPermission("control"));
}
if (threshold < 0) {
//lm.15=Collection usage threshold cannot be negative.
throw new IllegalArgumentException(Messages.getString("lm.15")); //$NON-NLS-1$
}
if (exceedsMaxPoolSize(threshold)) {
//lm.16=Collection usage threshold cannot exceed maximum amount of memory for pool.
throw new IllegalArgumentException(Messages.getString("lm.16")); //$NON-NLS-1$
}
this.setCollectionUsageThresholdImpl(threshold);
}
开发者ID:shannah,项目名称:cn1,代码行数:23,代码来源:MemoryPoolMXBeanImpl.java
示例2: setUsageThreshold
import java.lang.management.ManagementPermission; //导入依赖的package包/类
public void setUsageThreshold(long threshold) {
if (!isUsageThresholdSupported()) {
//lm.13=VM does not support collection usage threshold.
throw new UnsupportedOperationException(Messages.getString("lm.13"));
}
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkPermission(new ManagementPermission("control"));
}
if (threshold < 0) {
//lm.15=Collection usage threshold cannot be negative.
throw new IllegalArgumentException(Messages.getString("lm.15")); //$NON-NLS-1$
}
if (exceedsMaxPoolSize(threshold)) {
//lm.16=Collection usage threshold cannot exceed maximum amount of memory for pool.
throw new IllegalArgumentException(Messages.getString("lm.16")); //$NON-NLS-1$
}
this.setUsageThresholdImpl(threshold);
}
开发者ID:shannah,项目名称:cn1,代码行数:23,代码来源:MemoryPoolMXBeanImpl.java
示例3: getBootClassPath
import java.lang.management.ManagementPermission; //导入依赖的package包/类
public String getBootClassPath() {
if (!isBootClassPathSupported()) {
//lm.1A=VM does not support boot classpath
throw new UnsupportedOperationException(Messages.getString("lm.1A")); //$NON-NLS-1$
}
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkPermission(new ManagementPermission("monitor"));
}
return AccessController.doPrivileged(new PrivilegedAction<String>() {
public String run() {
return System.getProperty("sun.boot.class.path");
}// end method run
});
}
开发者ID:shannah,项目名称:cn1,代码行数:18,代码来源:RuntimeMXBeanImpl.java
示例4: getThreadInfo
import java.lang.management.ManagementPermission; //导入依赖的package包/类
public ThreadInfo[] getThreadInfo(long[] ids, int maxDepth) {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkPermission(new ManagementPermission("monitor"));
}
// Validate inputs
for (int i = 0; i < ids.length; i++) {
if (ids[i] <= 0) {
//lm.1B=Thread id must be greater than 0
throw new IllegalArgumentException(Messages.getString("lm.1B")); //$NON-NLS-1$
}
}
if (maxDepth < 0) {
//lm.1D=maxDepth value cannot be negative.
throw new IllegalArgumentException(Messages.getString("lm.1D")); //$NON-NLS-1$
}
// Create an array and populate with individual ThreadInfos
ThreadInfo[] tis = new ThreadInfo[ids.length];
for (int i = 0; i < ids.length; i++) {
tis[i] = this.getThreadInfoImpl(ids[i], maxDepth);
}
return tis;
}
开发者ID:shannah,项目名称:cn1,代码行数:27,代码来源:ThreadMXBeanImpl.java
示例5: setCollectionUsageThreshold
import java.lang.management.ManagementPermission; //导入依赖的package包/类
public void setCollectionUsageThreshold(long threshold) {
if (!isCollectionUsageThresholdSupported()) {
throw new UnsupportedOperationException(
"VM does not support collection usage threshold.");
}
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkPermission(new ManagementPermission("control"));
}
if (threshold < 0) {
throw new IllegalArgumentException(
"Collection usage threshold cannot be negative.");
}
if (exceedsMaxPoolSize(threshold)) {
throw new IllegalArgumentException(
"Collection usage threshold cannot exceed maximum amount of memory for pool.");
}
this.setCollectionUsageThresholdImpl(threshold);
}
开发者ID:freeVM,项目名称:freeVM,代码行数:23,代码来源:MemoryPoolMXBeanImpl.java
示例6: setUsageThreshold
import java.lang.management.ManagementPermission; //导入依赖的package包/类
public void setUsageThreshold(long threshold) {
if (!isUsageThresholdSupported()) {
throw new UnsupportedOperationException(
"VM does not support usage threshold.");
}
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkPermission(new ManagementPermission("control"));
}
if (threshold < 0) {
throw new IllegalArgumentException(
"Usage threshold cannot be negative.");
}
if (exceedsMaxPoolSize(threshold)) {
throw new IllegalArgumentException(
"Usage threshold cannot exceed maximum amount of memory for pool.");
}
this.setUsageThresholdImpl(threshold);
}
开发者ID:freeVM,项目名称:freeVM,代码行数:23,代码来源:MemoryPoolMXBeanImpl.java
示例7: getBootClassPath
import java.lang.management.ManagementPermission; //导入依赖的package包/类
public String getBootClassPath() {
if (!isBootClassPathSupported()) {
throw new UnsupportedOperationException(
"VM does not support boot classpath.");
}
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkPermission(new ManagementPermission("monitor"));
}
return AccessController.doPrivileged(new PrivilegedAction<String>() {
public String run() {
return System.getProperty("sun.boot.class.path");
}// end method run
});
}
开发者ID:freeVM,项目名称:freeVM,代码行数:18,代码来源:RuntimeMXBeanImpl.java
示例8: getThreadInfo
import java.lang.management.ManagementPermission; //导入依赖的package包/类
public ThreadInfo[] getThreadInfo(long[] ids, int maxDepth) {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkPermission(new ManagementPermission("monitor"));
}
// Validate inputs
for (int i = 0; i < ids.length; i++) {
if (ids[i] <= 0) {
throw new IllegalArgumentException(
"Thread id must be greater than 0.");
}
}
if (maxDepth < 0) {
throw new IllegalArgumentException(
"maxDepth value cannot be negative.");
}
// Create an array and populate with individual ThreadInfos
ThreadInfo[] tis = new ThreadInfo[ids.length];
for (int i = 0; i < ids.length; i++) {
tis[i] = this.getThreadInfoImpl(ids[i], maxDepth);
}
return tis;
}
开发者ID:freeVM,项目名称:freeVM,代码行数:27,代码来源:ThreadMXBeanImpl.java
示例9: checkSecurity
import java.lang.management.ManagementPermission; //导入依赖的package包/类
/**
* If JVM security manager exists then checks JVM security 'control' permission.
*/
public static void checkSecurity() {
SecurityManager securityManager = System.getSecurityManager();
if (securityManager != null) {
securityManager.checkPermission(new ManagementPermission(PERMISSION_NAME_CONTROL));
}
}
开发者ID:xm-online,项目名称:xm-commons,代码行数:10,代码来源:XmJvmSecurityUtils.java
示例10: jvmInfo
import java.lang.management.ManagementPermission; //导入依赖的package包/类
public static JvmInfo jvmInfo() {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new ManagementPermission("monitor"));
sm.checkPropertyAccess("*");
}
return INSTANCE;
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:JvmInfo.java
示例11: checkManagementPermission
import java.lang.management.ManagementPermission; //导入依赖的package包/类
protected boolean checkManagementPermission(ManagementPermission perm) {
String name = perm.getName();
if (name.equals("monitor")) {
return true;
}
/*
* "control" sounds bit risky
*/
return false;
}
开发者ID:EvoSuite,项目名称:evosuite,代码行数:13,代码来源:MSecurityManager.java
示例12: resetPeakUsage
import java.lang.management.ManagementPermission; //导入依赖的package包/类
public void resetPeakUsage() {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkPermission(new ManagementPermission("control"));
}
this.resetPeakUsageImpl();
}
开发者ID:shannah,项目名称:cn1,代码行数:8,代码来源:MemoryPoolMXBeanImpl.java
示例13: setVerbose
import java.lang.management.ManagementPermission; //导入依赖的package包/类
public void setVerbose(boolean value) {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkPermission(new ManagementPermission("control"));
}
this.setVerboseImpl(value);
}
开发者ID:shannah,项目名称:cn1,代码行数:8,代码来源:ClassLoadingMXBeanImpl.java
示例14: getInputArguments
import java.lang.management.ManagementPermission; //导入依赖的package包/类
public List<String> getInputArguments() {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkPermission(new ManagementPermission("monitor"));
}
// TODO : Retrieve the input args from the VM
return new ArrayList<String>();
}
开发者ID:shannah,项目名称:cn1,代码行数:10,代码来源:RuntimeMXBeanImpl.java
示例15: findMonitorDeadlockedThreads
import java.lang.management.ManagementPermission; //导入依赖的package包/类
public long[] findMonitorDeadlockedThreads() {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkPermission(new ManagementPermission("monitor"));
}
return this.findMonitorDeadlockedThreadsImpl();
}
开发者ID:shannah,项目名称:cn1,代码行数:8,代码来源:ThreadMXBeanImpl.java
示例16: getAllThreadIds
import java.lang.management.ManagementPermission; //导入依赖的package包/类
public long[] getAllThreadIds() {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkPermission(new ManagementPermission("monitor"));
}
return this.getAllThreadIdsImpl();
}
开发者ID:shannah,项目名称:cn1,代码行数:8,代码来源:ThreadMXBeanImpl.java
示例17: resetPeakThreadCount
import java.lang.management.ManagementPermission; //导入依赖的package包/类
public void resetPeakThreadCount() {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkPermission(new ManagementPermission("control"));
}
this.resetPeakThreadCountImpl();
}
开发者ID:shannah,项目名称:cn1,代码行数:8,代码来源:ThreadMXBeanImpl.java
示例18: setThreadContentionMonitoringEnabled
import java.lang.management.ManagementPermission; //导入依赖的package包/类
public void setThreadContentionMonitoringEnabled(boolean enable) {
if (!isThreadContentionMonitoringSupported()) {
//lm.1E=Thread contention monitoring is not supported on this virtual machine.
throw new UnsupportedOperationException(Messages.getString("lm.1E")); //$NON-NLS-1$
}
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkPermission(new ManagementPermission("control"));
}
this.setThreadContentionMonitoringEnabledImpl(enable);
}
开发者ID:shannah,项目名称:cn1,代码行数:13,代码来源:ThreadMXBeanImpl.java
示例19: setThreadCpuTimeEnabled
import java.lang.management.ManagementPermission; //导入依赖的package包/类
public void setThreadCpuTimeEnabled(boolean enable) {
if (!isThreadCpuTimeSupported()) {
//lm.01=Thread CPU timing is not supported on this virtual machine.
throw new UnsupportedOperationException(Messages.getString("lm.01")); //$NON-NLS-1$
}
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkPermission(new ManagementPermission("control"));
}
this.setThreadCpuTimeEnabledImpl(enable);
}
开发者ID:shannah,项目名称:cn1,代码行数:13,代码来源:ThreadMXBeanImpl.java
示例20: testManagementPermissionString
import java.lang.management.ManagementPermission; //导入依赖的package包/类
public void testManagementPermissionString() {
ManagementPermission control = new ManagementPermission("control");
assertEquals("control", control.getName());
ManagementPermission monitor = new ManagementPermission("monitor");
assertEquals("monitor", monitor.getName());
try {
new ManagementPermission("invalid");
fail();
} catch (IllegalArgumentException e) {
}
}
开发者ID:shannah,项目名称:cn1,代码行数:14,代码来源:ManagementPermissionTest.java
注:本文中的java.lang.management.ManagementPermission类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论