All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.datastax.oss.driver.internal.core.session.RequestProcessor Maven / Gradle / Ivy

/*
 * Copyright DataStax, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.datastax.oss.driver.internal.core.session;

import com.datastax.oss.driver.api.core.cql.PrepareRequest;
import com.datastax.oss.driver.api.core.cql.Statement;
import com.datastax.oss.driver.api.core.session.Request;
import com.datastax.oss.driver.api.core.type.reflect.GenericType;
import com.datastax.oss.driver.internal.core.context.InternalDriverContext;

/**
 * Handles a type of request in the driver.
 *
 * 

By default, the driver supports CQL {@link Statement queries} and {@link PrepareRequest * preparation requests}. New processors can be plugged in to handle new types of requests. * * @param the type of request accepted. * @param the type of result when a request is processed. */ public interface RequestProcessor { /** * Whether the processor can produce the given result from the given request. * *

Processors will be tried in the order they were registered. The first processor for which * this method returns true will be used. */ boolean canProcess(Request request, GenericType resultType); /** Processes the given request, producing a result. */ ResultT process( RequestT request, DefaultSession session, InternalDriverContext context, String sessionLogPrefix); /** Builds a failed result to directly report the given error. */ ResultT newFailure(RuntimeException error); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy