Starts MoSKito Inspect Backend.
@param port port on which to start moskito rmi listener. If not specified (-1) either default or configured by distributeme port is used.
@throws MoSKitoInspectStartException
346547
public static void startMoSKitoInspectBackend(int port) throws MoSKitoInspectStartException{

		log.info("Starting moskito-inspect remote agent at port "+port);

		Class serverClazz = null;
		Exception exception = null;
		try{
			serverClazz = Class.forName("net.anotheria.moskito.webui.shared.api.generated.CombinedAPIServer");
			Method startMethod = serverClazz.getMethod("createCombinedServicesAndRegisterLocally", int.class);
			startMethod.invoke(null, port);
		}catch(ClassNotFoundException e){
			exception = e;
			log.error("Couldn't find the backend server class", e);
		}catch(NoSuchMethodException e){
			exception = e;
			log.error("Couldn't find the method in server class", e);
		} catch (InvocationTargetException e) {
			exception = e;
			log.error("Couldn't invoke start method", e);
		} catch (IllegalAccessException e) {
			exception = e;
			log.error("Couldn't invoke start method", e);
		}

		if (exception!=null){
			throw new MoSKitoInspectStartException(exception);
		}
	}
1232532
@Override
  public ServerImpl start() throws IOException {
    synchronized (lock) {
      checkState(!started, "Already started");
      checkState(!shutdown, "Shutting down");
      // Start and wait for any ports to actually be bound.

      ServerListenerImpl listener = new ServerListenerImpl();
      for (InternalServer ts : transportServers) {
        ts.start(listener);
        activeTransportServers++;
      }
      executor = Preconditions.checkNotNull(executorPool.getObject(), "executor");
      started = true;
      return this;
    }
  }
762471
void checkPort(int port, String msg) {
        StringBuilder message = new StringBuilder().append(" ").append(msg);
        String portInUseError = String.format("Port %d is already in use. Please shutdown the service "
                + "listening on this port or configure a different port%s.", port, message);
        boolean free = false;
        try {
            free = PortProber.pollPort(port);
        } catch (RuntimeException e) {
            throw new IllegalArgumentException(portInUseError, e);
        } finally {
            if (!free) {
                throw new IllegalArgumentException(portInUseError);
            }
        }
    }
509061
public void startServer() {
        if (!System.getProperties().containsKey(JMX_ENABLED_PROPERTY)) {
            this.logger.info(
                    "System Property '"
                            + JMX_ENABLED_PROPERTY
                            + "' is not set, skipping initialization.");
            return;
        }

        try {
            // Get the base rmi port
            final int portOne = this.getPortOne();

            // Get the second rmi port or calculate it
            final int portTwo = this.calculatePortTwo(portOne);

            // Create the RMI registry on the base port
            try {
                LocateRegistry.createRegistry(portOne);

                if (this.logger.isDebugEnabled()) {
                    this.logger.debug("Started RMI Registry on port " + portOne);
                }
            } catch (RemoteException re) {
                throw new IllegalStateException(
                        "Could not create RMI Registry on port " + portOne, re);
            }

            // Generate the JMX Service URL
            final JMXServiceURL jmxServiceUrl = this.getServiceUrl(portOne, portTwo);

            // Map for the JMX environment configuration
            final Map<String, Object> jmxEnv = this.getJmxServerEnvironment();

            // Create the MBean Server
            final MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();

            // Create the JMX Connector
            try {
                this.jmxConnectorServer =
                        JMXConnectorServerFactory.newJMXConnectorServer(
                                jmxServiceUrl, jmxEnv, mbeanServer);

                if (this.logger.isDebugEnabled()) {
                    this.logger.debug(
                            "Created JMXConnectorServer for JMXServiceURL='"
                                    + jmxServiceUrl
                                    + "', jmxEnv='"
                                    + jmxEnv
                                    + "' MBeanServer='"
                                    + mbeanServer
                                    + "'");
                }
            } catch (IOException ioe) {
                throw new IllegalStateException(
                        "Failed to create a new JMXConnectorServer for JMXServiceURL='"
                                + jmxServiceUrl
                                + "', jmxEnv='"
                                + jmxEnv
                                + "' MBeanServer='"
                                + mbeanServer
                                + "'",
                        ioe);
            }

            // Start the JMX Connector
            try {
                this.jmxConnectorServer.start();
                this.logger.info(
                        "Started JMXConnectorServer. Listening on '" + jmxServiceUrl + "'");
            } catch (IOException ioe) {
                throw new IllegalStateException("Failed to start the JMXConnectorServer", ioe);
            }
        } catch (RuntimeException re) {
            if (this.failOnException) {
                throw re;
            }

            this.logger.error("Failed to initialize the JMX Server", re);
        }
    }
