Exemple #1
0
        public ClusterClient(LifeSupport life, ProtocolServer protocolServer)
        {
            this._life           = life;
            this._protocolServer = protocolServer;

            _cluster   = protocolServer.NewClient(typeof(Cluster));
            _broadcast = protocolServer.NewClient(typeof(AtomicBroadcast));
            _heartbeat = protocolServer.NewClient(typeof(Heartbeat));
            _snapshot  = protocolServer.NewClient(typeof(Snapshot));
            _election  = protocolServer.NewClient(typeof(Election));
        }
Exemple #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public ClusterNetworkIT(int nrOfServers, ClusterTestScript script) throws java.net.URISyntaxException
        public ClusterNetworkIT(int nrOfServers, ClusterTestScript script)
        {
            this._script = script;

            @out.Clear();
            @in.Clear();

            for (int i = 0; i < nrOfServers; i++)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.net.URI uri = new java.net.URI("neo4j://localhost:" + org.neo4j.ports.allocation.PortAuthority.allocatePort());
                URI uri = new URI("neo4j://localhost:" + PortAuthority.allocatePort());

                Monitors monitors = new Monitors();
                NetworkedServerFactory factory = new NetworkedServerFactory(_life, new MultiPaxosServerFactory(new ClusterConfiguration("default", NullLogProvider.Instance), NullLogProvider.Instance, monitors.NewMonitor(typeof(StateMachines.Monitor))), new FixedTimeoutStrategy(1000), NullLogProvider.Instance, new ObjectStreamFactory(), new ObjectStreamFactory(), monitors.NewMonitor(typeof(NetworkReceiver.Monitor)), monitors.NewMonitor(typeof(NetworkSender.Monitor)), monitors.NewMonitor(typeof(NamedThreadFactory.Monitor)));

                ServerIdElectionCredentialsProvider electionCredentialsProvider = new ServerIdElectionCredentialsProvider();
                ProtocolServer server = factory.NewNetworkedServer(Config.defaults(MapUtil.stringMap(ClusterSettings.cluster_server.name(), uri.Host + ":" + uri.Port, ClusterSettings.server_id.name(), "" + i)), new InMemoryAcceptorInstanceStore(), electionCredentialsProvider);
                server.AddBindingListener(electionCredentialsProvider);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final Cluster cluster2 = server.newClient(Cluster.class);
                Cluster cluster2 = server.NewClient(typeof(Cluster));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.concurrent.atomic.AtomicReference<ClusterConfiguration> config2 = clusterStateListener(uri, cluster2);
                AtomicReference <ClusterConfiguration> config2 = ClusterStateListener(uri, cluster2);

                _servers.Add(cluster2);
                @out.Add(cluster2);
                _configurations.Add(config2);
            }

            _life.start();
        }