コード例 #1
0
 /** Start listening */
 public void bind() {
   bootstrap
       .localAddress(jtl.getPort())
       .bind()
       .addListener(
           new ChannelFutureListener() {
             @Override
             public void operationComplete(final @Nullable ChannelFuture future) throws Exception {
               assert future != null;
               if (!future.isSuccess()) {
                 logger.log(
                     Level.SEVERE,
                     "Cannot bind transport listener "
                         + jtl.getId()
                         + ": fix the problem and, either stop/start the component or use the JMX API to (re-)set the port",
                     future.cause());
                 lastBindingError = future.cause().getMessage();
               } else {
                 channel = future.channel();
                 lastBindingError = "";
               }
             }
           });
 }