コード例 #1
0
        private HazelcastClient(ClientConfig config)
        {
            _config = config;
            var groupConfig = config.GetGroupConfig();

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

            _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        = CreateInvocationService();
            _listenerService          = new ClientListenerService(this);
            _userContext              = new ConcurrentDictionary <string, object>();
            _partitionService         = new ClientPartitionService(this);
            _lockReferenceIdGenerator = new ClientLockReferenceIdGenerator();
            _statistics       = new Statistics(this);
            _nearCacheManager = new NearCacheManager(this);
        }
コード例 #2
0
 public void TestGroupConfig()
 {
     Assert.That(_clientConfig.GetGroupConfig(), Is.EqualTo(new GroupConfig("dev", "dev-pass")));
 }
コード例 #3
0
 protected override void ConfigureGroup(ClientConfig config)
 {
     config.GetGroupConfig().SetName(_cluster.Id).SetPassword(_cluster.Id);
 }