protected static FORK getFORK ( JChannel ch , ProtocolStack . Position position , Class < ? extends Protocol > neighbor , boolean create_fork_if_absent ) throws Exception { ProtocolStack stack = ch . getProtocolStack ( ) ; FORK fork = stack . findProtocol ( FORK . class ) ; if ( fork == null ) { if ( ! create_fork_if_absent ) throw new IllegalArgumentException ( "FORK not found in main stack" ) ; fork = new FORK ( ) ; fork . setProtocolStack ( stack ) ; stack . insertProtocol ( fork , position , neighbor ) ; } return fork ; }
Creates a new FORK protocol or returns the existing one or throws an exception . Never returns null .