public Server(ChildInitializer childInitializer, ChannelInboundHandler parentHandler, LogProvider debugLogProvider, LogProvider userLogProvider, ListenSocketAddress listenAddress, string serverName) : base(debugLogProvider.GetLog(typeof(Server))) { this._childInitializer = childInitializer; this._parentHandler = parentHandler; this._listenAddress = listenAddress; this._debugLog = debugLogProvider.getLog(this.GetType()); this._userLog = userLogProvider.getLog(this.GetType()); this._serverName = serverName; this._threadFactory = new NamedThreadFactory(serverName); }
public TransactionBackupServiceProvider(LogProvider logProvider, LogProvider userLogProvider, ApplicationSupportedProtocols catchupProtocols, ICollection <ModifierSupportedProtocols> supportedModifierProtocols, NettyPipelineBuilderFactory serverPipelineBuilderFactory, CatchupServerHandler catchupServerHandler, ChannelInboundHandler parentHandler) { this._logProvider = logProvider; this._userLogProvider = userLogProvider; this._parentHandler = parentHandler; this._catchupProtocols = catchupProtocols; this._supportedModifierProtocols = supportedModifierProtocols; this._serverPipelineBuilderFactory = serverPipelineBuilderFactory; this._catchupServerHandler = catchupServerHandler; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotPropagateChannelInactive() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotPropagateChannelInactive() { ChannelInboundHandler next = mock(typeof(ChannelInboundHandler)); BoltConnection connection = mock(typeof(BoltConnection)); _channel = new EmbeddedChannel(new HouseKeeper(connection, NullLog.Instance), next); _channel.pipeline().fireChannelInactive(); verify(next, never()).channelInactive(any()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotPropagateExceptionCaught() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotPropagateExceptionCaught() { ChannelInboundHandler next = mock(typeof(ChannelInboundHandler)); BoltConnection connection = mock(typeof(BoltConnection)); _channel = new EmbeddedChannel(new HouseKeeper(connection, NullLog.Instance), next); _channel.pipeline().fireExceptionCaught(new Exception("some exception")); verify(next, never()).exceptionCaught(any(), any()); }
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")); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void channelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg) throws Exception public override void ChannelRead(ChannelHandlerContext ctx, object msg) { ChannelInboundHandler @delegate = _protocol.select(_decoders); if (@delegate == null) { _log.warn("Unregistered handler for protocol %s", _protocol); /* * Since we cannot process this message further we need to release the message as per netty doc * see http://netty.io/wiki/reference-counted-objects.html#inbound-messages */ ReferenceCountUtil.release(msg); return; } @delegate.channelRead(ctx, msg); }
public Factory(ChannelInboundHandler raftMessageHandler, NettyPipelineBuilderFactory pipelineBuilderFactory, LogProvider logProvider) : base(APPLICATION_PROTOCOL, outerInstance.modifiers->new RaftProtocolServerInstallerV2(raftMessageHandler, pipelineBuilderFactory, outerInstance.modifiers, logProvider))
public virtual void Register(E type, ChannelInboundHandler decoder) { Debug.Assert(!_decoders.ContainsKey(type), "registering twice a decoder for the same type (" + type + ")?"); _decoders[type] = decoder; }
public virtual CatchupServerBuilder ServerHandler(ChannelInboundHandler parentHandler) { this._parentHandler = parentHandler; return(this); }
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); }
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()); }
internal static void CreateAndStart(PlatformModule platformModule, ConsensusModule consensusModule, IdentityModule identityModule, CoreServerModule coreServerModule, LocalDatabase localDatabase, NettyPipelineBuilderFactory pipelineBuilderFactory, MessageLogger <MemberId> messageLogger, Org.Neo4j.causalclustering.catchup.CatchupAddressProvider_PrioritisingUpstreamStrategyBasedAddressProvider addressProvider, ApplicationSupportedProtocols supportedApplicationProtocol, ICollection <ModifierSupportedProtocols> supportedModifierProtocols, ChannelInboundHandler installedProtocolsHandler) { new RaftServerModule(platformModule, consensusModule, identityModule, coreServerModule, localDatabase, pipelineBuilderFactory, messageLogger, addressProvider, supportedApplicationProtocol, supportedModifierProtocols, installedProtocolsHandler); }