must have message processing improvements

before i made the change application was consuming 100% CPU.
It's probably something within the setImmidiate that cause this
In order free CPU usage. i made this little trick then when there are no message there will be a timeout of 25 milliseconds.

when message do arrive next processing will happen immediately.

this change is harmless but necessary