If the pirates could get aboard the tanker, then so can Navy SEALs and if they can get aboard at all they can probably do so undetected.
Once that happens I really don't think the pirates would stand a chance.
As to ending this in the future I think we will start seeing these ships arm themselves and carrying security people.
This might be a good market for the
Active Denial System