When use Security.loadPolicyFile to load security policyfile

Security.loadPolicyFile(“xmlsocket://”+SERVER_NAME+":5229"); when i use this to load security policyfile sometimes ,sometimes it fails , what should I to catch the Exception, and reload the security policyfile . thanks