is it necessary to lock a key handler

i have an XKeyHandler attached to thiscomponent.currentcontroller that executes a largish amount of code. i suspect that sometimes – like when i fumble-finger the keyboard – it is stepping on itself. i have added a variable lock = true at the top of the function and set it to false at the bottom, of course testing for state before entering the meat of the function. is this necessary? it there a built-in way to lock? or is it completely my imagination?

thanks,
-dave

Testing reveals that given too much code and too little time, a handler will definitely start processing the next keystroke before it is done with the previous one. It seems likely they would not be guaranteed to finish in the same order as typed and even so, likely that this could cause unwanted behavior in the program as a whole.