mil.dod.th.ose.remote/src/mil/dod/th/ose/remote/ServerSocketMessageListener.java
@Activate
    public void activate(final BundleContext context) throws IOException
    {
        // set port, use default if not set
        int serverPort = DEFAULT_PORT;
        
        // set SSL flag, use default if not set
        boolean enableSsl = false;
        
        if (context.getProperty(PORT_PROP_KEY) != null)
        {
            serverPort = Integer.parseInt(context.getProperty(PORT_PROP_KEY));
        }
            
        if (context.getProperty(SSL_PROP_KEY) != null)
        {
            enableSsl = Boolean.parseBoolean(context.getProperty(SSL_PROP_KEY));
        }

        m_ServerSocket = m_ServerSocketFactory.createServerSocket(serverPort, enableSsl);

        m_Logging.info("Server socket listening on port %d for remote messages", m_ServerSocket.getLocalPort());
        
        m_ServerSocketThread = new Thread(new Runnable()
        {
            @Override
            public void run()
            {
                //run until the socket is closed
                while (true)
                {
                    try
                    {
                        final Socket socket = m_ServerSocket.accept(); // NOFORTIFY: unreleased resource:
                                                    //resources are managed by the remote channel lookup
                        m_Logging.info("Connection made from %s for remote interface", 
                                socket.getRemoteSocketAddress());
                        
                        m_RemoteChannelLookup.newServerSocketChannel(socket);
                    }
                    catch (final IOException e)
                    {
                        if (m_ServerSocket.isClosed())
                        {
                            m_Logging.info("Server socket has been closed, will stop accepting connections");
                            return;
                        }
                    }
                }
            }
        });
        
        m_ServerSocketThread.setName("RemoteInterfaceServerSocket");
        m_ServerSocketThread.start();
    }
/**
     * Activate this component by starting to listen on a configured port.
     * 
     * @param context
     *      bundle context used to get port property
     * 
     * @throws IOException
     *      if the component is unable to create a server socket to listen on
     */
Activate this component by starting to listen on a configured port.

@param context
bundle context used to get port property

@throws IOException
if the component is unable to create a server socket to listen on
Activate this component by starting to listen on a configured port . @param context bundle context used to get port property @throws IOException if the component is unable to create a server socket to listen on
@Activate
    public void activate(final BundleContext context) throws IOException
    {
        int serverPort = DEFAULT_PORT;
        boolean enableSsl = false;
        if (context.getProperty(PORT_PROP_KEY) != null)
        {
            serverPort = Integer.parseInt(context.getProperty(PORT_PROP_KEY));
        }
        if (context.getProperty(SSL_PROP_KEY) != null)
        {
            enableSsl = Boolean.parseBoolean(context.getProperty(SSL_PROP_KEY));
        }
        m_ServerSocket = m_ServerSocketFactory.createServerSocket(serverPort, enableSsl);
        m_Logging.info("Server socket listening on port %d for remote messages", m_ServerSocket.getLocalPort());
        m_ServerSocketThread = new Thread(new Runnable()
        {
            @Override
            public void run()
            {
                while (true)
                {
                    try
                    {
                        final Socket socket = m_ServerSocket.accept(); 
                        m_Logging.info("Connection made from %s for remote interface", 
                                socket.getRemoteSocketAddress());
                        m_RemoteChannelLookup.newServerSocketChannel(socket);
                    }
                    catch (final IOException e)
                    {
                        if (m_ServerSocket.isClosed())
                        {
                            m_Logging.info("Server socket has been closed, will stop accepting connections");
                            return;
                        }
                    }
                }
            }
        });
        m_ServerSocketThread.setName("RemoteInterfaceServerSocket");
        m_ServerSocketThread.start();
    }
@ Activate public void activate ( final BundleContext context ) throws IOException { int serverPort = DEFAULT_PORT ; boolean enableSsl = false ; if ( context . getProperty ( PORT_PROP_KEY ) != null ) { serverPort = Integer . parseInt ( context . getProperty ( PORT_PROP_KEY ) ) ; } if ( context . getProperty ( SSL_PROP_KEY ) != null ) { enableSsl = Boolean . parseBoolean ( context . getProperty ( SSL_PROP_KEY ) ) ; } m_ServerSocket = m_ServerSocketFactory . createServerSocket ( serverPort , enableSsl ) ; m_Logging . info ( "Server socket listening on port %d for remote messages" , m_ServerSocket . getLocalPort ( ) ) ; m_ServerSocketThread = new Thread ( new Runnable ( ) { @ Override public void run ( ) { while ( true ) { try { final Socket socket = m_ServerSocket . accept ( ) ; m_Logging . info ( "Connection made from %s for remote interface" , socket . getRemoteSocketAddress ( ) ) ; m_RemoteChannelLookup . newServerSocketChannel ( socket ) ; } catch ( final IOException e ) { if ( m_ServerSocket . isClosed ( ) ) { m_Logging . info ( "Server socket has been closed, will stop accepting connections" ) ; return ; } } } } } ) ; m_ServerSocketThread . setName ( "RemoteInterfaceServerSocket" ) ; m_ServerSocketThread . start ( ) ; }
Activate this component by starting to listen on a configured port.
Activate this component by starting to listen on a configured port .
// set port, use default if not set // set SSL flag, use default if not set //run until the socket is closed // NOFORTIFY: unreleased resource: //resources are managed by the remote channel lookup