Worrying about the future does not make sense. If you are a believer in God you will know that what has to be has already been and your worries will not be able to prevent certain situations from changing.
These thoughts tend to come back again and again to the mind. This is somewhat normal and is often only temporary since the thoughts disappear once the person sees things objectively.
Focus your energy on another activity
Work, study, play or read to stop thoughts. Develop a passion or a hobby to keep your mind occupied. In most cases you can overcome obsessive thoughts by diverting your mind and participating in some activity.
Stop the obsessive thoughts! learn a positive phrase
Every time a thought arises in your mind, stop it in your path. Repeat that positive favorite phrase and believe it. Observe your mind and your feelings and accept those emotions that rise to the surface. Soon you will learn to do this and you will stop obsessing or worrying.
Obsessive thinking is often the result of sitting or inactive. So move! If you are at work, go talk to your colleagues or take a short break and walk. At home you can practice yoga, exercise, etc.
Accept what happened
Life is not fair but you must get rid of old luggage. It does not matter if he treats you well or badly, here the important thing is to have the right tools to face what is coming good or bad. You need to use the past as a learning experience and move on.
Surround yourself with people who motivate you
Keeping yourself happy is easier when you have good friends around you. Go out and meet people. This will divert your mind. Use the sense of humor to raise your mood.