First of all.. Using SIGAR, SIGAR use to be aware of whether the distinction is web or local. It is best to copy the DLL file under Web-inf. Because Web-inf will not be compressed ...
Try { //If you are running Web-mode: Webapplicationcontext Web =Contextloader.getcurrentwebapplicationcontext (); ServletContext Context=Web.getservletcontext (); LibPath= Context.getrealpath ("Web-inf/c_lib"); } Catch(Noclassdeffounderror err) {//non-web mode//err.printstacktrace (); Try{LibPath= Urldecoder.decode (sigarutil.class. getClassLoader (). GetResource ("Clib"). GetFile (), "Utf-8"); } Catch(Unsupportedencodingexception ex) {ex.printstacktrace (); } } Catch(Exception e) {Throw NewRuntimeException ("Exception occurred:" + e.getcause () + ", Reason:" +e.getmessage ()); }
Use @cacheput () to put information into the cache .....
Use @Scheduled execute every second: Put to cache ...
Note: @CachePut method cannot be placed under a class with @Scheduled ... Anyway, I put together a mistake .... The reason is unknown .....
Java uses SPIRNG to monitor CPU usage status ....