Skip to content
Byte-code generator to create Disruptor-backed proxies
Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config/checkstyle update copyright header May 17, 2016
doc update image May 17, 2016
gradle/wrapper Upgrade gradle-wrapper to 4.8.1 Nov 1, 2019
manifest move to github Jan 12, 2013
src return the toString of invocation handler when calling toString on th… Mar 30, 2017
.gitignore add validation to ensure that proxied class is an interface Jul 13, 2015
.travis.yml Add Travis CI build config Feb 10, 2015
LICENCE.txt add license file Feb 5, 2015
README.md
build.gradle Update version number to 2.1.0 Jan 3, 2017
gradlew Upgrade gradle-wrapper to 4.8.1 Nov 1, 2019
settings.gradle update copyright header May 17, 2016

README.md

disruptor-proxy Build Status

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

Mark Price

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.

You can’t perform that action at this time.