GithubHelp home page GithubHelp logo

prakashseela / disruptor-proxy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lmax-exchange/disruptor-proxy

0.0 2.0 0.0 1.35 MB

Byte-code generator to create Disruptor-backed proxies

License: Apache License 2.0

Java 100.00%

disruptor-proxy's Introduction

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.

disruptor-proxy's People

Contributors

epickrram avatar mikeb01 avatar motocodeltd avatar juddgaddie avatar hsrinara avatar nickelaway avatar grumpyjames avatar

Watchers

James Cloos avatar Prakash Seela avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.