• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

apache / iotdb / #9940

28 Aug 2023 02:34PM CUT coverage: 47.667% (-0.02%) from 47.686%
#9940

Pull #10978

travis_ci

web-flow
Merge 64f220724 into ebd2a6f63
Pull Request #10978: [To rel/1.2] Pipe: Increase the injection frequency of HeartBeatEvent to reduce the delay in log transferring (#10970)

30 of 30 new or added lines in 7 files covered. (100.0%)

79985 of 167800 relevant lines covered (47.67%)

0.48 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

29.41
/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/runtime/PipeCronEventInjector.java
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one
3
 * or more contributor license agreements.  See the NOTICE file
4
 * distributed with this work for additional information
5
 * regarding copyright ownership.  The ASF licenses this file
6
 * to you under the Apache License, Version 2.0 (the
7
 * "License"); you may not use this file except in compliance
8
 * with the License.  You may obtain a copy of the License at
9
 *
10
 *     http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing,
13
 * software distributed under the License is distributed on an
14
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
 * KIND, either express or implied.  See the License for the
16
 * specific language governing permissions and limitations
17
 * under the License.
18
 */
19

20
package org.apache.iotdb.db.pipe.agent.runtime;
21

22
import org.apache.iotdb.commons.concurrent.IoTDBThreadPoolFactory;
23
import org.apache.iotdb.commons.concurrent.ThreadName;
24
import org.apache.iotdb.commons.concurrent.threadpool.ScheduledExecutorUtil;
25
import org.apache.iotdb.db.pipe.extractor.realtime.listener.PipeInsertionDataNodeListener;
26

27
import org.slf4j.Logger;
28
import org.slf4j.LoggerFactory;
29

30
import java.util.concurrent.Future;
31
import java.util.concurrent.ScheduledExecutorService;
32
import java.util.concurrent.TimeUnit;
33

34
public class PipeCronEventInjector {
1✔
35

36
  private static final Logger LOGGER = LoggerFactory.getLogger(PipeCronEventInjector.class);
1✔
37

38
  private static final int CRON_EVENT_INJECTOR_INTERVAL_SECONDS = 1;
39

40
  private static final ScheduledExecutorService CRON_EVENT_INJECTOR_EXECUTOR =
1✔
41
      IoTDBThreadPoolFactory.newSingleThreadScheduledExecutor(
1✔
42
          ThreadName.PIPE_RUNTIME_CRON_EVENT_INJECTOR.getName());
1✔
43

44
  private Future<?> injectorFuture;
45

46
  public synchronized void start() {
47
    if (injectorFuture == null) {
×
48
      injectorFuture =
×
49
          ScheduledExecutorUtil.safelyScheduleWithFixedDelay(
×
50
              CRON_EVENT_INJECTOR_EXECUTOR,
51
              this::inject,
52
              CRON_EVENT_INJECTOR_INTERVAL_SECONDS,
53
              CRON_EVENT_INJECTOR_INTERVAL_SECONDS,
54
              TimeUnit.SECONDS);
55
      LOGGER.info("Pipe cron event injector is started successfully.");
×
56
    }
57
  }
×
58

59
  private synchronized void inject() {
60
    PipeInsertionDataNodeListener.getInstance().listenToHeartbeat(false);
×
61
  }
×
62

63
  public synchronized void stop() {
64
    if (injectorFuture != null) {
×
65
      injectorFuture.cancel(false);
×
66
      injectorFuture = null;
×
67
      LOGGER.info("Pipe cron event injector is stopped successfully.");
×
68
    }
69
  }
×
70
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc