Skip to content
EGOTHOR · JAVA LIBRARY

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

Java 21Typed keysNamed contextsSynchronous listeners

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.

    Getting started →

  • Design the scope of shared state

    Choose keys, isolate contexts and manage listener lifetimes.

    Contexts and events →

  • Understand the contract

    Look up equality, notification, removal and concurrency behaviour.

    Behaviour reference →

  • Build and contribute

    Run checks and build the manual and generated API documentation.

    Development →

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.