Closed sbaranov-iqmessenger closed 2 years ago
The io.moquette.broker.Server
class is also used in bat
and sh
scripts used by the tar.gz distribution of Moquette. To complete this PR we should create another class (maybe io.moquette.broker.Launcher
that simply wrap Server
and catch for the exceptions, because in case of bind error, it should exit with error code without ugly traces in the console.
The
io.moquette.broker.Server
class is also used inbat
andsh
scripts used by the tar.gz distribution of Moquette. To complete this PR we should create another class (maybeio.moquette.broker.Launcher
that simply wrapServer
and catch for the exceptions, because in case of bind error, it should exit with error code without ugly traces in the console.
I didn't change current exception "culture" and don't throw BindException to not add additional exceptions in method signatures. What do you think ?
We are almost there, please integrate the suggestion and we are good to merge.
I've committed what you suggested but is there any benefit of containing human readable "Cannot bind..." because in Server.main
I don't log exception. I just call System.exit(1) without any logging
is there any benefit of containing human readable "Cannot bind..."
I think it's useful in the code that use that method, incorporating it as a library, maybe it want to log the cause of the error, if we don't throw a specific error excpetion.
is there any benefit of containing human readable "Cannot bind..."
I think it's useful in the code that use that method, incorporating it as a library, maybe it want to log the cause of the error, if we don't throw a specific error excpetion.
oh, yeah, you are right. I got it
Thanks a lot @sbaranov-iqmessenger for contributing! Warm welcome
Release notes
Avoid Server.startServer to exit the process it port is bound, just raise an error (#646)
#641 just there was removed System.exit(1)