207118
public void startUp() throws Exception {
    logger.info(String.format("Starting RPC server on port %d", port));
    ServerBootstrap bootstrap = new ServerBootstrap();

    ChannelFuture futureChannel = bootstrap.group(parentGroup, childGroup)
        .channel(channelClass)
        .childHandler(channelInitializer())
        .bind(port)
        .awaitUninterruptibly();

    if (futureChannel.isSuccess()) {
      this.channel = futureChannel.channel();
      logger.info("RPC server started successfully.");
    } else {
      logger.info("Failed to start RPC server.");
      throw new Exception(futureChannel.cause());
    }
  }
1017511
@Handler
    public void onStart(Start event) throws IOException {
        closing = false;
        serverSocketChannel = ServerSocketChannel.open();
        serverSocketChannel.bind(serverAddress, backlog);
        MBeanView.addServer(this);
        fire(new NioRegistration(this, serverSocketChannel,
            SelectionKey.OP_ACCEPT, this), Channel.BROADCAST);
    }
456509
@Override
    public void init() throws ChannelException {
        if (this.config.isInbound()) {
            // Customize the TCPChannel configuration object so that it knows
            // what port to use for this chain.
            this.endPoint = createEndPoint();
            initializePort();
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, " listening port: " + this.endPoint.getListenPort());
            }
        }
    }
227836
synchronized void start(final ManagedServerBootCmdFactory factory) {
        final InternalState required = this.requiredState;
        // Ignore if the server is already started
        if(required == InternalState.SERVER_STARTED) {
            return;
        }
        // In case the server failed to start, try to start it again
        if(required != InternalState.FAILED) {
            final InternalState current = this.internalState;
            if(current != required) {
                // TODO this perhaps should wait?
                throw new IllegalStateException();
            }
        }
        operationID = CurrentOperationIdHolder.getCurrentOperationID();
        bootConfiguration = factory.createConfiguration();
        requiredState = InternalState.SERVER_STARTED;
        ROOT_LOGGER.startingServer(serverName);
        transition();
    }
159202
public void start()
    {
        String nativeFlag = System.getProperty("cassandra.start_native_transport");
        if ((nativeFlag != null && Boolean.parseBoolean(nativeFlag)) || (nativeFlag == null && DatabaseDescriptor.startNativeTransport()))
            nativeServer.start();
        else
            logger.info("Not starting native transport as requested. Use JMX (StorageService->startNativeTransport()) or nodetool (enablebinary) to start it");

        String rpcFlag = System.getProperty("cassandra.start_rpc");
        if ((rpcFlag != null && Boolean.parseBoolean(rpcFlag)) || (rpcFlag == null && DatabaseDescriptor.startRpc()))
            thriftServer.start();
        else
            logger.info("Not starting RPC server as requested. Use JMX (StorageService->startRPCServer()) or nodetool (enablethrift) to start it");
    }
1158942
public static void start(String webAppDir, int port, String context, int scanIntervalSeconds) {
		server = com.jfinal.server.jetty.ServerFactory.getServer(webAppDir, port, context, scanIntervalSeconds);
		server.start();
	}
419764
public void start() throws Exception
    {
        if (isStarted())
            throw new IllegalStateException("Started");

        // Create a new server socket and set to non blocking mode
        _acceptChannel= ServerSocketChannel.open();
        _acceptChannel.configureBlocking(false);

        // Bind the server socket to the local host and port
        _acceptChannel.socket().bind(_address);

        // Read the address back from the server socket to fix issues
        // with listeners on anonymous ports
        _address= (InetSocketAddress)_acceptChannel.socket().getLocalSocketAddress();

        // create a selector;
        _selector= Selector.open();

        // Register accepts on the server socket with the selector.
        _acceptChannel.register(_selector, SelectionKey.OP_ACCEPT);

        // Start selector thread
        _selectorThread= new SelectorThread();
        _selectorThread.start();

        // Start the thread Pool
        super.start();
        log.info("Started SocketChannelListener on " + getHost()+":"+getPort());
    }
