Search in sources :

Example 1 with XidRolloverException

use of org.apache.zookeeper.server.quorum.Leader.XidRolloverException in project zookeeper by apache.

the class ReadOnlyRequestProcessor method run.

public void run() {
    try {
        while (!finished) {
            Request request = queuedRequests.take();
            // log request
            long traceMask = ZooTrace.CLIENT_REQUEST_TRACE_MASK;
            if (request.type == OpCode.ping) {
                traceMask = ZooTrace.CLIENT_PING_TRACE_MASK;
            }
            if (LOG.isTraceEnabled()) {
                ZooTrace.logRequest(LOG, traceMask, 'R', request, "");
            }
            if (Request.requestOfDeath == request) {
                break;
            }
            // filter read requests
            switch(request.type) {
                case OpCode.sync:
                case OpCode.create:
                case OpCode.create2:
                case OpCode.createTTL:
                case OpCode.createContainer:
                case OpCode.delete:
                case OpCode.deleteContainer:
                case OpCode.setData:
                case OpCode.reconfig:
                case OpCode.setACL:
                case OpCode.multi:
                case OpCode.check:
                    ReplyHeader hdr = new ReplyHeader(request.cxid, zks.getZKDatabase().getDataTreeLastProcessedZxid(), Code.NOTREADONLY.intValue());
                    try {
                        request.cnxn.sendResponse(hdr, null, null);
                    } catch (IOException e) {
                        LOG.error("IO exception while sending response", e);
                    }
                    continue;
            }
            // proceed to the next processor
            if (nextProcessor != null) {
                nextProcessor.processRequest(request);
            }
        }
    } catch (RequestProcessorException e) {
        if (e.getCause() instanceof XidRolloverException) {
            LOG.info(e.getCause().getMessage());
        }
        handleException(this.getName(), e);
    } catch (Exception e) {
        handleException(this.getName(), e);
    }
    LOG.info("ReadOnlyRequestProcessor exited loop!");
}
Also used : ReplyHeader(org.apache.zookeeper.proto.ReplyHeader) XidRolloverException(org.apache.zookeeper.server.quorum.Leader.XidRolloverException) Request(org.apache.zookeeper.server.Request) IOException(java.io.IOException) XidRolloverException(org.apache.zookeeper.server.quorum.Leader.XidRolloverException) IOException(java.io.IOException)

Example 2 with XidRolloverException

use of org.apache.zookeeper.server.quorum.Leader.XidRolloverException in project zookeeper by apache.

the class PrepRequestProcessor method run.

@Override
public void run() {
    try {
        while (true) {
            Request request = submittedRequests.take();
            long traceMask = ZooTrace.CLIENT_REQUEST_TRACE_MASK;
            if (request.type == OpCode.ping) {
                traceMask = ZooTrace.CLIENT_PING_TRACE_MASK;
            }
            if (LOG.isTraceEnabled()) {
                ZooTrace.logRequest(LOG, traceMask, 'P', request, "");
            }
            if (Request.requestOfDeath == request) {
                break;
            }
            pRequest(request);
        }
    } catch (RequestProcessorException e) {
        if (e.getCause() instanceof XidRolloverException) {
            LOG.info(e.getCause().getMessage());
        }
        handleException(this.getName(), e);
    } catch (Exception e) {
        handleException(this.getName(), e);
    }
    LOG.info("PrepRequestProcessor exited loop!");
}
Also used : XidRolloverException(org.apache.zookeeper.server.quorum.Leader.XidRolloverException) DeleteRequest(org.apache.zookeeper.proto.DeleteRequest) CreateRequest(org.apache.zookeeper.proto.CreateRequest) SetACLRequest(org.apache.zookeeper.proto.SetACLRequest) SetDataRequest(org.apache.zookeeper.proto.SetDataRequest) ReconfigRequest(org.apache.zookeeper.proto.ReconfigRequest) CheckVersionRequest(org.apache.zookeeper.proto.CheckVersionRequest) CreateTTLRequest(org.apache.zookeeper.proto.CreateTTLRequest) XidRolloverException(org.apache.zookeeper.server.quorum.Leader.XidRolloverException) BadArgumentsException(org.apache.zookeeper.KeeperException.BadArgumentsException) ConfigException(org.apache.zookeeper.server.quorum.QuorumPeerConfig.ConfigException) KeeperException(org.apache.zookeeper.KeeperException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)2 XidRolloverException (org.apache.zookeeper.server.quorum.Leader.XidRolloverException)2 KeeperException (org.apache.zookeeper.KeeperException)1 BadArgumentsException (org.apache.zookeeper.KeeperException.BadArgumentsException)1 CheckVersionRequest (org.apache.zookeeper.proto.CheckVersionRequest)1 CreateRequest (org.apache.zookeeper.proto.CreateRequest)1 CreateTTLRequest (org.apache.zookeeper.proto.CreateTTLRequest)1 DeleteRequest (org.apache.zookeeper.proto.DeleteRequest)1 ReconfigRequest (org.apache.zookeeper.proto.ReconfigRequest)1 ReplyHeader (org.apache.zookeeper.proto.ReplyHeader)1 SetACLRequest (org.apache.zookeeper.proto.SetACLRequest)1 SetDataRequest (org.apache.zookeeper.proto.SetDataRequest)1 Request (org.apache.zookeeper.server.Request)1 ConfigException (org.apache.zookeeper.server.quorum.QuorumPeerConfig.ConfigException)1