public void removePort ( TCPPort endPoint ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "removePort: " + endPoint . getServerSocket ( ) ) ; } synchronized ( this ) { NBAcceptChannelSelector accept = endPointToAccept . get ( endPoint ) ; if ( accept != null ) { // PK44756 - prevent hang on System.exit by accept selector if ( 3100 <= accept . numExceptions ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Ignoring removePort call on fatal selector/system.exit path" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "removePort" ) ; } return ; } EndPointActionInfo work = new EndPointActionInfo ( REMOVE_ENDPOINT , endPoint , workSync ) ; synchronized ( workSync ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( this , tc , "Passing remove to selector; " + endPoint . getServerSocket ( ) ) ; } accept . addWork ( work ) ; try { workSync . wait ( ) ; } catch ( InterruptedException x ) { // nothing to do } } // end-sync if ( accept == sharedAccept && accept . getUsageCount ( ) <= 0 ) { sharedAccept = null ; } } else { IllegalArgumentException iae = new IllegalArgumentException ( "TCP Port to be removed is not registered." ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Throwing IllegalArgumentException" ) ; } FFDCFilter . processException ( iae , CLASS_NAME + ".removePort" , "387" , this ) ; throw iae ; } } // end-sync-this if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "removePort" ) ; } }
Removes an end point from the set of end points that we are accepting connections on . This has the effect of removing the server socket from the selector and closing it .