Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   beanshell interpreter (http://www.velocityreviews.com/forums/t624082-beanshell-interpreter.html)

timinganalyzer 07-07-2008 12:20 AM

beanshell interpreter
 
Hello All,

I am trying to use the beanshell interpreter and JConsole in my
application.

I have a problem when I start the interpreter in a new thread.

//JConsole bshConsole = new JConsole();
// Interpreter interpreter = new Interpreter(bshConsole);
// interpreter.set("taApp", this);
// Thread thread = new Thread(interpreter,"BeanShell");
// thread.setDaemon(true);
// thread.start();

Sometimes my scripts generate a ConcurrentModificationException. I
think I know why, my main application is redrawing the objects from
paintComponent() when the bsh script is trying to modify one of the
objects,

I can run the scripts as shown in the code below that does not use the
JConsole..

try
{
interp = new Interpreter();
interp.set("taApp", taApp );
interp.source( scriptDir +
System.getProperty("file.separator") +
scriptFileName);
} catch ( TargetError e1 ) {

I have no experience with threads and didn't plan on using threads but
It looks like you have to use a thread as shown above to get the
interpreter started in the JConsole. I hope I am wrong, but I
wanted to ask you if I have any other options? Looking for advice?

Thanks in advance,


All times are GMT. The time now is 03:37 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.