<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-20312931</id><updated>2025-07-08T14:33:24.920+01:00</updated><category term="ConcurrentHashMap"/><category term="OOP"/><category term="abstraction"/><category term="collections"/><category term="encapsulation"/><category term="hashmap"/><category term="hashtable"/><category term="inheritance"/><category term="jbpm"/><category term="workflow engine"/><title type='text'>Apurv&#39;s Java Blog</title><subtitle type='html'>This is a blog on java/J2ee and related technologies. It’s an Endeavour to provide answers to common java/j2ee related questions .</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://apurvagnihotri.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20312931/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://apurvagnihotri.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Apurv Agnihotri</name><uri>http://www.blogger.com/profile/14095396258857844060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>7</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-20312931.post-2598504880833596379</id><published>2010-06-19T07:19:00.000+01:00</published><updated>2010-06-19T07:19:12.149+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ConcurrentHashMap"/><title type='text'>ConcurrentHashMap :Be Careful while Iterating over</title><content type='html'>As Per Java Docs Iterator for ConcurrenthashMap does not guarantee to reflect concurrent changes in the map. It is due to the way thread safety for add/remove/update operations has been internally implemented in ConcurrentHashMap- ConcurrentHashMap internally divides the complete map in structures known as Buckets which can be accessed/Locked independently.&lt;br /&gt;
 &lt;br /&gt;
So, in order to avoid any NullPointerExceptions being thrown we need have a check for nulls being returned before making any calls on returned object. See snippet below to understand it further :-&lt;br /&gt;
 &lt;br /&gt;
&lt;b&gt;Iterator&lt;String&gt; it = testConcHashMap.keySet().iterator();&lt;br /&gt;
  while(it.hasNext()) {&lt;br /&gt;
    String key= (String)it.next();                     &lt;br /&gt;
    String value= testConcHashMap.get(key);&lt;br /&gt;
    //value.equals(&quot;anotherstring&quot;);//May throw a Null Pointer&lt;br /&gt;
 &lt;br /&gt;
    if(! (value== null)){ //check for null&lt;br /&gt;
    value.equals(&quot;anotherstring&quot;);&lt;br /&gt;
     }&lt;br /&gt;
  }&lt;/b&gt;&lt;br /&gt;
 &lt;br /&gt;
For further reading see java docs : http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ConcurrentHashMap.html</content><link rel='replies' type='application/atom+xml' href='http://apurvagnihotri.blogspot.com/feeds/2598504880833596379/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://apurvagnihotri.blogspot.com/2010/06/concurrenthashmap-be-careful-while.html#comment-form' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20312931/posts/default/2598504880833596379'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20312931/posts/default/2598504880833596379'/><link rel='alternate' type='text/html' href='http://apurvagnihotri.blogspot.com/2010/06/concurrenthashmap-be-careful-while.html' title='ConcurrentHashMap :Be Careful while Iterating over'/><author><name>Apurv Agnihotri</name><uri>http://www.blogger.com/profile/14095396258857844060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20312931.post-374434511550292933</id><published>2010-06-14T19:51:00.000+01:00</published><updated>2010-06-14T19:51:22.651+01:00</updated><title type='text'>Free e-book -Java Message Service</title><content type='html'>drop in your email ids as comments to get a very good free e-book by a renowned publisher on Java Message service.</content><link rel='replies' type='application/atom+xml' href='http://apurvagnihotri.blogspot.com/feeds/374434511550292933/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://apurvagnihotri.blogspot.com/2010/06/free-e-book-java-message-service.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20312931/posts/default/374434511550292933'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20312931/posts/default/374434511550292933'/><link rel='alternate' type='text/html' href='http://apurvagnihotri.blogspot.com/2010/06/free-e-book-java-message-service.html' title='Free e-book -Java Message Service'/><author><name>Apurv Agnihotri</name><uri>http://www.blogger.com/profile/14095396258857844060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20312931.post-5689237560670059296</id><published>2010-06-14T18:37:00.000+01:00</published><updated>2010-06-14T18:37:42.210+01:00</updated><title type='text'>CMMI- An overview</title><content type='html'>The CMMI is a framework for business process improvement.  In other words, it is a model for building process improvement systems.  In the same way that models are used to guide thinking and analysis on how to build other things (algorithms, buildings, molecules), CMMI is used to build process improvement systems.&lt;br /&gt;
&lt;br /&gt;
CMMI (Capability Maturity Model Integration) was formed after merging multiple CMM models - Capability Maturity Model for Software(SW-CMM), Systems Engineering Capability Model(SECM), Integrated Product Development Capability Maturity Model (IPD-CMM). As managing multiple CMM models is difficult, SEI integrated all CMM models into one - CMM Integrated. The structure and essence of CMMI is same as that of CMM. &lt;br /&gt;
 &lt;br /&gt;
