Java hangs even though shell script’s execution is completed

I'm trying to execute a script from within my java code. The execution of the script is over(it's pid is no more), but java is stuck on waitFor() method of the shell script process!. And yes, I'm reading output and error streams in 2 separate threads. Yes, they are being joined at the end(after waitFor()).

The aspect which makes this question relevant to this forum is, if I put the following line in the shell script(at the top), everything seems to work fine.

exec 3>&1 > /tmp/some_log 2>&1 

And no, interestingly enough, the script doesn't generate any output!. Zero chars!. So putting exec statement there makes no sense!

But still, magically enough, putting exec statement in the script makes java work!. Why??

How can I avoid that illogical exec statement in the script?.

exec has any other functionality here, other than redirection?

P.S: This definitely has got something to do with exec command, hence, this question is meant for shell/script guys and not necessarily for Java guys.