示例#1
0
 public static INetworkCache GetCacheForManager(IServiceAddress[] managers)
 {
     lock (ServiceCacheMap) {
         INetworkCache picked      = null;
         int           pickedCount = 0;
         for (int i = 0; i < managers.Length; ++i)
         {
             INetworkCache g;
             if (ServiceCacheMap.TryGetValue(managers[i], out g))
             {
                 picked = g;
                 ++pickedCount;
             }
         }
         if (picked == null)
         {
             picked = CreateDefaultCacheFor(managers);
             for (int i = 0; i < managers.Length; ++i)
             {
                 ServiceCacheMap[managers[i]] = picked;
             }
         }
         else if (pickedCount != managers.Length)
         {
             for (int i = 0; i < managers.Length; ++i)
             {
                 ServiceCacheMap[managers[i]] = picked;
             }
         }
         return(picked);
     }
 }
示例#2
0
 public NetworkClient(IServiceAddress[] managerAddresses, IServiceConnector connector, INetworkCache lnc)
 {
     this.connector = connector;
     this.managerAddresses = managerAddresses;
     this.localNetworkCache = lnc;
     // Default values,
     MaxTransactionNodeCacheHeapSize = 14*1024*1024;
 }
示例#3
0
 public NetworkClient(IServiceAddress[] managerAddresses, IServiceConnector connector, INetworkCache lnc)
 {
     this.connector         = connector;
     this.managerAddresses  = managerAddresses;
     this.localNetworkCache = lnc;
     // Default values,
     MaxTransactionNodeCacheHeapSize = 14 * 1024 * 1024;
 }
示例#4
0
        public static void SetCache(IServiceAddress manager, INetworkCache cache)
        {
            if (manager == null)
                throw new ArgumentNullException("manager");

            lock (serviceCacheMap) {
                serviceCacheMap[manager] = cache;
            }
        }
示例#5
0
        public NetworkClient(IServiceAddress managerAddress, IServiceConnector connector, INetworkCache cache)
        {
            if (!(connector.MessageSerializer is IRpcMessageSerializer) ||
                !((IRpcMessageSerializer)connector.MessageSerializer).SupportsMessageStream)
                throw new ArgumentException("The connector given has an invalid message serializer for this context (must be a IRPC serializer).");

            this.connector = connector;
            this.managerAddress = managerAddress;
            this.cache = cache;
        }
示例#6
0
        public NetworkTreeSystem(IServiceConnector connector, IServiceAddress[] managerAddresses,
		                         INetworkCache networkCache, ServiceStatusTracker serviceTracker)
        {
            this.connector = connector;
            this.managerAddresses = managerAddresses;
            this.networkCache = networkCache;
            this.serviceTracker = serviceTracker;

            failureFloodControl = new Dictionary<IServiceAddress, DateTime>();
            failureFloodControlBidc = new Dictionary<IServiceAddress, DateTime>();
        }
示例#7
0
        internal NetworkTreeSystem(IServiceConnector connector, IServiceAddress managerAddress, INetworkCache networkCache)
        {
            if (!(connector.MessageSerializer is IRpcMessageSerializer) ||
                !((IRpcMessageSerializer)connector.MessageSerializer).SupportsMessageStream)
                throw new ArgumentException("The message serializer specified by the connector is not valid (must be IRPC).");

            this.connector = connector;
            this.managerAddress = managerAddress;
            this.networkCache = networkCache;
            failures = new Dictionary<IServiceAddress, DateTime>();
            pathToRoot = new Dictionary<string, IServiceAddress>();

            logger = Logger.Network;
        }
示例#8
0
 public NetworkClient(IServiceAddress managerAddress, ServiceConnector connector, INetworkCache networkCache)
     : this(new IServiceAddress[] { managerAddress}, connector, networkCache)
 {
 }
 public TcpProxyNetworkClient(TcpServiceAddress managerAddress, TcpServiceAddress proxyAddress, string password, INetworkCache cache)
     : base(managerAddress, new TcpProxyServiceConnector(proxyAddress, password), cache)
 {
 }
示例#10
0
            public PathConnection(RootService service, PathInfo pathInfo, IServiceConnector connector, IServiceAddress[] managerServers,
			                      INetworkCache cache, ServiceStatusTracker statusTracker)
            {
                this.service = service;
                this.pathInfo = pathInfo;
                treeSystem = new NetworkTreeSystem(connector, managerServers, cache, statusTracker);
            }
示例#11
0
 public PathConnection(RootService service, string pathName, 
     IServiceConnector connector, IServiceAddress manager,
     INetworkCache networkCache)
 {
     this.service = service;
     this.pathName = pathName;
     treeSystem = new NetworkTreeSystem(connector, manager, networkCache);
 }
示例#12
0
		public TcpNetworkClient(TcpServiceAddress[] managerAddress, string password, INetworkCache cache) 
			: base(managerAddress, new TcpServiceConnector(password), cache) {
		}
示例#13
0
 public TcpProxyNetworkClient(TcpServiceAddress managerAddress, TcpServiceAddress proxyAddress, string password, INetworkCache cache)
     : base(managerAddress, new TcpProxyServiceConnector(proxyAddress, password), cache)
 {
 }
示例#14
0
 public TcpNetworkClient(TcpServiceAddress[] managerAddress, string password, INetworkCache cache)
     : base(managerAddress, new TcpServiceConnector(password), cache)
 {
 }
示例#15
0
 public NetworkClient(IServiceAddress managerAddress, ServiceConnector connector, INetworkCache networkCache)
     : this(new IServiceAddress[] { managerAddress }, connector, networkCache)
 {
 }