There are 5 levels of maturity in CMMi, each layer is the foundation for ongoing improvement, designated by numbers 1 through 5,befor getting itnto that we need to understand PA or Process Areas.&lt;br /&gt;
&lt;br /&gt;
A process area is a cluster of related practices in an area that, when implemented collectively, satisfy a set of goals considered important for making improvement in that area.&lt;br /&gt;
 &lt;br /&gt;
Level 1 : Initial or Ad-hoc. There are no PAs (Process Areas) in this level&lt;br /&gt;
Level 2 : Managed. There are 7 PAs. PAs at this level look at project planning and execution (Basic project management)&lt;br /&gt;
Level 3 : Defined. There are 11 PAs here. Life cycle processes and Organizational processes are the focus areas here.&lt;br /&gt;
Level 4 : Quantitatively Managed. There are 2 PAs that deal with project management with quantitative data and statistical process control. (SPC)&lt;br /&gt;
Level 5 : Optimizing. There are 2 PAs. The focus is on continuous improvement.&lt;br /&gt;
 &lt;br /&gt;
There  are 22 process areas in all.&lt;br /&gt;
As we move from Level 1 to 5, the project risk decreases &amp; Quality and Productivity increases. &lt;br /&gt;
 &lt;b&gt;&lt;br /&gt;
What are the characteristics of a mature organization ?&lt;/b&gt;&lt;br /&gt;
 &lt;br /&gt;
Organizations can achieve progressive improvements in their organizational maturity by achieving control first at the project level and continuing to the most advanced level—organization-wide continuous process improvement—using both quantitative and qualitative data to make decisions.&lt;br /&gt;
 &lt;br /&gt;
A mature software organization possesses an organization-wide ability for managing software development and maintenance processes. The software process is accurately communicated to both existing staff and new employees, and work activities are carried out according to the planned process. The processes mandated are fit for use and consistent with the way the work actually gets done. These defined processes are updated when necessary, and improvements are developed through controlled pilot-tests and/or cost benefit analyses. Roles and responsibilities within the defined process are clear throughout the project and across the organization.&lt;br /&gt;
 &lt;br /&gt;
The CMM / CMMI model was designed to guide software organizations in selecting process improvement strategies by determining current process maturity and identifying the few issues most critical to software quality and process improvement.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
What&#39;s the difference between Maturity Level and Capability Level?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
They are different ways of rating your processes.&lt;br /&gt;
&lt;br /&gt;
A &quot;Maturity Level&quot; is what you can be appraised to and rated as when the organization uses the Staged Representation of the CMMI, and a &quot;Capability Level&quot; is what you can be appraised to and rated as when the organization uses the Continuous Representation of the CMMI.</content><link rel='replies' type='application/atom+xml' href='http://apurvagnihotri.blogspot.com/feeds/5689237560670059296/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://apurvagnihotri.blogspot.com/2010/06/cmmi-overview.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20312931/posts/default/5689237560670059296'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20312931/posts/default/5689237560670059296'/><link rel='alternate' type='text/html' href='http://apurvagnihotri.blogspot.com/2010/06/cmmi-overview.html' title='CMMI- An overview'/><author><name>Apurv Agnihotri</name><uri>http://www.blogger.com/profile/14095396258857844060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20312931.post-6666938007819356757</id><published>2010-06-14T18:22:00.000+01:00</published><updated>2010-06-14T18:22:56.720+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="jbpm"/><category scheme="http://www.blogger.com/atom/ns#" term="workflow engine"/><title type='text'>WorkFlow Engine - JBoss jBPM</title><content type='html'>Basic Info on WorkFlow engine to start with,will add to it going further&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;What is a workflow engine?&lt;/b&gt;&lt;br /&gt;
 &lt;br /&gt;
 - Workflow engine offers a programmatic structure for designing transactions and executing those using automated decisions, tasks and sequence flows. &lt;br /&gt;
 &lt;br /&gt;
