예제 #1
0
        public ListenerService(HazelcastClient client)
        {
            _client            = client;
            _connectionManager = client.ConnectionManager;
            var eventTreadCount    = client.HazelcastProperties.IntValue(HazelcastProperties.EventThreadCount);
            var eventQueueCapacity = client.HazelcastProperties.IntValue(HazelcastProperties.EventQueueCapacity);

            _eventExecutor         = new StripedTaskScheduler(eventTreadCount, eventQueueCapacity, client.Name + ".event");
            _registrationScheduler = new StripedTaskScheduler(1, eventQueueCapacity, client.Name + ".eventRegistration");
            _registrations         = new ConcurrentDictionary <Guid, ListenerRegistration>();
            _eventHandlers         = new ConcurrentDictionary <long, DistributedEventHandler>();
            RegisterLocalOnly      = client.Configuration.NetworkConfig.SmartRouting;
        }
        public ListenerService(HazelcastClient client)
        {
            _client            = client;
            _connectionManager = client.ConnectionManager;
            var eventTreadCount    = EnvironmentUtil.ReadInt("hazelcast.client.event.thread.count") ?? DefaultEventThreadCount;
            var eventQueueCapacity =
                EnvironmentUtil.ReadInt("hazelcast.client.event.queue.capacity") ?? DefaultEventQueueCapacity;

            _eventExecutor         = new StripedTaskScheduler(eventTreadCount, eventQueueCapacity, client.Name + ".event");
            _registrationScheduler = new StripedTaskScheduler(1, eventQueueCapacity, client.Name + ".eventRegistration");
            _registrations         = new ConcurrentDictionary <Guid, ListenerRegistration>();
            _eventHandlers         = new ConcurrentDictionary <long, DistributedEventHandler>();
            RegisterLocalOnly      = client.ClientConfig.GetNetworkConfig().IsSmartRouting();
        }
        protected ClientInvocationService(HazelcastClient client)
        {
            _client         = client;
            _redoOperations = client.GetClientConfig().GetNetworkConfig().IsRedoOperation();

            var eventTreadCount = EnvironmentUtil.ReadEnvironmentVar("hazelcast.client.event.thread.count") ??
                                  DefaultEventThreadCount;

            _taskScheduler = new StripedTaskScheduler(eventTreadCount);

            _invocationTimeoutMillis =
                (EnvironmentUtil.ReadEnvironmentVar("hazelcast.client.invocation.timeout.seconds") ??
                 DefaultInvocationTimeout) * 1000;

            _clientConnectionManager = (ClientConnectionManager)client.GetConnectionManager();
            _clientConnectionManager.AddConnectionListener(this);
        }
예제 #4
0
        public ClientInvocationService(HazelcastClient client)
        {
            _client         = client;
            _redoOperations = client.GetClientConfig().GetNetworkConfig().IsRedoOperation();

            var eventTreadCount = EnvironmentUtil.ReadEnvironmentVar("hazelcast.client.event.thread.count") ??
                                  DefaultEventThreadCount;

            _taskScheduler = new StripedTaskScheduler(eventTreadCount);

            // TODO: These should be consoliated with the way it's done in the Java client
            _retryCount    = EnvironmentUtil.ReadEnvironmentVar("hazelcast.client.request.retry.count") ?? _retryCount;
            _retryWaitTime = EnvironmentUtil.ReadEnvironmentVar("hazelcast.client.request.retry.wait.time") ??
                             _retryWaitTime;

            _clientConnectionManager = (ClientConnectionManager)client.GetConnectionManager();
            _clientConnectionManager.AddConnectionListener(this);
            _clientConnectionManager.AddConnectionHeartBeatListener(this);
        }
예제 #5
0
        public ClientListenerService(HazelcastClient client)
        {
            _client            = client;
            _connectionManager = client.GetConnectionManager();

            var eventTreadCount = EnvironmentUtil.ReadEnvironmentVar("hazelcast.client.event.thread.count") ??
                                  DefaultEventThreadCount;

            var eventQueueCapacity = EnvironmentUtil.ReadEnvironmentVar("hazelcast.client.event.queue.capacity") ??
                                     DefaultEventQueueCapacity;

            _eventExecutor         = new StripedTaskScheduler(eventTreadCount, eventQueueCapacity, client.GetName() + ".event");
            _registrationScheduler =
                new StripedTaskScheduler(1, eventQueueCapacity, client.GetName() + ".eventRegistration");

            _registrations =
                new ConcurrentDictionary <ListenerRegistrationKey,
                                          ConcurrentDictionary <ClientConnection, EventRegistration> >();
            _eventHandlers = new ConcurrentDictionary <long, DistributedEventHandler>();

            _failedRegistrations = new ConcurrentDictionary <ClientConnection, ICollection <ListenerRegistrationKey> >();

            IsSmart = client.GetClientConfig().GetNetworkConfig().IsSmartRouting();
        }
 public LifecycleService(HazelcastClient client)
 {
     _client        = client;
     _eventExecutor = new StripedTaskScheduler(1, 1000, client.Name + ".lifecycle.event");
 }