
com.tinkerpop.gremlin.driver.Handler Maven / Gradle / Ivy
package com.tinkerpop.gremlin.driver;
import com.tinkerpop.gremlin.driver.exception.ResponseException;
import com.tinkerpop.gremlin.driver.message.ResponseMessage;
import com.tinkerpop.gremlin.driver.message.ResponseStatusCode;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.util.ReferenceCountUtil;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ConcurrentMap;
/**
* Traverser for internal handler classes for constructing the Channel Pipeline.
*
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
class Handler {
static class GremlinResponseHandler extends SimpleChannelInboundHandler {
private final ConcurrentMap pending;
public GremlinResponseHandler(final ConcurrentMap pending) {
this.pending = pending;
}
@Override
protected void channelRead0(final ChannelHandlerContext channelHandlerContext, final ResponseMessage response) throws Exception {
try {
if (response.getStatus().getCode() == ResponseStatusCode.SUCCESS) {
final Object data = response.getResult().getData();
if (data instanceof List) {
// unrolls the collection into individual response messages to be handled by the queue
final List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy