Java thread affinity

You can’t do this in pure java. But if you really need it — you can use JNI to call native code which do the job. This is the place to start with: http://ovatman.blogspot.com/2010/02/using-java-jni-to-set-thread-affinity.html http://blog.toadhead.net/index.php/2011/01/22/cputhread-affinity-in-java/ UPD: After some thinking, I’ve decided to create my own class for this: ThreadAffinity.java It’s JNA-based, and very simple — … Read more

VBA Macro On Timer style to run code every set number of seconds, i.e. 120 seconds

When the workbook first opens, execute this code: alertTime = Now + TimeValue(“00:02:00”) Application.OnTime alertTime, “EventMacro” Then just have a macro in the workbook called “EventMacro” that will repeat it. Public Sub EventMacro() ‘… Execute your actions here’ alertTime = Now + TimeValue(“00:02:00”) Application.OnTime alertTime, “EventMacro” End Sub

Java Timer vs ExecutorService?

According to Java Concurrency in Practice: Timer can be sensitive to changes in the system clock, ScheduledThreadPoolExecutor isn’t. Timer has only one execution thread, so long-running task can delay other tasks. ScheduledThreadPoolExecutor can be configured with any number of threads. Furthermore, you have full control over created threads, if you want (by providing ThreadFactory). Runtime … Read more