protected PrimitiveProtocol protocol ( ) { PrimitiveProtocol protocol = this . protocol ; if ( protocol == null ) { PrimitiveProtocolConfig < ? > protocolConfig = config . getProtocolConfig ( ) ; if ( protocolConfig == null ) { Collection < PartitionGroup > partitionGroups = managementService . getPartitionService ( ) . getPartitionGroups ( ) ; if ( partitionGroups . size ( ) == 1 ) { protocol = partitionGroups . iterator ( ) . next ( ) . newProtocol ( ) ; } else { String groups = Joiner . on ( ", " ) . join ( partitionGroups . stream ( ) . map ( group -> group . name ( ) ) . collect ( Collectors . toList ( ) ) ) ; throw new ConfigurationException ( String . format ( "Primitive protocol is ambiguous: %d partition groups found (%s)" , partitionGroups . size ( ) , groups ) ) ; } } else { protocol = protocolConfig . getType ( ) . newProtocol ( protocolConfig ) ; } } return protocol ; }
Returns the primitive protocol .