summaryrefslogtreecommitdiffstats
path: root/jdisc_core/src/main/java/com/yahoo/jdisc/refcount/References.java
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-10-04 17:20:40 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2021-10-05 14:49:20 +0200
commitc9982ddc5ce3083101541a301cca20b19b4914e8 (patch)
treef63fa1165e4b8572a7dd7c24ed056e851b97660d /jdisc_core/src/main/java/com/yahoo/jdisc/refcount/References.java
parent5f5cb7aa87195c92b374dcbc742a5263559c8bb0 (diff)
Add option to attach a context to refer.
Introduce a lightweight debug mode.
Diffstat (limited to 'jdisc_core/src/main/java/com/yahoo/jdisc/refcount/References.java')
-rw-r--r--jdisc_core/src/main/java/com/yahoo/jdisc/refcount/References.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/refcount/References.java b/jdisc_core/src/main/java/com/yahoo/jdisc/refcount/References.java
new file mode 100644
index 00000000000..35b4e7c759e
--- /dev/null
+++ b/jdisc_core/src/main/java/com/yahoo/jdisc/refcount/References.java
@@ -0,0 +1,22 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.jdisc.refcount;
+
+import com.yahoo.jdisc.ResourceReference;
+
+/**
+ * Interface for implementations of reference counting
+ * @author baldersheim
+ */
+public interface References {
+ /** Release the initial reference */
+ void release();
+ /** Returns number of held references */
+ int referenceCount();
+ /**
+ * Adds a reference and return an objects that when closed will return the reference.
+ * Supply a context that can provide link to the one holding the link. Useful for debugging
+ */
+ ResourceReference refer(Object context);
+
+ String currentState();
+}