Hello Paul,
Java and the OS themselves should not allow you to bind to an already
open port, and with Restlet 2.0.x series this is what I've seen here
on my machine, a BindException thrown if I try to start my application
bound to an already open port.
The code to start the application is more or less like this:
if (!component.isStarted()) {
try {
component.start();
} catch (Exception ex) {
if (ex instanceof BindException) {
log.error("Port is already used by another
service, please choose another port for your Restlet Server");
throw new RuntimeException(); // or anything else
that would stop your application from running
}
}
} else {
log.warn("Your Restlet Server is already started");
}
Hope this helps, good luck!
On Thu, Oct 20, 2011 at 6:43 PM, Paul Heaberlin <[email protected]> wrote:
> I was wondering how it is that Restlet doesn't have a "JVM_Bind error" when I
> start up multiple instances of a test server (I'm running
> MailServerApplication, a subclass of Application, from the MEAP) running on
> port 8111. I was running one of the examples and not getting the expected
> results because I didn't realize I'd left the previous version of the code
> running in the background.
>
> Most other software I've used (Tomcat, JBoss) will throw an error when it
> starts if a port that's needed is already being used. I've searched the
> Restlet forums and found someone stating that they ran into this problem, so
> I'm unsure of how it didn't happen for me.
>
> Thanks,
> Paul
>
> ------------------------------------------------------
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2859717
>
--
Fabián Mandelbaum
IS Engineer
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2859876