Skip to content

Commit

Permalink
MINOR: Move RaftRequestHandler to tools package (apache#9377)
Browse files Browse the repository at this point in the history
To avoid confusion since it is only used by `TestRaftServer`, this PR moves `RaftRequestHandler` to the `tools` package and renames it to `TestRaftRequestHandler`.

Reviewers: Guozhang Wang <[email protected]>
  • Loading branch information
Jason Gustafson authored and javierfreire committed Oct 8, 2020
1 parent 3a4e544 commit b2d9f66
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
* limitations under the License.
*/

package kafka.server
package kafka.tools

import java.util.Collections

import kafka.network.RequestChannel
import kafka.raft.KafkaNetworkChannel
import kafka.server.ApiRequestHandler
import kafka.utils.Logging
import org.apache.kafka.common.TopicPartition
import org.apache.kafka.common.feature.Features
Expand All @@ -34,12 +35,16 @@ import org.apache.kafka.raft.{AckMode, RaftClient}

import scala.jdk.CollectionConverters._

class RaftRequestHandler(networkChannel: KafkaNetworkChannel,
requestChannel: RequestChannel,
time: Time,
client: RaftClient,
metadataPartition: TopicPartition)
extends ApiRequestHandler with Logging {
/**
* Simple request handler implementation for use by [[TestRaftServer]].
*/
class TestRaftRequestHandler(
networkChannel: KafkaNetworkChannel,
requestChannel: RequestChannel,
time: Time,
client: RaftClient,
metadataPartition: TopicPartition
) extends ApiRequestHandler with Logging {

override def handle(request: RequestChannel.Request): Unit = {
try {
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/kafka/tools/TestRaftServer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import kafka.log.{Log, LogConfig, LogManager}
import kafka.network.{ConnectionQuotas, Processor, RequestChannel, SocketServer}
import kafka.raft.{KafkaFuturePurgatory, KafkaMetadataLog, KafkaNetworkChannel}
import kafka.security.CredentialProvider
import kafka.server.{BrokerTopicStats, KafkaConfig, KafkaRequestHandlerPool, KafkaServer, LogDirFailureChannel, RaftRequestHandler}
import kafka.server.{BrokerTopicStats, KafkaConfig, KafkaRequestHandlerPool, KafkaServer, LogDirFailureChannel}
import kafka.utils.timer.SystemTimer
import kafka.utils.{CommandLineUtils, CoreUtils, Exit, KafkaScheduler, Logging, ShutdownableThread}
import org.apache.kafka.clients.{ApiVersions, ClientDnsLookup, ManualMetadataUpdater, NetworkClient}
Expand Down Expand Up @@ -100,7 +100,7 @@ class TestRaftServer(val config: KafkaConfig) extends Logging {

raftClient.initialize()

val requestHandler = new RaftRequestHandler(
val requestHandler = new TestRaftRequestHandler(
networkChannel,
socketServer.dataPlaneRequestChannel,
time,
Expand Down

0 comments on commit b2d9f66

Please sign in to comment.