private void CreateRaftServer <T1>(CoreServerModule coreServerModule, LifecycleMessageHandler <T1> messageHandlerChain, ChannelInboundHandler installedProtocolsHandler) { ApplicationProtocolRepository applicationProtocolRepository = new ApplicationProtocolRepository(Org.Neo4j.causalclustering.protocol.Protocol_ApplicationProtocols.values(), _supportedApplicationProtocol); ModifierProtocolRepository modifierProtocolRepository = new ModifierProtocolRepository(Org.Neo4j.causalclustering.protocol.Protocol_ModifierProtocols.values(), _supportedModifierProtocols); RaftMessageNettyHandler nettyHandler = new RaftMessageNettyHandler(_logProvider); RaftProtocolServerInstallerV2.Factory raftProtocolServerInstallerV2 = new RaftProtocolServerInstallerV2.Factory(nettyHandler, _pipelineBuilderFactory, _logProvider); RaftProtocolServerInstallerV1.Factory raftProtocolServerInstallerV1 = new RaftProtocolServerInstallerV1.Factory(nettyHandler, _pipelineBuilderFactory, _logProvider); ProtocolInstallerRepository <Org.Neo4j.causalclustering.protocol.ProtocolInstaller_Orientation_Server> protocolInstallerRepository = new ProtocolInstallerRepository <Org.Neo4j.causalclustering.protocol.ProtocolInstaller_Orientation_Server>(asList(raftProtocolServerInstallerV1, raftProtocolServerInstallerV2), Org.Neo4j.causalclustering.protocol.ModifierProtocolInstaller_Fields.AllServerInstallers); HandshakeServerInitializer handshakeServerInitializer = new HandshakeServerInitializer(applicationProtocolRepository, modifierProtocolRepository, protocolInstallerRepository, _pipelineBuilderFactory, _logProvider); ListenSocketAddress raftListenAddress = _platformModule.config.get(CausalClusteringSettings.RaftListenAddress); Server raftServer = new Server(handshakeServerInitializer, installedProtocolsHandler, _logProvider, _platformModule.logging.UserLogProvider, raftListenAddress, "raft-server"); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: org.neo4j.causalclustering.messaging.LoggingInbound<org.neo4j.causalclustering.core.consensus.RaftMessages_ReceivedInstantClusterIdAwareMessage<?>> loggingRaftInbound = new org.neo4j.causalclustering.messaging.LoggingInbound<>(nettyHandler, messageLogger, identityModule.myself()); LoggingInbound <RaftMessages_ReceivedInstantClusterIdAwareMessage <object> > loggingRaftInbound = new LoggingInbound <RaftMessages_ReceivedInstantClusterIdAwareMessage <object> >(nettyHandler, _messageLogger, _identityModule.myself()); loggingRaftInbound.RegisterHandler(messageHandlerChain); _platformModule.life.add(raftServer); // must start before core state so that it can trigger snapshot downloads when necessary _platformModule.life.add(coreServerModule.CreateCoreLife(messageHandlerChain)); _platformModule.life.add(coreServerModule.CatchupServer()); // must start last and stop first, since it handles external requests coreServerModule.BackupServer().ifPresent(_platformModule.life.add); _platformModule.life.add(coreServerModule.DownloadService()); }
public virtual Server Build() { ApplicationProtocolRepository applicationProtocolRepository = new ApplicationProtocolRepository(Protocol_ApplicationProtocols.values(), _catchupProtocols); ModifierProtocolRepository modifierProtocolRepository = new ModifierProtocolRepository(Protocol_ModifierProtocols.values(), _modifierProtocols); CatchupProtocolServerInstaller.Factory catchupProtocolServerInstaller = new CatchupProtocolServerInstaller.Factory(_pipelineBuilder, _debugLogProvider, _catchupServerHandler); ProtocolInstallerRepository <Org.Neo4j.causalclustering.protocol.ProtocolInstaller_Orientation_Server> protocolInstallerRepository = new ProtocolInstallerRepository <Org.Neo4j.causalclustering.protocol.ProtocolInstaller_Orientation_Server>(singletonList(catchupProtocolServerInstaller), Org.Neo4j.causalclustering.protocol.ModifierProtocolInstaller_Fields.AllServerInstallers); HandshakeServerInitializer handshakeServerInitializer = new HandshakeServerInitializer(applicationProtocolRepository, modifierProtocolRepository, protocolInstallerRepository, _pipelineBuilder, _debugLogProvider); return(new Server(handshakeServerInitializer, _parentHandler, _debugLogProvider, _userLogProvider, _listenAddress, _serverName)); }
private Server RaftServer(ChannelInboundHandler nettyHandler, int port) { NettyPipelineBuilderFactory pipelineFactory = new NettyPipelineBuilderFactory(VOID_WRAPPER); RaftProtocolServerInstallerV1.Factory factoryV1 = new RaftProtocolServerInstallerV1.Factory(nettyHandler, pipelineFactory, _logProvider); RaftProtocolServerInstallerV2.Factory factoryV2 = new RaftProtocolServerInstallerV2.Factory(nettyHandler, pipelineFactory, _logProvider); ProtocolInstallerRepository <Org.Neo4j.causalclustering.protocol.ProtocolInstaller_Orientation_Server> installer = new ProtocolInstallerRepository <Org.Neo4j.causalclustering.protocol.ProtocolInstaller_Orientation_Server>(Arrays.asList(factoryV1, factoryV2), Org.Neo4j.causalclustering.protocol.ModifierProtocolInstaller_Fields.AllServerInstallers); HandshakeServerInitializer channelInitializer = new HandshakeServerInitializer(_applicationProtocolRepository, _modifierProtocolRepository, installer, pipelineFactory, _logProvider); ListenSocketAddress listenAddress = new ListenSocketAddress("localhost", port); return(new Server(channelInitializer, null, _logProvider, _logProvider, listenAddress, "raft-server")); }