Answer:
Beat the crap out of him until he stops. Then give him a treat.
It is both very cruel and highly ineffective to 'beat the crap' of a dog for ANY reason.
If he is whining, you need to find out why! It is more often human error that creates this scenario.
A dog will whine for many reasons, he may be hungry, thirsty, in pain, lonely, cold. Use some common sense.
Having worked as an inspector for the SPCA in New Zealand, part of my job was to rescue animals from idiots like you who do 'beat the crap' out of them. Grow up !!!