コード例 #1
0
 private void RemoveClient(int cookie, ClientIStorage stg)
 {
     if (m_client_storages.TryRemove(cookie, out _))
     {
         // no responses come in from clients now
         Registry.UnregisterClient(stg.InstanceId);
         // no requests come in from servers now, safe to dispose
         stg.Dispose();
     }
 }
コード例 #2
0
        private ClientIStorage AddValueFactory(int _)
        {
            ClientIStorage stg = new ClientIStorage(m_memorycloud)
            {
                Pulse = DateTime.Now
            };
            int new_id = Registry.RegisterClient(stg);

            stg.InstanceId = new_id;
            return(stg);
        }
コード例 #3
0
        public override void RegisterClientHandler(RegisterClientRequestReader request, RegisterClientResponseWriter response)
        {
            response.PartitionCount = m_memorycloud.PartitionCount;
            var cstg = m_client_storages.AddOrUpdate(request.Cookie, _ =>
            {
                ClientIStorage stg = new ClientIStorage(m_memorycloud);
                stg.Pulse          = DateTime.Now;
                int new_id         = Registry.RegisterClient(stg);
                stg.InstanceId     = new_id;
                return(stg);
            }, (_, stg) => stg);

            response.InstanceId = cstg.InstanceId;
        }