Пример #1
0
        public DistributedHashTable(
            string database,
            Uri url,
            IEndpointRouter endpointRouter,
            IServiceBus bus,
            Node metadata)
        {
            Url = url;
            this.endpointRouter = endpointRouter;
            this.bus = bus;
            Metadata = metadata;

            if (Metadata != null) // sole node in the network, probably
            {
                Metadata.ExecuteSync(uri =>
                {
                    ServiceUtil.Execute<IDistributedHashTableMetaDataProvider>(uri, srv =>
                    {
                        failOver = srv.GetNodeByUri(url);
                    });
                });
            }
            try
            {
                hashTable = new PersistentHashTable(database);
                hashTable.Initialize();
            }
            catch (Exception)
            {
                hashTable.Dispose();
                throw;
            }
        }
 public DistributedHashTable(string database, Action<InstanceParameters> configure)
 {
     try
     {
         hashTable = new PersistentHashTable(database)
         {
             Configure = configure
         };
         hashTable.Initialize();
     }
     catch (Exception)
     {
         if (hashTable != null)
             hashTable.Dispose();
         throw;
     }
 }
 public void Dispose()
 {
     fields?.Dispose();
 }