i honestly have no idea. I suppose I do some compartmentalization.
For instance, I have some relationship issues at the moment, and I started thinking about it before an interview (which is a bad idea!) so I stopped myself and said "Not right now!" and i forced myself away from that line of thought. I dealt with it later.
Something that I've heard a lot of soldiers use is the "shoe box" method.
"Take everything you just saw, and put in that box, and put that box away"
If you mentally go through those steps, you can deal with a huge amount of trauma. I imagine it would work for less serious things as well.