January 12, 201610 yr We are using SM (version 4.42) on a windows server and running a bunch of timed scripts to do various things. What is happing is that the server's HD is filling up with copies of the Jar files that are being used by the java code. For instance we are running a timed scripted every 15 minutes and a new instance of the Jar files is being created each time (and the old ones are NOT being deleted) at C:\Users\BCGCFMSvc\AppData\Local\Temp\ScriptMaster_bcgcfmsvc\Scriptmaster2975213099741919606commons-io-2.4.jar Any ideas why these are collecting and what to do?
January 12, 201610 yr Are you running the script to load the jar fies EACH and every time you run the script (or is it in your start-up script)? This is mostly un-neccessary.. As far as I know, and with some experience. The JVM when instantiated needs the jars loaded once but then it is bound to the FMSE component of the server so only needs reloading when the Script Engine is re-started. There is an issue here which no one at 360w seems to want to address - which is that the FIRST time after you load jar files you can get a result from SMGetLoadedJars but then never again until a restart - which makes it useless as a checking mechanism. A workaround for this is a simple function which just returns true so you can check if that is currently giving you back an answer of 1. Edited January 12, 201610 yr by john renfrew
January 12, 201610 yr Author Ah, I am sure I am loading it each time as I thought I had to because I thought that on the server each time a timed script is run that it is a "new" session and everything needs to be like it is the first time…UGH. I am sure I read that somewhere at least as far as temp files are concerned that the server writes in the temp path. Darn, that explains a lot and I guess I don't need to register java code every time either? And yeah it would be nice to use SMGetLoadedJars to check whether the jars are loaded already so they don't accumulate!!! And thanks as always, John. Always a big help. Edited January 12, 201610 yr by Bailey Kessing
January 12, 201610 yr Thanks Bailey.. RegisterGroovy( "SMisLoaded" ; "// v1.0¶ ¶ return true¶ ; isGui = false " )
January 13, 201610 yr Yes.. but if you load jars first and then have this as the last Groovy function loaded, and only if there are no errors in the loading jars and registering Groovy functions then you can be pretty certain everything is OK, and then this function can be used as the test If ( not SMisLoaded or SMisLoaded = "?" ) //fault condition, reset and re-load else //OK condition, dont re-load then..... end
Create an account or sign in to comment