public ServiceClient Construct(ClusteringConfiguration clusteringConfiguration) { if (clusteringConfiguration.ClusteringRole == ClusteringRole.HostOnly && !IPAddress.IsLoopback(clusteringConfiguration.Address)) { throw new InvalidOperationException("It is impossible host a Dargon Service cluster located at a remote address!"); } LocalServiceContainer localServiceContainer = new LocalServiceContainerImpl(collectionFactory); ClusteringPhaseManager clusteringPhaseManager = new ClusteringPhaseManagerImpl(); PortableObjectBoxConverter portableObjectBoxConverter = new PortableObjectBoxConverter(streamFactory, pofSerializer); HostSessionFactory hostSessionFactory = new HostSessionFactoryImpl(threadingProxy, collectionFactory, pofSerializer, pofStreamsFactory, portableObjectBoxConverter); ClusteringPhaseFactory clusteringPhaseFactory = new ClusteringPhaseFactoryImpl(collectionFactory, threadingProxy, networkingProxy, pofStreamsFactory, hostSessionFactory, clusteringConfiguration, portableObjectBoxConverter, clusteringPhaseManager); ClusteringPhase initialClusteringPhase = clusteringPhaseFactory.CreateIndeterminatePhase(localServiceContainer); clusteringPhaseManager.Transition(initialClusteringPhase); RemoteServiceInvocationValidatorFactory validatorFactory = new RemoteServiceInvocationValidatorFactoryImpl(collectionFactory); RemoteServiceProxyFactory remoteServiceProxyFactory = new RemoteServiceProxyFactoryImpl(proxyGenerator, portableObjectBoxConverter, validatorFactory, clusteringPhaseManager); InvokableServiceContextFactory invokableServiceContextFactory = new InvokableServiceContextFactoryImpl(collectionFactory, portableObjectBoxConverter); IConcurrentDictionary <Guid, InvokableServiceContext> serviceContextsById = new ConcurrentDictionary <Guid, InvokableServiceContext>(); LocalServiceRegistry localServiceRegistry = new LocalServiceRegistryImpl(localServiceContainer, clusteringPhaseManager, invokableServiceContextFactory, serviceContextsById); IConcurrentDictionary <Type, object> serviceProxiesByInterface = new ConcurrentDictionary <Type, object>(); RemoteServiceProxyContainer remoteServiceProxyContainer = new RemoteServiceProxyContainerImpl(remoteServiceProxyFactory, serviceProxiesByInterface); return(new ServiceClientProxyImpl(localServiceRegistry, remoteServiceProxyContainer)); }
public IndeterminateClusteringPhase(IThreadingProxy threadingProxy, INetworkingProxy networkingProxy, ClusteringPhaseFactory clusteringPhaseFactory, ClusteringConfiguration clusteringConfiguration, LocalServiceContainer localServiceContainer, ClusteringPhaseManager clusteringPhaseManager) { this.threadingProxy = threadingProxy; this.networkingProxy = networkingProxy; this.clusteringPhaseFactory = clusteringPhaseFactory; this.clusteringConfiguration = clusteringConfiguration; this.localServiceContainer = localServiceContainer; this.clusteringPhaseManager = clusteringPhaseManager; }
private bool TryCreateHostListener(ClusteringConfiguration configuration, out IListenerSocket listener) { try { listener = networkingProxy.CreateListenerSocket(configuration.Port); return(true); } catch (SocketException) { listener = null; return(false); } }
public ClusteringPhaseFactoryImpl(ICollectionFactory collectionFactory, IThreadingProxy threadingProxy, INetworkingProxy networkingProxy, PofStreamsFactory pofStreamsFactory, HostSessionFactory hostSessionFactory, ClusteringConfiguration clusteringConfiguration, PortableObjectBoxConverter portableObjectBoxConverter, ClusteringPhaseManager clusteringPhaseManager) { this.collectionFactory = collectionFactory; this.threadingProxy = threadingProxy; this.networkingProxy = networkingProxy; this.pofStreamsFactory = pofStreamsFactory; this.hostSessionFactory = hostSessionFactory; this.clusteringConfiguration = clusteringConfiguration; this.portableObjectBoxConverter = portableObjectBoxConverter; this.clusteringPhaseManager = clusteringPhaseManager; }
public Clustering(ClusteringConfiguration <Item> config) => Configuration = config;
public KMeansClustering(int k, ClusteringConfiguration <Item> config) : base(config) => K = k;