Shared state. Connected components.
Conflux combines a named, typed context with value-change notifications. Share data between Java components and let each component react through a small, explicit API.
Get started Explore the JavaDoc
A small API for shared work
Use a context as the meeting point between producers and consumers. Producers store values with put; consumers read them with get or register a Listener for changes. Named contexts separate application scopes, while Ctx.INSTANCE supplies a default context.
import conflux.Ctx;
import conflux.CtxInterface;
import conflux.Key;
import conflux.Listener;
CtxInterface context = Ctx.INSTANCE.getContext("search-session");
Key<String> query = Key.of("query", String.class);
Listener<String> onQuery = value -> System.out.println("Query: " + value);
context.addListener(query, onQuery);
context.put(query, "information retrieval");
context.removeListener(query, onQuery);
Keep a strong reference to the context and its listeners for as long as they are needed: the named-context registry and listener registrations use weak references.
-
Start with a working example
Add the dependency, create a context and observe your first change.
-
Design the scope of shared state
Choose keys, isolate contexts and manage listener lifetimes.
-
Understand the contract
Look up equality, notification, removal and concurrency behaviour.
-
Build and contribute
Run checks and build the manual and generated API documentation.
Go deeper
The JavaDoc describes individual classes and methods. The source repository contains the implementation, tests and release configuration.
Documentation owner: Conflux maintainers · Reviewed: 18 October 2026 · Next review: 18 January 2027.