kafka DelayedHeartbeat 源码

  • 2022-10-20
  • 浏览 (223)

kafka DelayedHeartbeat 代码

文件路径:/core/src/main/scala/kafka/coordinator/group/DelayedHeartbeat.scala

/**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package kafka.coordinator.group

import kafka.server.DelayedOperation

/**
 * Delayed heartbeat operations that are added to the purgatory for session timeout checking.
 * Heartbeats are paused during rebalance.
 */
private[group] class DelayedHeartbeat(coordinator: GroupCoordinator,
                                      group: GroupMetadata,
                                      memberId: String,
                                      isPending: Boolean,
                                      timeoutMs: Long)
  extends DelayedOperation(timeoutMs, Some(group.lock)) {

  override def tryComplete(): Boolean = coordinator.tryCompleteHeartbeat(group, memberId, isPending, forceComplete _)
  override def onExpiration(): Unit = coordinator.onExpireHeartbeat(group, memberId, isPending)
  override def onComplete(): Unit = {}
}

相关信息

kafka 源码目录

相关文章

kafka DelayedJoin 源码

kafka DelayedRebalance 源码

kafka DelayedSync 源码

kafka GroupCoordinator 源码

kafka GroupMetadata 源码

kafka GroupMetadataManager 源码

kafka MemberMetadata 源码

kafka OffsetConfig 源码

0  赞