Git Product home page Git Product logo

executor-service's Introduction

executor-service

An ExecutorService supporting multiple writing and a single reading thread. The service uses a specialized queue in which the writing threads needs only a read from a thread local field and a write to a volatile field to publish an event to the queue. Writing does not need "compare and swap" operations like the standard JDK concurrent queues, leading to an easier and potentially faster algorithm. A usage example is a background thread writing log events asynchronously to a file.

Maven

<dependency>
  <groupId>com.vmlens</groupId>
  <artifactId>executor-service</artifactId>
  <version>1.0.1</version>
</dependency>

Usage

Creating and starting the event bus:

 eventBus = VMLensExecutors.createEventBus();
		 consumer = eventBus.newConsumer(); 
		 eventBus.start( new EventSink()
				 {
					@Override
					public void execute(Object event) {
						// TODO Auto-generated method stub
						
					}
					@Override
					public void close() {
						// TODO Auto-generated method stub
						
					}
					@Override
					public void onWait() {
						// TODO Auto-generated method stub
						
					}
			 
				 }, new ThreadFactory()
				 {
					@Override
					public Thread newThread(Runnable r) {
						// TODO Auto-generated method stub
						return new Thread();
					}
					 
				 });

Writing to the event bus:

	consumer.accept(  "event" );

License

executor-service is released under the Apache License 2.0

Blog Entries about executor-service

executor-service's People

Contributors

thomaskrieger avatar

Watchers

Carlos Valderrama Vega 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.