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

eXist-db / exist / 40387836984

26 Oct 2026 07:33PM UTC coverage: 58.173% (+0.005%) from 58.168%
40387836984

push

github

web-flow
Merge pull request #6731 from line-o/bugfix/binary-value-frame-ownership

[bugfix] Release a binary value with the scope that created it

32491 of 61752 branches covered (52.62%)

Branch coverage included in aggregate %.

92 of 129 new or added lines in 8 files covered. (71.32%)

27 existing lines in 6 files now uncovered.

85598 of 141244 relevant lines covered (60.6%)

2.73 hits per line

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

33.33
/exist-core/src/main/java/org/exist/xquery/value/BinaryValueManager.java
1
/*
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.xquery.value;
23

24
import javax.annotation.Nullable;
25
import java.util.function.Predicate;
26

27
/**
28
 * @author <a href="mailto:adam@existsolutions.com">Adam Retter</a>
29
 */
30
public interface BinaryValueManager {
31

32
    void registerBinaryValueInstance(final BinaryValue binaryValue);
33

34
    /**
35
     * Deregister a value which has already been released.
36
     *
37
     * <p>A manager which does not track scopes need not implement this.</p>
38
     *
39
     * @param binaryValue the value to deregister
40
     */
41
    default void destroyBinaryValue(final BinaryValue binaryValue) {
42
        // nothing to deregister: this manager does not track scopes
NEW
43
    }
×
44

45
    /**
46
     * Open a frame which owns every {@link BinaryValue} registered while it is the innermost one.
47
     *
48
     * <p>Ownership is what decides who may release a value: the scope that created it, never a
49
     * scope which merely received it - so a called function cannot close its caller's value.</p>
50
     *
51
     * <p>A manager which does not track scopes need not implement this; its values are then
52
     * released only by its own cleanup.</p>
53
     */
54
    default void pushBinaryValueFrame() {
55
        // no frames: this manager does not track scopes
NEW
56
    }
×
57

58
    /**
59
     * Close the innermost frame and release the values it owns.
60
     *
61
     * @param escaping values reachable from this sequence leave the frame rather than being
62
     *     released, and are owned by the enclosing frame from now on; null releases them all
63
     */
64
    default void popBinaryValueFrame(@Nullable final Sequence escaping) {
65
        // no frames: values are released by runCleanupTasks()
NEW
66
    }
×
67

68
    /**
69
     * Close the innermost frame, handing everything it owns to the enclosing frame.
70
     *
71
     * <p>For scopes whose escape set is unknown: deferring release to the end of the query is
72
     * recoverable, closing a value the query still needs is not.</p>
73
     */
74
    default void promoteBinaryValueFrame() {
75
        // no frames: values are released by runCleanupTasks()
NEW
76
    }
×
77

78
    void runCleanupTasks(final Predicate<Object> predicate);
79

80
    default void runCleanupTasks() {
81
        runCleanupTasks(o -> true);
5 ✔
82
    }
1 ✔
83

84
    String getCacheClass();
85
}
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