MCPcopy Index your code
hub / github.com/LMAX-Exchange/disruptor-proxy

github.com/LMAX-Exchange/disruptor-proxy @3.1.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release 3.1.1 ↗ · + Follow
230 symbols 562 edges 45 files 29 documented · 13% updated 17mo ago3.1.1 · 2025-01-16★ 107
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

disruptor-proxy

Java CI with Gradle License

The disruptor-proxy is a tool for creating thread-safe proxies to your existing business code.

Utilising the power of the Disruptor, disruptor-proxy will provide a high-performance, low-latency multi-threaded interface to your single-threaded components.

This in turn allows users to exploit the single-writer principle for maximum straight-line performance.

implementation diagram

Maintainer

LMAX Development Team

Examples


// Basic usage

final RingBufferProxyGeneratorFactory generatorFactory = new RingBufferProxyGeneratorFactory();

final T tImpl = new ConcreteT();

final RingBufferProxyGenerator generator = generatorFactory.newProxy(GeneratorType.BYTECODE_GENERATION);

final T proxy = generator.createRingBufferProxy(T.class, disruptor, OverflowStrategy.DROP, tImpl);

disruptor.start();

// Get notified of end-of-batch events

final RingBufferProxyGeneratorFactory generatorFactory = new RingBufferProxyGeneratorFactory();

final T tImpl = new ConcreteT();
final BatchListener batchListener = (BatchListener) tImpl; // implement BatchListener in your component

final RingBufferProxyGenerator generator = generatorFactory.newProxy(GeneratorType.BYTECODE_GENERATION);

final T proxy = generator.createRingBufferProxy(T.class, disruptor, OverflowStrategy.DROP, tImpl);

disruptor.start();

// Get notified of buffer-overflow events

final RingBufferProxyGeneratorFactory generatorFactory = new RingBufferProxyGeneratorFactory();

final T tImpl = new ConcreteT();
final DropListener dropListener = new MyDropListener(); // handle drop events

final RingBufferProxyGenerator generator =
        generatorFactory.newProxy(GeneratorType.BYTECODE_GENERATION,
        new ConfigurableValidator(true, true),
        dropListener);

final T proxy = generator.createRingBufferProxy(T.class, disruptor, OverflowStrategy.DROP, tImpl);

disruptor.start();

GeneratorType

  • GeneratorType.JDK_REFLECTION - uses java.lang.reflect.Proxy to generate a dynamic proxy that will add events to the RingBuffer. Use this for minimal dependencies.
  • GeneratorType.BYTECODE_GENERATION - uses Javassist to generate classes that will add events to the RingBuffer. Use this for maximum performance.

Dependencies

Minimal dependency is the Disruptor JAR.

If you are using byte-code generation for the proxy class (specified by GeneratorType), you'll also need the Javassist JAR.

Extension points exported contracts — how you extend this code

Resetable (Interface)
A generic interface for components that can be reset [5 implementers]
src/main/java/com/lmax/tool/disruptor/Resetable.java
OverflowTest (Interface)
(no doc) [5 implementers]
src/test/java/com/lmax/tool/disruptor/AbstractRingBufferProxyGeneratorTest.java
Invoker (Interface)
Interface for a component that can invoke arguments on a target object [4 implementers]
src/main/java/com/lmax/tool/disruptor/Invoker.java
Listener (Interface)
(no doc) [4 implementers]
src/test/java/com/lmax/tool/disruptor/Listener.java
RingBufferProxyGenerator (Interface)
Creates an implementation of the specified interface, backed by a Disruptor instance [4 implementers]
src/main/java/com/lmax/tool/disruptor/RingBufferProxyGenerator.java
AnotherInterface (Interface)
(no doc) [1 implementers]
src/test/java/com/lmax/tool/disruptor/AbstractRingBufferProxyGeneratorTest.java
BatchListener (Interface)
An interface to describe objects that will be called on the end of a Disruptor batch. Implement this interface in your [3 …
src/main/java/com/lmax/tool/disruptor/BatchListener.java
ProxyWhichExtendsAnotherInterface (Interface)
(no doc) [1 implementers]
src/test/java/com/lmax/tool/disruptor/AbstractRingBufferProxyGeneratorTest.java

Core symbols most depended-on inside this repo

get
called by 20
src/main/java/com/lmax/tool/disruptor/reflect/ObjectArrayHolder.java
newProxy
called by 14
src/main/java/com/lmax/tool/disruptor/RingBufferProxyGeneratorFactory.java
createRingBufferProxy
called by 14
src/main/java/com/lmax/tool/disruptor/RingBufferProxyGenerator.java
onString
called by 6
src/test/java/com/lmax/tool/disruptor/Listener.java
onVoid
called by 6
src/test/java/com/lmax/tool/disruptor/Listener.java
invoke
called by 5
src/test/java/com/lmax/tool/disruptor/AbstractRingBufferProxyGeneratorTest.java
createField
called by 5
src/main/java/com/lmax/tool/disruptor/bytecode/ByteCodeHelper.java
validateAll
called by 4
src/main/java/com/lmax/tool/disruptor/RingBufferProxyValidation.java

Shape

Method 169
Class 36
Interface 18
Enum 7

Languages

Java100%

Modules by API surface

src/test/java/com/lmax/tool/disruptor/AbstractRingBufferProxyGeneratorTest.java42 symbols
src/main/java/com/lmax/tool/disruptor/bytecode/GeneratedRingBufferProxyGenerator.java15 symbols
src/test/java/com/lmax/tool/disruptor/ListenerImpl.java12 symbols
src/main/java/com/lmax/tool/disruptor/bytecode/ArgumentHolderGenerator.java12 symbols
src/main/java/com/lmax/tool/disruptor/ValidationConfig.java9 symbols
src/test/java/com/lmax/tool/disruptor/BatchAwareListenerImpl.java8 symbols
src/main/java/com/lmax/tool/disruptor/ConfigurableValidator.java8 symbols
src/test/java/com/lmax/tool/disruptor/handlers/HandlersTest.java7 symbols
src/test/java/com/lmax/tool/disruptor/bytecode/ArgumentHolderHelperTest.java7 symbols
src/main/java/com/lmax/tool/disruptor/reflect/ReflectiveRingBufferProxyGenerator.java7 symbols
src/main/java/com/lmax/tool/disruptor/bytecode/ByteCodeHelper.java7 symbols
src/test/java/com/lmax/tool/disruptor/Listener.java6 symbols

For agents

$ claude mcp add disruptor-proxy \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page