- Workflow engine typically include three components: &lt;br /&gt;
     - An engine that executes process definitions&lt;br /&gt;
     - Services that allow the engine to interact with the outside world&lt;br /&gt;
     - Tools that aid process development and monitoring.&lt;br /&gt;
 &lt;br /&gt;
- Workflow engine require participation of two responsibility levels: &lt;br /&gt;
     -Business&lt;br /&gt;
     -Technical.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;jBoss jBPM&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
JBoss jBPM is an Open source, flexible and extensible workflow management system. &lt;br /&gt;
The business process can be represented graphically in terms of :-&lt;br /&gt;
&lt;br /&gt;
a. Tasks.&lt;br /&gt;
b. wait states for asynchronous communication.&lt;br /&gt;
c. Timers,&lt;br /&gt;
d. Automated actions etc.&lt;br /&gt;
&lt;br /&gt;
It has extensible control flow mechanism which binds all these operation together.&lt;br /&gt;
&lt;br /&gt;
JBpm can be configured with any RDBMS database like Oracle, MySql, Hypersonic Sql etc and it can be deployed on any J2EE application server. &lt;br /&gt;
&lt;br /&gt;
JBoss jBPM uses a unique process oriented programming model with its Process Definition Language (jPDL) which merges the best of java and declarative programming technique in order to create an easy to understand process graphs.</content><link rel='replies' type='application/atom+xml' href='http://apurvagnihotri.blogspot.com/feeds/6666938007819356757/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://apurvagnihotri.blogspot.com/2010/06/workflow-engine-jboss-jbpm.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20312931/posts/default/6666938007819356757'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20312931/posts/default/6666938007819356757'/><link rel='alternate' type='text/html' href='http://apurvagnihotri.blogspot.com/2010/06/workflow-engine-jboss-jbpm.html' title='WorkFlow Engine - JBoss jBPM'/><author><name>Apurv Agnihotri</name><uri>http://www.blogger.com/profile/14095396258857844060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20312931.post-7738848152504106850</id><published>2010-06-14T18:10:00.001+01:00</published><updated>2010-06-14T20:40:11.293+01:00</updated><title type='text'>JMS-Messaging Models</title><content type='html'>&lt;b&gt;Java Message Service (JMS)&lt;/b&gt; API allows Java applications to implement messaging using a standard API. The Java Message Service (JMS) has defined the standard for reliable Enterprise Messaging. JMS(API) is a part J2EE specifications and was developed by Sun Microsystems(Now Part of Oracle Corp.).&lt;br /&gt;
&lt;br /&gt;
JMS API provides following advantages to enterprise applications:&lt;br /&gt;
&lt;br /&gt;
a.    Loose coupling&lt;br /&gt;
b.    Scalability&lt;br /&gt;
c.    Asynchronous messaging&lt;br /&gt;
d.    Reliable message sending&lt;br /&gt;
e.    Heterogeneity&lt;br /&gt;
f.     Modularity&lt;br /&gt;
&lt;br /&gt;
JMS is composed of following parts:&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
JMS provider:&lt;/b&gt; it provides administrative and control features andimplements the JMS interfaces.&lt;br /&gt;
&lt;b&gt;JMS clients:&lt;/b&gt; Components that produce and consume messages.&lt;br /&gt;
&lt;b&gt;Messages:&lt;/b&gt; Object that carry information between JMS clients.&lt;br /&gt;
&lt;b&gt;Administered objects:&lt;/b&gt; preconfigured JMS objects which are used by clients and are created by administrators.Eg. Destination and Connection Factories.&lt;br /&gt;
&lt;b&gt;Native clients:&lt;/b&gt; Programs that uses some messaging product’s native client API instead of JMS API.&lt;br /&gt;
  &lt;br /&gt;
Messaging systems support following messaging models:&lt;br /&gt;
  &lt;br /&gt;
