velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henning Schmiedehausen <...@intermeta.de>
Subject Re: user-written templates / reflection safety
Date Sun, 09 Oct 2005 17:27:23 GMT
On Sun, 2005-10-09 at 15:09 +0200, Daniel Dekany wrote:

> I agree, but how to limit the maximum runtime? One could start a thread
> for template executing and then stop it, but stopping threads is not
> safe (and thus is deprecated).

Don't stop the Thead directly. Be creative. :-)

e.g. register the time when entering the parsing process. Add a method
to your nodes that compares the starting time to the current time when
processing the node. Abort processing when currTime > startTime +
allowedRunTime.

Or use a variant that involves a thread based trigger and just a flag
check in the node processing. As long as you don't allow custom Java
code to be executed and trust the code that you allow to be executed,
you will hit the various tree nodes on a pretty regular base.

Not an exact measurement but this not runtime accounting anyway.

As I said: You might impose a performance penalty on all the other
users. That's why you have to think about it. 

Best regards
Henning


-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

      RedHat Certified Engineer -- Jakarta Turbine Development
   Linux, Java, perl, Solaris -- Consulting, Training, Engineering

                     4 - 8 - 15 - 16 - 23 - 42


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message