As posted in another thread
Is there away to disallow multi instances from running?
For a release build you can use launch4j to prevent a non UI or even a UI program from loading a second instance.
However I was wondering if this could be accomplished someway in the code currently?
The server should fail to start if there is already a running server that listens to the same port. You can use Try / Catch to catch the error and close the second instance.