Publish-Subscribe Messaging&lt;br /&gt;
Point-to-Point Messaging&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Publish-Subscribe Messaging&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This model is used when several applications need to receive the same message. In Publish-Subscribe messaging system, multiple publisher can send messages to a Topic and all the Subscribers to that topic receive all the messages sent to that Topic. In a Publish Subscribe Messaging there may be multiple Senders and multiple Receivers. Publishers and subscribers are generally anonymous and may dynamically publish or subscribe to the content.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
Point-to-Point Messaging&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
In this model, a producer sends messages to a particular queue and a consumer gets messages from the queue. Queues retain all messages sent to them until the messages are consumed or until the messages expire. Only one consumer will get the message and producer will know the consumer of the message.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Consumption of Messages&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Messages sent using above two messaging models can be received /consumed in following two ways:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Synchronous:&lt;/b&gt; The message is fetched from destination by calling the receive method.&lt;br /&gt;
&lt;b&gt;Asynchronous:&lt;/b&gt; By registering a message listener. When a message arrives at the destination, the JMS provider delivers the message by calling the listener&#39;s onMessage method.</content><link rel='replies' type='application/atom+xml' href='http://apurvagnihotri.blogspot.com/feeds/7738848152504106850/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://apurvagnihotri.blogspot.com/2010/06/jms-messaging-models.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20312931/posts/default/7738848152504106850'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20312931/posts/default/7738848152504106850'/><link rel='alternate' type='text/html' href='http://apurvagnihotri.blogspot.com/2010/06/jms-messaging-models.html' title='JMS-Messaging Models'/><author><name>Apurv Agnihotri</name><uri>http://www.blogger.com/profile/14095396258857844060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20312931.post-3409858872922476166</id><published>2010-06-13T12:26:00.000+01:00</published><updated>2010-06-13T12:26:06.974+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="abstraction"/><category scheme="http://www.blogger.com/atom/ns#" term="encapsulation"/><category scheme="http://www.blogger.com/atom/ns#" term="inheritance"/><category scheme="http://www.blogger.com/atom/ns#" term="OOP"/><title type='text'>Understanding Object Oriented Programming Principles: Encapsulation, Inheritance, Polymorphism and Abstraction</title><content type='html'>&lt;b&gt;Encapsulation&lt;/b&gt;:&lt;br /&gt;
Means putting the data and the function that operates on that data in a single unit(information hiding) .Encapsulation prevents clients from seeing its inside view, where the behavior of the abstraction is implemented.&lt;br /&gt;
Encapsulation is the mechanism that binds together code and the data it manipulates,and keeps both safe from outside interference and misuse.in java encapsulation is achieved by making use of access modifiers( keeping variables as private and providing public getters and setters.&lt;br /&gt;
&lt;br /&gt;
Eg:-&lt;br /&gt;
automatic transmission of an automobile.&lt;br /&gt;
It encapsulates lots of information about the engine, such acceleration, the pitch of the surface , and the position of the shift&lt;br /&gt;
lever. Being a user,we have only one method of affecting this complex encapsulation: moving the gear-shift lever.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Inheritance&lt;/b&gt;:&lt;br /&gt;
Inheritance is the process by which one object acquires the properties of another object.&lt;br /&gt;
&lt;br /&gt;
Eg:-Vehicle-&gt;motorized-&gt;4wheeled.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Polymorphism&lt;/b&gt;:&lt;br /&gt;
Polymorphism (from the Greek, meaning “many forms”) is a feature that allows one interface to be used for a general class of actions.&lt;br /&gt;
&lt;br /&gt;
Eg. Car&#39;s steering -&gt;one interface many implementations(power or rack and pinion)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Abstraction&lt;/b&gt;:&lt;br /&gt;
Means hiding the internal details and just exposing the functionality.&lt;br /&gt;
&lt;br /&gt;
Eg:-When we change the gear of a car, we know the gears will be changed without knowing how they are functioning internally.&lt;br /&gt;
Abstraction focuses on the outside view of an object (i.e. the interface).</content><link rel='replies' type='application/atom+xml' href='http://apurvagnihotri.blogspot.com/feeds/3409858872922476166/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://apurvagnihotri.blogspot.com/2010/06/understanding-object-oriented.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20312931/posts/default/3409858872922476166'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20312931/posts/default/3409858872922476166'/><link rel='alternate' type='text/html' href='http://apurvagnihotri.blogspot.com/2010/06/understanding-object-oriented.html' title='Understanding Object Oriented Programming Principles: Encapsulation, Inheritance, Polymorphism and Abstraction'/><author><name>Apurv Agnihotri</name><uri>http://www.blogger.com/profile/14095396258857844060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20312931.post-5719250530344518138</id><published>2010-06-13T11:02:00.023+01:00</published><updated>2010-06-14T18:05:42.095+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="collections"/><category scheme="http://www.blogger.com/atom/ns#" term="hashmap"/><category scheme="http://www.blogger.com/atom/ns#" term="hashtable"/><title type='text'>HashMap Vs HashTable Vs ConcurrentHashmap</title><content type='html'>HashMap and HashTable both provide key-value access to data.&lt;br /&gt;
&lt;br /&gt;
The Hashtable is among the original collection classes in Java.Hashtable extends the Dictionary class, which as the Javadocs state, is obsolete and has been replaced by the Map interface. HashMap is part of the new Collections Framework, added with Java 2.&lt;br /&gt;
&lt;br /&gt;
The key difference between the two is that access to the Hashtable is synchronized on the table while access to the HashMap is not synchronized.This makes HashMap better for non-threaded applications, as unsynchronized Objects typically perform better than synchronized ones&lt;br /&gt;
&lt;br /&gt;
HashMap has a more complex hashing algorithm then Hashtable. It takes the hash value from the key and then hashes it again (double hashing). This can improve the distribution of the keys and hence the performance of the Map.&lt;br /&gt;
&lt;br /&gt;
Another difference is that iterator in the HashMap is fail-safe while the enumerator for the Hashtable isn&#39;t. If we change the map while iterating, it will throw exception. &lt;br /&gt;
&lt;br /&gt;
Third difference is that HashMap permits null values in it, while Hashtable doesn&#39;t.Also note that only one NULL value is allowed as a key in HashMap. HashMap does not allow multiple keys to be NULL. Nevertheless, it can have multiple NULL values.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Using ConcurrentHashmap&lt;/b&gt;: for having a thread safe map we can use ConcurrenthashMap(from java5 onwards) as well instead of Hashtable which has become obsolete.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;private Map&lt;String,String&gt; myConcMap =  new ConcurrentHashMap&lt;String,String&gt;();&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Now The question arises &lt;b&gt;why ConcurrentHashMap and not HashTable or just have a synchronised access to HasMap.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
So the major advantage of using ConcurrentHashMap is &quot;performance&quot; as the lock is not applied on wholeMap as is the case with a Synchronised access to hashmap or Hashtable.&lt;br /&gt;
&lt;br /&gt;
As we know that hash maps store their data in a series of separate buckets, it is possible to lock only the portion of the map that is being accessed.ConcurrentHashMap  uses this to provide us a highly optimized synchronised way of accessing HashMap.ConcurrentHash hash map follows following to provide a concurrent access:&lt;br /&gt;
&lt;br /&gt;
1. Writing to a ConcurrentHashMap locks only a portion of the map&lt;br /&gt;
2. Reads can occur without locking.&lt;br /&gt;
&lt;br /&gt;
Some disadvantges of ConcurrentHashMap:&lt;br /&gt;
ConcurrentHashMap will generally take up more memory.&lt;br /&gt;
it cannot take null as a key.</content><link rel='replies' type='application/atom+xml' href='http://apurvagnihotri.blogspot.com/feeds/5719250530344518138/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://apurvagnihotri.blogspot.com/2010/06/hashmap-vs-hashtable.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20312931/posts/default/5719250530344518138'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20312931/posts/default/5719250530344518138'/><link rel='alternate' type='text/html' href='http://apurvagnihotri.blogspot.com/2010/06/hashmap-vs-hashtable.html' title='HashMap Vs HashTable Vs ConcurrentHashmap'/><author><name>Apurv Agnihotri</name><uri>http://www.blogger.com/profile/14095396258857844060</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry></feed>