private HazelcastClient(ClientConfig config) {
   this.config = config;
   final GroupConfig groupConfig = config.getGroupConfig();
   instanceName = "hz.client_" + id + (groupConfig != null ? "_" + groupConfig.getName() : "");
   threadGroup = new ThreadGroup(instanceName);
   lifecycleService = new LifecycleServiceImpl(this);
   clientProperties = new ClientProperties(config);
   serializationService = initSerializationService(config);
   proxyManager = new ProxyManager(this);
   executionService =
       new ClientExecutionServiceImpl(
           instanceName,
           threadGroup,
           Thread.currentThread().getContextClassLoader(),
           config.getExecutorPoolSize());
   transactionManager = new ClientTransactionManager(this);
   LoadBalancer lb = config.getLoadBalancer();
   if (lb == null) {
     lb = new RoundRobinLB();
   }
   loadBalancer = lb;
   connectionManager = createClientConnectionManager();
   clusterService = new ClientClusterServiceImpl(this);
   invocationService = new ClientInvocationServiceImpl(this);
   userContext = new ConcurrentHashMap<String, Object>();
   proxyManager.init(config);
   partitionService = new ClientPartitionServiceImpl(this);
 }
 @Override
 @Deprecated
 public <T extends DistributedObject> T getDistributedObject(String serviceName, Object id) {
   if (id instanceof String) {
     return (T) proxyManager.getProxy(serviceName, (String) id);
   }
   throw new IllegalArgumentException("'id' must be type of String!");
 }
 void doShutdown() {
   CLIENTS.remove(id);
   executionService.shutdown();
   partitionService.stop();
   clusterService.stop();
   transactionManager.shutdown();
   connectionManager.shutdown();
   proxyManager.destroy();
   serializationService.destroy();
 }
 @Override
 public Collection<DistributedObject> getDistributedObjects() {
   try {
     GetDistributedObjectsRequest request = new GetDistributedObjectsRequest();
     final Future<SerializableCollection> future = invocationService.invokeOnRandomTarget(request);
     final SerializableCollection serializableCollection =
         serializationService.toObject(future.get());
     for (Data data : serializableCollection) {
       final DistributedObjectInfo o = serializationService.toObject(data);
       getDistributedObject(o.getServiceName(), o.getName());
     }
     return (Collection<DistributedObject>) proxyManager.getDistributedObjects();
   } catch (Exception e) {
     throw ExceptionUtil.rethrow(e);
   }
 }
 @Override
 public <T extends DistributedObject> T getDistributedObject(String serviceName, String name) {
   return (T) proxyManager.getProxy(serviceName, name);
 }
 @Override
 public boolean removeDistributedObjectListener(String registrationId) {
   return proxyManager.removeDistributedObjectListener(registrationId);
 }
 @Override
 public String addDistributedObjectListener(DistributedObjectListener distributedObjectListener) {
   return proxyManager.addDistributedObjectListener(distributedObjectListener);
 }