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()); }
private RaftServerModule(PlatformModule platformModule, ConsensusModule consensusModule, IdentityModule identityModule, CoreServerModule coreServerModule, LocalDatabase localDatabase, NettyPipelineBuilderFactory pipelineBuilderFactory, MessageLogger <MemberId> messageLogger, Org.Neo4j.causalclustering.catchup.CatchupAddressProvider_PrioritisingUpstreamStrategyBasedAddressProvider catchupAddressProvider, ApplicationSupportedProtocols supportedApplicationProtocol, ICollection <ModifierSupportedProtocols> supportedModifierProtocols, ChannelInboundHandler installedProtocolsHandler) { this._platformModule = platformModule; this._consensusModule = consensusModule; this._identityModule = identityModule; this._supportedApplicationProtocol = supportedApplicationProtocol; this._localDatabase = localDatabase; this._messageLogger = messageLogger; this._logProvider = platformModule.Logging.InternalLogProvider; this._pipelineBuilderFactory = pipelineBuilderFactory; this._catchupAddressProvider = catchupAddressProvider; this._supportedModifierProtocols = supportedModifierProtocols; //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: org.neo4j.causalclustering.messaging.LifecycleMessageHandler<org.neo4j.causalclustering.core.consensus.RaftMessages_ReceivedInstantClusterIdAwareMessage<?>> messageHandlerChain = createMessageHandlerChain(coreServerModule); LifecycleMessageHandler <RaftMessages_ReceivedInstantClusterIdAwareMessage <object> > messageHandlerChain = CreateMessageHandlerChain(coreServerModule); CreateRaftServer(coreServerModule, messageHandlerChain, installedProtocolsHandler); }
public virtual CoreLife CreateCoreLife <T1>(LifecycleMessageHandler <T1> handler) { return(new CoreLife(_consensusModule.raftMachine(), _localDatabase, _clusteringModule.clusterBinder(), _commandApplicationProcess, _coreStateMachinesModule.coreStateMachines, handler, _snapshotService, _downloadService)); }