/** * Creates a new instance of the AppendProcessor class with no Metrics StatsRecorder. * * @param store The SegmentStore to send append requests to. * @param connection The ServerConnection to send responses to. * @param next The RequestProcessor to invoke next. * @param verifier The token verifier. */ @VisibleForTesting public AppendProcessor(StreamSegmentStore store, ServerConnection connection, RequestProcessor next, DelegationTokenVerifier verifier) { this(store, connection, next, null, verifier, MetricsProvider.getDynamicLogger(), false); }
/** * Creates a new instance of the PravegaRequestProcessor class with no Metrics StatsRecorder. * * @param segmentStore The StreamSegmentStore to attach to (and issue requests to). * @param tableStore The TableStore to attach to (and issue requests to). * @param connection The ServerConnection to attach to (and send responses to). */ @VisibleForTesting public PravegaRequestProcessor(StreamSegmentStore segmentStore, TableStore tableStore, ServerConnection connection) { this(segmentStore, tableStore, connection, null, new PassingTokenVerifier(), MetricsProvider.getDynamicLogger(), false); }
@Before public void setUp() throws Exception { StreamSegmentStore store = mock(StreamSegmentStore.class); connection = mock(ServerConnection.class); processor = new PravegaRequestProcessor(store, mock(TableStore.class), connection, null, (resource, token, expectedLevel) -> false, MetricsProvider.getDynamicLogger(), false); }
@Override public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline p = ch.pipeline(); if (sslCtx != null) { SslHandler handler = sslCtx.newHandler(ch.alloc()); p.addLast(handler); } ServerConnectionInboundHandler lsh = new ServerConnectionInboundHandler(); // p.addLast(new LoggingHandler(LogLevel.INFO)); p.addLast(new ExceptionLoggingHandler(ch.remoteAddress().toString()), new CommandEncoder(null), new LengthFieldBasedFrameDecoder(MAX_WIRECOMMAND_SIZE, 4, 4), new CommandDecoder(), new AppendDecoder(), lsh); lsh.setRequestProcessor(new AppendProcessor(store, lsh, new PravegaRequestProcessor(store, tableStore, lsh, statsRecorder, tokenVerifier, MetricsProvider.getDynamicLogger(), replyWithStackTraceOnError), statsRecorder, tokenVerifier, MetricsProvider.getDynamicLogger(), replyWithStackTraceOnError)); } });