Ejemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public <PAYLOAD> Response<PAYLOAD> deserializeResponse(org.jboss.netty.handler.queue.BlockingReadHandler<org.jboss.netty.buffer.ChannelBuffer> reader, ByteBuffer input, long timeout, Deserializer<PAYLOAD> payloadDeserializer, ResourceReleaser channelReleaser, final org.neo4j.kernel.impl.transaction.log.entry.LogEntryReader<org.neo4j.kernel.impl.transaction.log.ReadableClosablePositionAwareChannel> entryReader) throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
        public virtual Response <PAYLOAD> DeserializeResponse <PAYLOAD>(BlockingReadHandler <ChannelBuffer> reader, ByteBuffer input, long timeout, Deserializer <PAYLOAD> payloadDeserializer, ResourceReleaser channelReleaser, LogEntryReader <ReadableClosablePositionAwareChannel> entryReader)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final DechunkingChannelBuffer dechunkingBuffer = new DechunkingChannelBuffer(reader, timeout, internalProtocolVersion, applicationProtocolVersion);
            DechunkingChannelBuffer dechunkingBuffer = new DechunkingChannelBuffer(reader, timeout, _internalProtocolVersion, _applicationProtocolVersion);

            PAYLOAD response = payloadDeserializer.Read(dechunkingBuffer, input);
            StoreId storeId  = ReadStoreId(dechunkingBuffer, input);

            // Response type is what previously was a byte saying how many data sources there were in the
            // coming transaction stream response. For backwards compatibility we keep it as a byte and we introduce
            // the transaction obligation response type as -1
            sbyte responseType = dechunkingBuffer.ReadByte();

            if (responseType == TransactionObligationResponse.RESPONSE_TYPE)
            {
                // It is a transaction obligation response
                long obligationTxId = dechunkingBuffer.ReadLong();
                return(new TransactionObligationResponse <PAYLOAD>(response, storeId, obligationTxId, channelReleaser));
            }

            // It's a transaction stream in this response
            TransactionStream transactions = visitor =>
            {
                NetworkReadableClosableChannel channel = new NetworkReadableClosableChannel(dechunkingBuffer);

                using (PhysicalTransactionCursor <ReadableClosablePositionAwareChannel> cursor = new PhysicalTransactionCursor <ReadableClosablePositionAwareChannel>(channel, entryReader))
                {
                    while (cursor.next() && !visitor.visit(cursor.get()))
                    {
                    }
                }
            };

            return(new TransactionStreamResponse <PAYLOAD>(response, storeId, transactions, channelReleaser));
        }
Ejemplo n.º 2
0
 public InputStreamAnonymousInnerClass(DechunkingChannelBuffer outerInstance)
 {
     this.outerInstance = outerInstance;
 }