I have an ECMAScript function, which calls some Java methods.

Most of the time this works just fine but if you feed it invalid data. The Java method just hangs.

Anyone know of a way to wrap such a function call in a timer on a separate Java thread such that after say 30 seconds, the thread can be cleanly shutdown and script processing continue rather than hang the entire driver.