768205
@Override
    public void start() throws ChannelException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "start");
        }
        if (this.stopFlag) {
            // only start once
            this.stopFlag = false;
            if (this.config.isInbound()) {
                // Socket is already open, just need to start accepting connections
                try {
                    // PK60924 - check for a restart path requiring the re-init
                    if (null == this.endPoint.getServerSocket()) {
                        initializePort();
                    }
                    acceptReqProcessor.get().registerPort(this.endPoint);
                    this.preparingToStop = false;

                    String IPvType = "IPv4";
                    if (this.endPoint.getServerSocket().getInetAddress() instanceof Inet6Address) {
                        IPvType = "IPv6";
                    }

                    if (this.config.getHostname() == null) {
                        this.displayableHostName = "*  (" + IPvType + ")";
                    } else {
                        this.displayableHostName = this.endPoint.getServerSocket().getInetAddress().getHostName() + "  (" + IPvType + ": "
                                                   + this.endPoint.getServerSocket().getInetAddress().getHostAddress() + ")";
                    }
                    Tr.info(tc, TCPChannelMessageConstants.TCP_CHANNEL_STARTED,
                            new Object[] { getExternalName(), this.displayableHostName, String.valueOf(this.endPoint.getListenPort()) });

                } catch (IOException e) {
                    FFDCFilter.processException(e, getClass().getName() + ".start", "100", this);
                    if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                        Tr.event(tc, "TCP Channel: " + getExternalName() + "- Problem occurred while starting TCP Channel: " + e.getMessage());
                    }
                    ChannelException x = new ChannelException("TCP Channel: " + getExternalName() + "- Problem occurred while starting channel: " + e.getMessage());
                    // Adjust flag so follow up attempt is possible.
                    this.stopFlag = true;
                    throw x;
                }
            }
            if (this.config.getDumpStatsInterval() > 0) {
                createStatisticsThread();
            }
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "start");
        }
    }
1040271
@Override
    protected void doStart() throws Exception
    {
        log.info("starting...");
        super.doStart();
        _client = newClient(_serverString);
        if (_client == null)
        {
            throw new IllegalStateException("newClient(" + _serverString + ") returns null.");
        }
        log.info("use " + _client.getClass().getSimpleName() + " as client factory.");
        _client.establish();
        log.info("started.");
    }
614387
def _init_zmq(self, port_publish, port_subscribe):
        

        log.debug('kernel {} publishing on port {}'
                  ''.format(self.analysis.id_, port_publish))
        self.zmq_publish = zmq.Context().socket(zmq.PUB)
        self.zmq_publish.connect('tcp://127.0.0.1:{}'.format(port_publish))

        log.debug('kernel {} subscribed on port {}'
                  ''.format(self.analysis.id_, port_subscribe))
        self.zmq_sub_ctx = zmq.Context()
        self.zmq_sub = self.zmq_sub_ctx.socket(zmq.SUB)
        self.zmq_sub.setsockopt(zmq.SUBSCRIBE,
                                self.analysis.id_.encode('utf-8'))
        self.zmq_sub.connect('tcp://127.0.0.1:{}'.format(port_subscribe))

        self.zmq_stream_sub = zmq.eventloop.zmqstream.ZMQStream(self.zmq_sub)
        self.zmq_stream_sub.on_recv(self.zmq_listener)

        # send zmq handshakes until a zmq ack is received
        self.zmq_ack = False
        self.send_handshake()
473761
public void start() throws ConfigurationException {
		if (connectionFactory == null) {
			throw new ConfigurationException("can not start without client socket factory");
		}
		try {
			server = new ServerSocket(port);
		} catch (IOException e) {
			System.out.println(new LogEntry(e.getMessage(), e));
			throw new ConfigurationException("Cannot start server at port " + port, e);
		}
		System.out.println(new LogEntry("starting socket server at port " + port));
		serverThread = new Thread(this);
		serverThread.start();
	}
374811
public int start() throws IOException {
		synchronized (this.monitor) {
			Assert.state(this.serverThread == null, "Server already started");
			ServerSocketChannel serverSocketChannel = ServerSocketChannel.open();
			serverSocketChannel.socket().bind(new InetSocketAddress(this.listenPort));
			int port = serverSocketChannel.socket().getLocalPort();
			logger.trace("Listening for TCP traffic to tunnel on port " + port);
			this.serverThread = new ServerThread(serverSocketChannel);
			this.serverThread.start();
			return port;
		}
	}
735895
public void launch(Monitored mp) {
    if (!lifecycle.tryToMoveTo(Lifecycle.State.STARTING)) {
      throw new IllegalStateException("Already started");
    }
    monitored = mp;

    Logger logger = LoggerFactory.getLogger(getClass());
    try {
      launch(logger);
    } catch (Exception e) {
      logger.warn("Fail to start {}", getKey(), e);
    } finally {
      stop();
    }
  }