Sure would be nice with a justice system based on what works to reduce crime, rather than what feels "right".
Good thing that's actually the case in my country.
What solution is that?
The death penalty doesn't reduce crime, according to several studies.
Incarceration doesn't reduce crime, and often winds up creating criminals better trained in crime via exposure to more experienced criminals.
I've not seen any positive studies on rehabilitation rates for violent criminals, so I'm not inclined to believe that a rehabilitation program is super-effective, either.
Reactive measures like incarceration and execution just takes extant criminals out of circulation, but improvements in the environment(clean streets, good illumination), birth control, education, healthcare, employment rates and minimum wage are known to be good for preventing 'routine' violent crimes, mainly by wiping out motive and moving violent crime away from the norm. Moderate to high standards of living with small income gaps help as well.
Won't do much for this type of massacre though, theres limited prevention available since these are caused by individuals snapping under whatever reasons. About the best you can do is limit the number of people they can kill before the law catches up to them(limiting the firepower available to civilians, increasing surveillance, etc). Around here, the biggest weapons easily available are handguns(police, militia equivalents and contraband) , shotguns and bush whacking knives. Not very conducive to large massacres(mostly, the offenders would wound/kill a couple of people before everyone else is out of range), and much easier to stop by the authorities. Upping surveillance would increase the response time, giving the guy who's suspiciously heavily armed and armored a good questioning. Neither option seems popular to americans though.
Of course, generally these massacres are also not usually repeat offenders. Career criminals do not make a habit of killing sprees, its a fast track to getting bumped up in priority, getting arrested and executed. Rehabilitation is less useful than say...improved mental healthcare.