3 Commits

Author SHA1 Message Date
90efd93b72 feat: removeContext implemented
All checks were successful
Release / release (push) Successful in 57s
Signed-off-by: Leo Galambos <lg@hq.egothor.org>
2025-08-12 23:06:19 +02:00
b002d47d82 Javadoc fixes
All checks were successful
Release / release (push) Successful in 44s
chore: finalizing javadoc footer and other params

Signed-off-by: Leo Galambos <lg@hq.egothor.org>
2025-08-04 19:04:54 +02:00
2cf6d206e8 fix: Readme improved, javadoc added 2025-08-02 01:31:24 +02:00
5 changed files with 95 additions and 20 deletions

View File

@@ -13,19 +13,6 @@
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="bin/main" path="src/main/resources">
<attributes>
<attribute name="gradle_scope" value="main"/>
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="bin/test" path="src/test/resources">
<attributes>
<attribute name="gradle_scope" value="test"/>
<attribute name="gradle_used_by_scope" value="test"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin/default"/>

View File

@@ -42,7 +42,7 @@ jobs:
apt install -y rsync
- name: Build and publish to Gitea Maven and JavaDoc to the website
run: ./gradlew clean publish uploadJavadoc --no-daemon -PgiteaToken=${{ secrets.CI_PUBLISH_TOKEN }} -PjavadocUser=${{ vars.JAVADOC_USER }} -PjavadocHost=${{ vars.JAVADOC_HOST }} -PjavadocPath=${{ vars.JAVADOC_PATH }} -PjavadocKeyPath=~/.ssh/id_rsa --debug
run: ./gradlew clean publish uploadJavadoc --no-daemon -PgiteaToken=${{ secrets.CI_PUBLISH_TOKEN }} -PjavadocUser=${{ vars.JAVADOC_USER }} -PjavadocHost=${{ vars.JAVADOC_HOST }} -PjavadocPath=${{ vars.JAVADOC_PATH }} -PjavadocKeyPath=~/.ssh/id_rsa
- name: Generate release notes
id: notes

View File

@@ -12,3 +12,28 @@ values and react to their changes in a clean and decoupled way.
- Publish/subscribe event bus for listening to value changes
- Simple API for easy integration into existing projects
- Enables modular design by decoupling components through events
## Getting Started
Add to your `build.gradle`:
```groovy
repositories {
maven {
name = "GiteaMaven"
url = uri("https://gitea.egothor.org/api/packages/Egothor/maven")
}
// Use Maven Central for resolving dependencies.
mavenCentral()
}
dependencies {
implementation 'org.egothor:conflux:x.x.x'
}
```
## Documentation
- [Conflux JavaDoc](https://www.egothor.org/javadoc/conflux/)
- [Conflux Wiki](https://gitea.egothor.org/Egothor/conflux/wiki)

View File

@@ -6,6 +6,10 @@ plugins {
id 'pmd'
}
import java.time.LocalDate
def currentYear=LocalDate.now().getYear()
group 'org.egothor'
version gitVersion(prefix:'release@')
@@ -40,17 +44,36 @@ java {
javadoc {
failOnError = false
}
options.addBooleanOption('html5', true)
options.tags('apiNote:a:API Note:')
options.tags('implSpec:a:Implementation Requirements:')
options.tags('implNote:a:Implementation Note:')
options.tags('param')
options.tags('return')
options.tags('throws')
options.tags('since')
options.tags('version')
options.tags('serialData')
options.tags('factory')
options.tags('see')
options.use = true
options.author = true
options.version = true
options.windowTitle = 'Conflux'
options.bottom = '<div style="text-align: right; padding: 5px;">Copyright &copy; ' + currentYear +
' Egothor - Version ' + version +
' - <a href="https://gitea.egothor.org/Egothor/conflux/raw/branch/main/LICENSE">License</a>' +
'</div>'
source = sourceSets.main.allJava}
tasks.named('test') {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}
tasks.withType(Javadoc).configureEach {
options.bottom = "Copyright &copy; 2025 Egothor"
}
task uploadJavadoc(type: Exec) {
dependsOn javadoc

View File

@@ -85,6 +85,46 @@ public enum Ctx implements CtxInterface {
return contexts.computeIfAbsent(name, k -> new CtxInstance());
}
/**
* Removes a named context previously created via {@link #getContext(String)}.
* <p>
* The context is atomically removed from the internal registry and then
* {@linkplain CtxInterface#clear() cleared} to release stored values and
* listener references. This operation is thread-safe and idempotent: if the
* specified context does not exist, the method returns {@code false} and
* performs no action.
* </p>
* <p>
* Calling {@code getContext(name)} again after a successful removal will create
* a brand-new, empty context. The default/global context represented by
* {@link #INSTANCE} is not affected.
* </p>
*
* @param name the name of the context to remove; must not be {@code null} or
* blank
* @return {@code true} if a context with the given name existed and was
* removed; {@code false} otherwise
* @throws IllegalArgumentException if {@code name} is {@code null} or blank
* @implNote Uses {@link ConcurrentHashMap#remove(Object)} for atomic removal,
* then invokes {@link CtxInterface#clear()} on the removed instance.
* @since 2025.08
*/
public boolean removeContext(String name) {
if (name == null || name.isBlank()) {
throw new IllegalArgumentException("name must not be null or blank");
}
CtxInterface ctx = contexts.remove(name);
final boolean existed = ctx != null;
if (existed) {
try {
ctx.clear();
} catch (RuntimeException ignore) { // NOPMD
// Best-effort cleanup; deregistration already succeeded.
}
}
return existed;
}
/**
* Returns the set of names for all currently registered contexts.
*