private HazelcastClient(ClientConfig config)
        {
            this.config = config;
            var groupConfig = config.GetGroupConfig();

            instanceName = "hz.client_" + id + (groupConfig != null ? "_" + groupConfig.GetName() : string.Empty);

            //threadGroup = new ThreadGroup(instanceName);
            lifecycleService = new LifecycleService(this);
            try
            {
                string partitioningStrategyClassName = null;
                //TODO make partition strategy parametric
                //Runtime.GetProperty(PropPartitioningStrategyClass);
                IPartitioningStrategy partitioningStrategy;
                if (partitioningStrategyClassName != null && partitioningStrategyClassName.Length > 0)
                {
                    partitioningStrategy = null;
                }
                else
                {
                    //new Instance for partitioningStrategyClassName;
                    partitioningStrategy = new DefaultPartitioningStrategy();
                }
                serializationService =
                    new SerializationServiceBuilder().SetManagedContext(new HazelcastClientManagedContext(this,
                                                                                                          config.GetManagedContext()))
                    .SetConfig(config.GetSerializationConfig())
                    .SetPartitioningStrategy(partitioningStrategy)
                    .SetVersion(SerializationService.SerializerVersion)
                    .Build();
            }
            catch (Exception e)
            {
                throw ExceptionUtil.Rethrow(e);
            }
            proxyManager = new ProxyManager(this);

            //TODO EXECUTION SERVICE
            executionService  = new ClientExecutionService(instanceName, config.GetExecutorPoolSize());
            clusterService    = new ClientClusterService(this);
            loadBalancer      = config.GetLoadBalancer() ?? new RoundRobinLB();
            connectionManager = new ClientConnectionManager(this, loadBalancer);
            invocationService = GetInvocationService(config);
            listenerService   = new ClientListenerService(this);
            userContext       = new ConcurrentDictionary <string, object>();
            loadBalancer.Init(GetCluster(), config);
            proxyManager.Init(config);
            partitionService = new ClientPartitionService(this);
        }
 private void Start()
 {
     _lifecycleService.SetStarted();
     try
     {
         _invocationService.Start();
         _connectionManager.Start();
         _clusterService.Start();
         _proxyManager.Init(_config);
         _listenerService.Start();
         _loadBalancer.Init(GetCluster(), _config);
         _partitionService.Start();
     }
     catch (InvalidOperationException)
     {
         //there was an authentication failure (todo: perhaps use an AuthenticationException
         // ??)
         _lifecycleService.Shutdown();
         throw;
     }
 }
        private HazelcastClient(ClientConfig config)
        {
            _config = config;
            var groupConfig = config.GetGroupConfig();

            _instanceName = "hz.client_" + _id + (groupConfig != null ? "_" + groupConfig.GetName() : string.Empty);

            //threadGroup = new ThreadGroup(instanceName);
            _lifecycleService = new LifecycleService(this);
            try
            {
                //TODO make partition strategy parametric
                var partitioningStrategy = new DefaultPartitioningStrategy();
                _serializationService =
                    new SerializationServiceBuilder().SetManagedContext(new HazelcastClientManagedContext(this,
                                                                                                          config.GetManagedContext()))
                    .SetConfig(config.GetSerializationConfig())
                    .SetPartitioningStrategy(partitioningStrategy)
                    .SetVersion(SerializationService.SerializerVersion)
                    .Build();
            }
            catch (Exception e)
            {
                throw ExceptionUtil.Rethrow(e);
            }
            _proxyManager = new ProxyManager(this);

            //TODO EXECUTION SERVICE
            _executionService  = new ClientExecutionService(_instanceName, config.GetExecutorPoolSize());
            _clusterService    = new ClientClusterService(this);
            _loadBalancer      = config.GetLoadBalancer() ?? new RoundRobinLB();
            _connectionManager = new ClientConnectionManager(this);
            _invocationService = GetInvocationService(config);
            _listenerService   = new ClientListenerService(this);
            _userContext       = new ConcurrentDictionary <string, object>();
            _loadBalancer.Init(GetCluster(), config);
            _proxyManager.Init(config);
            _partitionService = new ClientPartitionService(this);
        }