Пример #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void start() throws Throwable
        public override void Start()
        {
            Log log     = _logService.getInternalLog(typeof(BoltServer));
            Log userLog = _logService.getUserLog(typeof(BoltServer));

            InternalLoggerFactory.DefaultFactory = new Netty4LoggerFactory(_logService.InternalLogProvider);

            Authentication authentication = CreateAuthentication();

            TransportThrottleGroup throttleGroup = new TransportThrottleGroup(_config, _clock);

            BoltSchedulerProvider   boltSchedulerProvider   = _life.add(new ExecutorBoltSchedulerProvider(_config, new CachedThreadPoolExecutorFactory(log), _jobScheduler, _logService));
            BoltConnectionFactory   boltConnectionFactory   = CreateConnectionFactory(_config, boltSchedulerProvider, throttleGroup, _logService, _clock);
            BoltStateMachineFactory boltStateMachineFactory = CreateBoltFactory(authentication, _clock);

            BoltProtocolFactory boltProtocolFactory = CreateBoltProtocolFactory(boltConnectionFactory, boltStateMachineFactory);

            if (_config.enabledBoltConnectors().Count > 0 && !_config.get(GraphDatabaseSettings.disconnected))
            {
                NettyServer server = new NettyServer(_jobScheduler.threadFactory(Group.BOLT_NETWORK_IO), CreateConnectors(boltProtocolFactory, throttleGroup, log), _connectorPortRegister, userLog);
                _life.add(server);
                log.Info("Bolt server loaded");
            }

            _life.start();               // init and start the nested lifecycle
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldInstallChannelHandlersInCorrectOrder() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldInstallChannelHandlersInCorrectOrder()
        {
            // Given
            BoltChannel           boltChannel       = NewBoltChannel(_channel);
            BoltConnectionFactory connectionFactory = mock(typeof(BoltConnectionFactory));

            when(connectionFactory.NewConnection(eq(boltChannel), any())).thenReturn(mock(typeof(BoltConnection)));
            BoltProtocol boltProtocol = new BoltProtocolV1(boltChannel, connectionFactory, mock(typeof(BoltStateMachineFactory)), NullLogService.Instance);

            // When
            boltProtocol.Install();

            IEnumerator <KeyValuePair <string, ChannelHandler> > handlers = _channel.pipeline().GetEnumerator();

//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            assertThat(handlers.next().Value, instanceOf(typeof(ChunkDecoder)));
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            assertThat(handlers.next().Value, instanceOf(typeof(MessageAccumulator)));
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            assertThat(handlers.next().Value, instanceOf(typeof(MessageDecoder)));
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            assertThat(handlers.next().Value, instanceOf(typeof(HouseKeeper)));

//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            assertFalse(handlers.hasNext());
        }
Пример #3
0
 private BoltProtocolFactory CreateBoltProtocolFactory(BoltConnectionFactory connectionFactory, BoltStateMachineFactory stateMachineFactory)
 {
     return(new DefaultBoltProtocolFactory(connectionFactory, stateMachineFactory, _logService));
 }