CyclicBarrier And CountDownLatch in JAVA

According to java doc Cyclic Barrier is: A synchronization aid that allows a set of threads to all wait for each other to reach a common barrier point. CyclicBarriers are useful in programs involving a fixed sized party of threads that must occasionally wait for each other. Now why this barrier is called cyclic: The ...

Implementing Own Thread Pool in Java

Lets Implement own Thread Pool in Java. Lets first make a class which will be having two methods enqueue and dequeue. This class will act as a blocking queue on the dequeue method i.e. a blocking call so that we will only return when the queue has something on it, otherwise wait until something is ...

Implementing Producer-Consumer by making own implementation of blocking queue.

Lets implement Producer, Consumer by making own implementation of blocking queue. Lets make own interface which will be having two methods: 1. enqueue // for put 2. dequeue // for take Here is our interface: Now lets make one implementation of above interface. Above implementation behaves as blocking queue, i.e. according to javadoc: ” A ...

Making WebSocket with NodeJS and HTML5

Making WebSocket with NodeJS and HTML5
In this blog we will try to create websocket with the help of HTML5 and NodeJS. First something about NodeJS or simply Node:- Node provides a purely event-driven, non-blocking infrastructure for building highly concurrent software. It internally uses the Google’s V8 JavaScript engine, an event loop, and a low-level I/O API. Now First lets check ...

Reading Joystick with JInput on Linux

Reading Joystick with JInput on Linux
In this blog we try to read JoyStick input with the help of Jinput api. First we need to dwonload the jinput-linux.jar file. Also we need to download the lwjgl-2.9.1.zip i.e. light weight java gaming library. Jinout makes use of lwjgl for recognizing controllers. Now lets check the code from which we will recognize our ...