Selector — Selectable on Socket Channels (from Java’s New IO API)

Selector is the one and only Selectable that uses Java’s selectable channels for stream-oriented connecting sockets (i.e. Java’s java.nio.channels.SocketChannel).

Selector is used by Kafka services to create a NetworkClient.

Figure 1. Selector is Created for Kafka Services For NetworkClient

Selector is created when:

  • KafkaAdminClient is created (using createInternal)

  • KafkaConsumer is created

  • KafkaProducer is created

  • AdminClient is created

  • ControllerChannelManager is requested to addNewBroker

  • TransactionMarkerChannelManager is created

  • Processor is created

  • KafkaServer does doControlledShutdown

  • ReplicaFetcherBlockingSend is created

connect Method

void connect(
  String id,
  InetSocketAddress address,
  int sendBufferSize,
  int receiveBufferSize) throws IOException
connect is a part of Selectable Contract that NetworkClient uses when requested to establish a connection to a broker.


addToCompletedReceives Internal Method

void addToCompletedReceives()
void addToCompletedReceives(
  KafkaChannel channel,
  Deque<NetworkReceive> stagedDeque)


addToCompletedReceives is used exclusively when Selector is requested to poll.

poll Method

void poll(long timeout)
poll is part of the Selectable Contract to…​FIXME.


results matching ""

    No results matching ""