From Wikipedia's Good Friday Agreement article:
The agreement reached was that Northern Ireland was part of the United Kingdom, and would remain so until a majority of the people both of Northern Ireland and of the Republic of Ireland wished otherwise. Should that happen, then the British and Irish governments are under "a binding obligation" to implement that choice.
My understanding is that if public sentiment seems to be more for Northern Ireland leaving the UK and joining the Republic of Ireland that a referendum would be held and that it is mandatory for it to be held although I can't find a reference for that. I understand the "binding obligation" as the results of a positive referendum must be carried out as soon as is practical.
If the referendum was narrowly defeated and public sentiment was still the same, what would be the trigger for another referendum? How would you avoid a run of referenda with the same result? I.e. it seems before the referendum that it would succeed therefore must be held, but it fails.
I imagine a failed referendum would be disastrous and would probably lead to violence. What measures are in place to ensure such a situation doesn't happen?