org.infinispan.remoting.responses.DefaultResponseGenerator Maven / Gradle / Ivy
package org.infinispan.remoting.responses;
import org.infinispan.commands.remote.CacheRpcCommand;
import org.infinispan.container.versioning.EntryVersionsMap;
import org.infinispan.util.logging.Log;
import org.infinispan.util.logging.LogFactory;
/**
* The default response generator for most cache modes
*
* @author Manik Surtani
* @author Dan Berindei
* @since 4.0
*/
public class DefaultResponseGenerator implements ResponseGenerator {
private static final Log log = LogFactory.getLog(DefaultResponseGenerator.class);
private static final boolean trace = log.isTraceEnabled();
public Response getResponse(CacheRpcCommand command, Object returnValue) {
if (returnValue instanceof Response)
return (Response) returnValue;
if (command.isReturnValueExpected()) {
return SuccessfulResponse.create(returnValue);
} else {
if (returnValue != null) {
if (trace) log.tracef("Ignoring non-null response for command %s: %s", command, returnValue);
}
return null; // saves on serializing a response!
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy