Method: Server::InstanceMethods#run
- Defined in:
- lib/server/instance_methods.rb
#run(port = self.port) ⇒ Object
rubocop: disable Metrics/AbcSize rubocop: disable Metrics/MethodLength
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/server/instance_methods.rb', line 77 def run(port = self.port) channel = bootstrap.bind(port).sync().channel() channel_group.add(channel) ::Server::ShutdownHook.new(self) log.info "Listening on #{channel.local_address}" channel.closeFuture().sync() rescue java.lang.IllegalArgumentException => e raise "Invalid argument: #{e.}" rescue java.net.BindException => e raise "Bind error: #{e.}: #{[:host]}:#{port}" rescue java.net.SocketException => e raise "Socket error: #{e.}: #{[:host]}:#{port}" ensure stop end |