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

org.infinispan.remoting.transport.AbstractDelegatingTransport Maven / Gradle / Ivy

There is a newer version: 9.1.7.Final
Show newest version
package org.infinispan.remoting.transport;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;

import org.infinispan.commands.ReplicableCommand;
import org.infinispan.remoting.inboundhandler.DeliverOrder;
import org.infinispan.remoting.responses.Response;
import org.infinispan.remoting.rpc.ResponseFilter;
import org.infinispan.remoting.rpc.ResponseMode;
import org.infinispan.util.logging.Log;
import org.infinispan.xsite.XSiteBackup;
import org.infinispan.xsite.XSiteReplicateCommand;

/**
 * Designed to be overwrite.
 *
 * @author Pedro Ruivo
 * @since 6.0
 */
public abstract class AbstractDelegatingTransport implements Transport {

   protected final Transport actual;

   protected AbstractDelegatingTransport(Transport actual) {
      this.actual = actual;
   }

   @Override
   public Map invokeRemotely(Collection
recipients, ReplicableCommand rpcCommand, ResponseMode mode, long timeout, ResponseFilter responseFilter, DeliverOrder deliverOrder, boolean anycast) throws Exception { beforeInvokeRemotely(rpcCommand); Map result = actual.invokeRemotely(recipients, rpcCommand, mode, timeout, responseFilter, deliverOrder, anycast); return afterInvokeRemotely(rpcCommand, result); } @Override public Map invokeRemotely(Map rpcCommands, ResponseMode mode, long timeout, boolean usePriorityQueue, ResponseFilter responseFilter, boolean totalOrder, boolean anycast) throws Exception { return actual.invokeRemotely(rpcCommands, mode, timeout, usePriorityQueue, responseFilter, totalOrder, anycast); } @Override public Map invokeRemotely(Map rpcCommands, ResponseMode mode, long timeout, ResponseFilter responseFilter, DeliverOrder deliverOrder, boolean anycast) throws Exception { return actual.invokeRemotely(rpcCommands, mode, timeout, responseFilter, deliverOrder, anycast); } @Override public CompletableFuture> invokeRemotelyAsync(Collection
recipients, ReplicableCommand rpcCommand, ResponseMode mode, long timeout, ResponseFilter responseFilter, DeliverOrder deliverOrder, boolean anycast) throws Exception { return actual.invokeRemotelyAsync(recipients, rpcCommand, mode, timeout, responseFilter, deliverOrder, anycast); } @Override public void sendTo(Address destination, ReplicableCommand rpcCommand, DeliverOrder deliverOrder) throws Exception { actual.sendTo(destination, rpcCommand, deliverOrder); } @Override public void sendToMany(Collection
destinations, ReplicableCommand rpcCommand, DeliverOrder deliverOrder) throws Exception { actual.sendToMany(destinations, rpcCommand, deliverOrder); } @Override public BackupResponse backupRemotely(Collection backups, XSiteReplicateCommand rpcCommand) throws Exception { beforeBackupRemotely(rpcCommand); BackupResponse response = actual.backupRemotely(backups, rpcCommand); return afterBackupRemotely(rpcCommand, response); } @Override public boolean isCoordinator() { return actual.isCoordinator(); } @Override public Address getCoordinator() { return actual.getCoordinator(); } @Override public Address getAddress() { return actual.getAddress(); } @Override public List
getPhysicalAddresses() { return actual.getPhysicalAddresses(); } @Override public List
getMembers() { return actual.getMembers(); } @Override public boolean isMulticastCapable() { return actual.isMulticastCapable(); } @Override public void start() { actual.start(); } @Override public void stop() { actual.stop(); } @Override public int getViewId() { return actual.getViewId(); } @Override public CompletableFuture withView(int expectedViewId) { return actual.withView(expectedViewId); } @Override public void waitForView(int viewId) throws InterruptedException { actual.waitForView(viewId); } @Override public void checkTotalOrderSupported() { actual.checkTotalOrderSupported(); } @Override public Log getLog() { return actual.getLog(); } public Transport getDelegate() { return actual; } /** * method invoked before a remote invocation. * * @param command the command to be invoked remotely */ protected void beforeInvokeRemotely(ReplicableCommand command) { //no-op by default } /** * method invoked after a successful remote invocation. * * @param command the command invoked remotely. * @param responseMap can be null if not response is expected. * @return the new response map */ protected Map afterInvokeRemotely(ReplicableCommand command, Map responseMap) { return responseMap; } /** * method invoked before a backup remote invocation. * * @param command the command to be invoked remotely */ protected void beforeBackupRemotely(XSiteReplicateCommand command) { //no-op by default } /** * method invoked after a successful backup remote invocation. * * @param command the command invoked remotely. * @param response can be null if not response is expected. * @return the new response map */ protected BackupResponse afterBackupRemotely(ReplicableCommand command, BackupResponse response) { return response; } @Override public Set getSitesView() { return actual.getSitesView(); } @Override public CompletionStage invokeCommand(Address target, ReplicableCommand command, ResponseCollector collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit) { return actual.invokeCommand(target, command, collector, deliverOrder, timeout, unit); } @Override public CompletionStage invokeCommand(Collection
targets, ReplicableCommand command, ResponseCollector collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit) { return actual.invokeCommand(targets, command, collector, deliverOrder, timeout, unit); } @Override public CompletionStage invokeCommandOnAll(ReplicableCommand command, ResponseCollector collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit) { return actual.invokeCommandOnAll(command, collector, deliverOrder, timeout, unit); } @Override public CompletionStage invokeCommandStaggered(Collection
targets, ReplicableCommand command, ResponseCollector collector, DeliverOrder deliverOrder, long timeout, TimeUnit unit) { return actual.invokeCommandStaggered(targets, command, collector, deliverOrder, timeout, unit); } @Override public CompletionStage invokeCommands(Collection
targets, Function commandGenerator, ResponseCollector responseCollector, long timeout, DeliverOrder deliverOrder) { return actual.invokeCommands(targets, commandGenerator, responseCollector, timeout, deliverOrder); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy