I have a setup of two node on hazelcast 3.2.1 with each node containing 500 MB of data.I have configured client side Near cache.

We created a test env with 3 threads trying to get access HazelcastInstance client side at the same time.In this scenario only one thread succeeds in getting the map instance and able to get the output.The Other two threads display the following error

***LOG***

```
May 20, 2014 6:28:53 PM com.hazelcast.core.LifecycleService
INFO: HazelcastClient[hz.client_0_dev][3.2.1] is STARTING
May 20, 2014 6:28:53 PM com.hazelcast.core.LifecycleService
INFO: HazelcastClient[hz.client_0_dev][3.2.1] is STARTED
May 20, 2014 6:28:53 PM com.hazelcast.core.LifecycleService
INFO: HazelcastClient[hz.client_0_dev][3.2.1] is CLIENT_CONNECTED
May 20, 2014 6:28:53 PM com.hazelcast.client.spi.ClientClusterService
INFO: 

Members [1] {
    Member [122.142.15.132]:5701
}

End
Exception in thread "Thread-2" com.hazelcast.core.HazelcastInstanceNotActiveException: Hazelcast instance is not active!
    at com.hazelcast.client.spi.ClientProxy.getContext(ClientProxy.java:66)
    at com.hazelcast.client.proxy.ClientMapProxy.initNearCache(ClientMapProxy.java:860)
    at com.hazelcast.client.proxy.ClientMapProxy.get(ClientMapProxy.java:138)
    at Threadimp.execute(Threadimp.java:54)
    at Threadimp.run(Threadimp.java:24)
    at java.lang.Thread.run(Thread.java:662)
Exception in thread "Thread-1" com.hazelcast.core.HazelcastInstanceNotActiveException: Hazelcast instance is not active!
    at com.hazelcast.client.spi.ClientProxy.getContext(ClientProxy.java:66)
    at com.hazelcast.client.spi.ClientProxy.toData(ClientProxy.java:137)
    at com.hazelcast.client.proxy.ClientMapProxy.get(ClientMapProxy.java:140)
    at Threadimp.execute(Threadimp.java:54)
    at Threadimp.run(Threadimp.java:24)
    at java.lang.Thread.run(Thread.java:662)
ID: 3 1400590733685  totaltime  209

```

\*\*

> 
> **Source Code**
> 
> 
> 

\*\* 

**Singleton**

```
import java.io.Serializable;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

import com.hazelcast.client.HazelcastClient;
import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.config.InMemoryFormat;
import com.hazelcast.config.NearCacheConfig;
import com.hazelcast.core.HazelcastInstance;

 public class cacheSigleton implements Serializable {

 private static final long serialVersionUID = 1L;

 public static cacheSigleton INSTANCE = null;

 private static ClientConfig clientConfig = null;
 private static HazelcastInstance cacheClient = null;

 private static Set<String> nearcaches = new HashSet<String>(
 Arrays.asList("HOLIDAY_DATE_MAP","PARAMETERS_MAP"));

 private cacheSigleton() {

 if (clientConfig == null || cacheClient == null) {

 clientConfig = new ClientConfig();
 clientConfig.getGroupConfig().setName("dev")
 .setPassword("dev-pass");

 Iterator<String> iterator = nearcaches.iterator();
 String near = null;
 NearCacheConfig nearCacheConfig = null;
 while (iterator.hasNext()) {
 near = iterator.next();
 nearCacheConfig = new NearCacheConfig();
 nearCacheConfig.setEvictionPolicy("NONE");
 nearCacheConfig.setInMemoryFormat(InMemoryFormat.OBJECT);
 clientConfig.addNearCacheConfig(near, nearCacheConfig);
 }
 cacheClient = HazelcastClient.newHazelcastClient(clientConfig);
 }

 }

 public static cacheSigleton getInstance() {

 if(INSTANCE == null){

 synchronized(cacheSigleton.class)  {

 INSTANCE = new cacheSigleton();

 }
 }

 return INSTANCE;

 }

 public HazelcastInstance getHZInstance(){
      return cacheClient;

 }

 }

```

**Thread Impl**

```
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.IMap;

public class Threadimp implements Runnable{

 private  HazelcastInstance HZinstance = null;
 private int id = 0;

 public Threadimp(HazelcastInstance HZinstance, int id) {
 this.HZinstance = HZinstance;
 this.id = id;
 }

   public void run(){

   execute();
   }

 public void execute() {

 //Keys to retrieve the HZ map values
     Set<String> keys = new HashSet<String>(
     Arrays.asList(""18-Feb-05AAB","09-Jul-10AAB","24-Aug-07AAB","16-Jan-05AABNM","01-Jan-06AAB","16-Jan-09AAB","20-Feb-05AABNM","20-Feb-09AAB","09-Jan-06AAB","26-Jun-09AAB","31-Jul-08AABMY","25-Oct-12AAB","17-Oct-13AAB","03-Dec-11AAB"));

 long begin = System.currentTimeMillis();

        IMap<Object, Object> map = this.HZinstance.getMap("HOLIDAY_DATE_MAP");

     Iterator<String> iterator = keys.iterator();
 String key = null;
 Object out = null;

 while(iterator.hasNext()){
 key = iterator.next();
 out =  map.get(key);
 }

 long firstRead = System.currentTimeMillis() - begin;
 System.out.println("ID: " + id + " " + begin+ "  totaltime  " +firstRead);

 }

 public static void main(String args[]) throws Exception
 {

 System.out.println("Thread Starts");

 cacheSigleton instance = cacheSigleton.getInstance();
 HazelcastInstance HZinstance = instance.getHZInstance(); 

     Thread test1 = new Thread(new Threadimp(HZinstance, 1));

     Thread test2 = new Thread(new Threadimp(HZinstance, 2));
     Thread test3 = new Thread(new Threadimp(HZinstance, 3));

     test1.start();
     test2.start();
     test3.start();

     System.out.println("Thread End");
 }

}

```

Thanks in advance,
Sathish