Hey all, Im working in IBM Websphere ILOG JRules 7.0 using RuleStudio (modified Eclipse) and am having an issue trying to implement a TimerTask.
I created a Techincal Rule based off a different rule that I know works and tried to add some code that would wait 5 seconds and then send a secondary message. I tried this via the following code:
int interval = 5000; // 5 sec
java.util.Date timeToRun = new java.util.Date(System.currentTimeMillis() + interval);
java.util.Timer timer = new java.util.Timer();
timer.schedule(new java.util.TimerTask() {
public void run() {
// Message Sent Here
}
}, timeToRun);
However, this code does not compile. The error it points out is on the open bracket right after new java.util.TimerTask() and the error messag is at token "{".
Some interesting observations though:
-I tried doing java.util.TimerTask test = new java.util.TimerTask(); and it throws an error at new java.util.TimerTask(); saying Could not find a public constructor (or argument mismatch) for java.util.TimerTask. Which I find odd since it’s defintaly imported.
-I have Java version 1.6.0_17 installed on my comp, if it matters.
Thanks!
Noticed this was still open, turned out that the engine we were using has a customized java library on it that didnt include TimerTask… doh. Went with a thread sleep command that the library actually had.