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

eXist-db / exist / 40117496345

24 Oct 2026 05:44PM UTC coverage: 58.138% (-0.03%) from 58.172%
40117496345

push

github

web-flow
Merge pull request #6905 from duncdrum/dp-ci-jacoco-merged-artifact

[ci] Publish the JaCoCo reports as a develop artifact

32463 of 61732 branches covered (52.59%)

Branch coverage included in aggregate %.

85515 of 141197 relevant lines covered (60.56%)

2.73 hits per line

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

46.43
/exist-core/src/main/java/org/exist/management/impl/BinaryValues.java
1
/*
6 ✔
2
 * eXist-db Open Source Native XML Database
3
 * Copyright (C) 2001 The eXist-db Authors
4
 *
5
 * info@exist-db.org
6
 * http://www.exist-db.org
7
 *
8
 * This library is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU Lesser General Public
10
 * License as published by the Free Software Foundation; either
11
 * version 2.1 of the License, or (at your option) any later version.
12
 *
13
 * This library is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
 * Lesser General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU Lesser General Public
19
 * License along with this library; if not, write to the Free Software
20
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
 */
22
package org.exist.management.impl;
23

24
import org.exist.management.impl.BinaryInputStreamCacheInfo.CacheType;
25
import org.exist.storage.BrokerPool;
26
import org.exist.util.io.FileFilterInputStreamCache;
27
import org.exist.util.io.FilterInputStreamCache;
28
import org.exist.util.io.FilterInputStreamCacheMonitor;
29
import org.exist.util.io.FilterInputStreamCacheMonitor.FilterInputStreamCacheInfo;
30
import org.exist.util.io.MemoryMappedFileFilterInputStreamCache;
31

32
import javax.management.MalformedObjectNameException;
33
import javax.management.ObjectName;
34
import java.util.ArrayList;
35
import java.util.Collection;
36
import java.util.List;
37
import java.util.Optional;
38

39
/**
40
 * JMX MBean exposing information about active binary value input-stream caches
41
 * for a specific database instance.
42
 */
43
public record BinaryValues(String instanceId) implements BinaryValuesMXBean {
44
    /**
45
     * Create a new BinaryValues MBean for the given broker pool.
46
     *
47
     * @param instanceId the broker pool representing the database instance
48
     */
49
    public BinaryValues(final BrokerPool instanceId) {
50
        this(instanceId.getId());
4 ✔
51
    }
1 ✔
52

53
    /**
54
     * Explicit JavaBean-style accessor required by the MBean attribute discovery,
55
     * which relies on the {@code getXxx()} naming convention. The record's
56
     * auto-generated {@link #instanceId()} accessor does not satisfy that convention,
57
     * so we delegate to it here. See <a href="https://github.com/eXist-db/exist/issues/6379">#6379</a>.
58
     */
59
    @Override
60
    public String getInstanceId() {
61
        return instanceId;
3 ✔
62
    }
63

64
    /**
65
     * Return a JMX object-name query that matches all BinaryValues MBeans across all instances.
66
     *
67
     * @return the wildcard query string
68
     */
69
    public static String getAllInstancesQuery() {
70
        return getName("*");
3 ✔
71
    }
72

73
    private static String getName(final String instanceId) {
74
        return "org.exist.management." + instanceId + ":type=BinaryValues";
3 ✔
75
    }
76

77
    @Override
78
    public ObjectName getName() throws MalformedObjectNameException {
79
        return new ObjectName(getName(instanceId));
7 ✔
80
    }
81

82
    @Override
83
    public List<BinaryInputStreamCacheInfo> getCacheInstances() {
84
        final FilterInputStreamCacheMonitor monitor = FilterInputStreamCacheMonitor.getInstance();
2 ✔
85
        final Collection<FilterInputStreamCacheInfo> cacheInstances = monitor.getActive();
3 ✔
86

87
        final List<BinaryInputStreamCacheInfo> results = new ArrayList<>();
4 ✔
88
        for (final FilterInputStreamCacheInfo cacheInstance : cacheInstances) {
7 !
89

90
            final BinaryInputStreamCacheInfo result;
91
            final FilterInputStreamCache cache = cacheInstance.getCache();
×
92
            switch (cache) {
×
93
                case final FileFilterInputStreamCache streamCache1 ->
×
94
                        result = new BinaryInputStreamCacheInfo(CacheType.FILE, cacheInstance.getRegistered(),
×
95
                                Optional.of(streamCache1.getFilePath()), cache.getLength());
×
96
                case final MemoryMappedFileFilterInputStreamCache streamCache ->
×
97
                        result = new BinaryInputStreamCacheInfo(CacheType.MEMORY_MAPPED_FILE, cacheInstance.getRegistered(),
×
98
                                Optional.of(streamCache.getFilePath()), cache.getLength());
×
99
                case null, default ->
100
                        result = new BinaryInputStreamCacheInfo(CacheType.MEMORY, cacheInstance.getRegistered(),
×
101
                                Optional.empty(), cache.getLength()); // DW: This might be a null cache
×
102
            }
103

104
            results.add(result);
×
105
        }
106

107
        return results;
2 ✔
108
    }
109
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc