⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 resourcemonitor.java

📁 First of all, the Applet-phone is a SIP User-Agent with audio and text messaging capabilities. But
💻 JAVA
字号:
/* * ResourceMonitor.java * * Created on July 28, 2003, 9:45 AM */package gov.nist.security.bcs.monitor;import org.apache.log4j.Logger;/** * Class monitoring the instruction resources allocated for a service * @author DERUELLE Jean */public class ResourceMonitor {    /** log4j logging*/    private static Logger logger = Logger.getLogger(ResourceMonitor.class);    /**the number of instructions read at this time*/    private int currentInstructionCount=0;        /**the service*/    private String service=null;         /**the access control context of the jvm with wich we will check the resource permission*/    private java.security.AccessControlContext context=null;    /**      * Creates a new instance of ResourceMonitor      * @param mainClass - the main class where is the resource monitor     */    public ResourceMonitor(String mainClass) {        service=mainClass;        SecurityManager securityManager=System.getSecurityManager();        if (securityManager != null)             context = (java.security.AccessControlContext) securityManager.getSecurityContext();      }        /**     * This is called before a basic block is entered.      * @param instructionCount -the number of instructions executed in the basic block.           */    public void countInstructions(int instructionCount) {        currentInstructionCount +=instructionCount;                         try{            gov.nist.security.permissions.InstructionResourcePermission instructionResourcePermission=new gov.nist.security.permissions.InstructionResourcePermission(Integer.toString(currentInstructionCount),"allowed");            //System.out.println("Checking in your group policy file for the following RESOURCE PERMISSION : "+ instructionResourcePermission);            context.checkPermission(instructionResourcePermission);                          }        catch(Exception e){            System.out.println("The service "+service+" has overstepped its instructions limits ");                        System.out.println("The service "+service+" is exited");                        System.exit(1);         }                                                                 }        /**     *  Reinitializes the currentInstructionCount to zero     */    public void restartCounting(){        currentInstructionCount=0;            }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -