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

wz2cool / local-queue / #5

27 Jan 2025 01:17PM UTC coverage: 92.442%. First build
#5

push

web-flow
Merge pull request #3 from wz2cool/0.0.5

0.0.5

71 of 82 new or added lines in 5 files covered. (86.59%)

318 of 344 relevant lines covered (92.44%)

0.92 hits per line

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

96.55
/src/main/java/com/github/wz2cool/localqueue/model/config/SimpleProducerConfig.java
1
package com.github.wz2cool.localqueue.model.config;
2

3
import java.io.File;
4
import java.util.Objects;
5

6
/**
7
 * the config of producer
8
 *
9
 * @author frank
10
 */
11
public class SimpleProducerConfig {
12

13
    private final File dataDir;
14
    // -1 表示不删除
15
    private final int keepDays;
16

17
    private final int flushBatchSize;
18

19
    private final long flushInterval;
20

21
    private SimpleProducerConfig(Builder builder) {
1✔
22
        this.dataDir = builder.dataDir;
1✔
23
        this.keepDays = builder.keepDays;
1✔
24
        this.flushBatchSize = builder.flushBatchSize;
1✔
25
        this.flushInterval = builder.flushInterval;
1✔
26
    }
1✔
27

28
    public File getDataDir() {
29
        return dataDir;
1✔
30
    }
31

32
    public int getKeepDays() {
33
        return keepDays;
1✔
34
    }
35

36
    public int getFlushBatchSize() {
37
        return flushBatchSize;
1✔
38
    }
39

40
    public long getFlushInterval() {
41
        return flushInterval;
1✔
42
    }
43

44
    public static class Builder {
1✔
45
        private File dataDir;
46
        private int keepDays = -1;
1✔
47
        private int flushBatchSize = 1000;
1✔
48
        private long flushInterval = 100;
1✔
49

50
        public Builder setDataDir(File dataDir) {
51
            this.dataDir = dataDir;
1✔
52
            return this;
1✔
53
        }
54

55
        public Builder setKeepDays(int keepDays) {
56
            this.keepDays = keepDays;
1✔
57
            return this;
1✔
58
        }
59

60
        public Builder setFlushBatchSize(int flushBatchSize) {
61
            this.flushBatchSize = flushBatchSize;
1✔
62
            return this;
1✔
63
        }
64

65
        public Builder setFlushInterval(long flushInterval) {
66
            this.flushInterval = flushInterval;
1✔
67
            return this;
1✔
68
        }
69

70
        public SimpleProducerConfig build() {
71
            if (Objects.isNull(dataDir)) {
1✔
72
                throw new IllegalArgumentException("dataDir cannot be null");
1✔
73
            }
74
            if (flushBatchSize <= 0) {
1✔
75
                throw new IllegalArgumentException("flushBatchSize should > 0");
1✔
76
            }
77
            if (flushInterval <= 0) {
1✔
NEW
78
                throw new IllegalArgumentException("flushInterval should > 0");
×
79
            }
80

81
            return new SimpleProducerConfig(this);
1✔
82
        }
83
    }
84
}
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

© 2026 Coveralls, Inc