J.S.
I would encourage you to give attention immediately to your 7 year old son, take him into another room, and ignore your 4 year old. This is a logical consequence that teaches, when you hit your loved ones they do not want to be around you. Later after the situation has calmed down, talk with and process what happened. You can give an external consequence if you would like (such as the ones for getting active energy out). I would encourage you to do problem solving surrounding the situation to help him think about what happened and what his choices were and what consequences those choices led to. Frustration tolerance is a skill that people and children can be taught. Right now he is 4 and does not know what to do when upset, but he can learn. A great book that I use is John Gottman's "How to Raise an Emotionally Intelligent Child." I had a friend whose 3 year old was jealous of the 1 year old and hitting a lot. He was getting sent to time out all the time. What she discovered is that when she combined rewarding positive behavior (we often don't notice or reward our children when they are playing nicely with each other) with ignoring the negative, it worked out better for her. At first she was concerned because she felt she needed to address the hitting with consequences, but found that the other way (ignoring) just worked better. Her son was using the hitting and time outs as a way to get negative attention from her (as she would sit and talk about why he should not hit, etc.). Once she began ignoring, he stopped hitting. Good luck.