Java Login

About javalogin.com

Hello guys,
javalogin.com is for Java and J2EE developers, all examples are simple and easy to understand 

It is developed and maintained by Vaibhav Sharma. The views expressed on this website are his own and do not necessarily reflect the views of his former, current or future employers. I am professional Web development. I work for an IT company as Senior Consultant. Primary I write about spring, hibernate and web-services. I am trying to present here new technologies.


     << Previous
Next >>     


Concurrency In Java


Java.util.concurrent package is to enable developers write better concurrent Java applications. This concurrent package includes some additions to the Java Collections Framework. These are called as Java Concurrent Collections.

A number of classes are added to the collections framework by java.util.concurrent package. The additional collection classes are:

  • BlockingQueue- an interface that is at the base of all Queue based concurrent collections. While adding an element to a BlockingQueue, if there is no space it can wait till it becomes available and when retrieving, it will wait till an element is available if it is empty. FIFO queue, blocks or times out when adding to a full queue or retrieving from an empty queue.
  • ConcurrentHashMap - an implementation class of ConcurrentMap.
  • ConcurrentNavigableMap - a Java concurrent collection interface that extends ConcurrentMap and adds operations of NavigableMap.
  • ConcurrentSkipListMap - an implementation class of ConcurrentNavigableMap.
  • ConcurrentMap defines methods to replace or remove a key-value pair if the key already exists or add a value if the key is not associated with a value.
  • ConcurrentHashMap is a concrete implementation of the ConcurrentMap interface and is analogous to a concurrent version of the HashMap class
  • Executor is a simple standardized interface for defining custom thread-like subsystems, including thread pools, asynchronous I/O, and lightweight task frameworks. Depending on which concrete Executor class is being used, tasks may execute in a newly created thread, an existing task-execution thread, or the thread calling execute, and may execute sequentially or concurrently.
  • Synchronizers Five classes aid common special-purpose synchronization idioms.
    • Semaphore is a classic concurrency tool.
    • CountDownLatch is a very simple yet very common utility for blocking until a given number of signals, events, or conditions hold.
    • A CyclicBarrier is a resettable multiway synchronization point useful in some styles of parallel programming.
    • A Phaser provides a more flexible form of barrier that may be used to control phased computation among multiple threads.
    • An Exchanger allows two threads to exchange objects at a rendezvous point, and is useful in several pipeline designs.
  • Atomic java.util.concurrent.atomic is a set of classes for working with primitive atomic types.
  • Timing The TimeUnit class provides multiple granularities (including nanoseconds) for specifying and controlling time-out based operations. Most classes in the package contain operations based on time-outs in addition to indefinite waits.



     << Previous
Next >>