Maggots in Plums

I have a Victoria Plum tree which produced next to no fruit last year due to the weather conditions. The previous year was very good.

This year it is hanging with fruit which is ripening nicely, I have just picked the first dozen or so and upon cutting open to destone ready for freezing every fruit had a small maggot inside and the fruit was marked near to the stone, can any body tell me

1.What these maggots are.

2. How do I stop this happening in the future

3. Is the fruit ok to eat if the affected area is cut away and disposed of