Skip to content

Commit

Permalink
ISPN-7550 Remove TriangleAckInterceptor
Browse files Browse the repository at this point in the history
  • Loading branch information
pruivo authored and Gustavo Fernandes committed Mar 8, 2017
1 parent fe10374 commit 2be8301
Show file tree
Hide file tree
Showing 36 changed files with 895 additions and 1,160 deletions.
Expand Up @@ -176,4 +176,5 @@ public interface Ids {
int VERSIONED_RESULTS = 116; int VERSIONED_RESULTS = 116;
int FUNCTIONAL_ENTRY_VERSION_ADAPTER = 117; int FUNCTIONAL_ENTRY_VERSION_ADAPTER = 117;


int WRITE_RESPONSE = 118;
} }
Expand Up @@ -157,4 +157,15 @@ public static void assertNotNullEntries(Collection<?> collection, String name) {
Supplier<String> entrySupplier = () -> "Collection '" + name + "' contains null entry."; Supplier<String> entrySupplier = () -> "Collection '" + name + "' contains null entry.";
collection.forEach(k -> Objects.requireNonNull(k, entrySupplier)); collection.forEach(k -> Objects.requireNonNull(k, entrySupplier));
} }

public static <K, V> Map<K, V> mergeMaps(Map<K, V> one, Map<K, V> second) {
if (one == null) {
return second;
} else if (second == null) {
return one;
} else {
one.putAll(second);
return one;
}
}
} }
Expand Up @@ -58,8 +58,6 @@
import org.infinispan.commands.write.EvictCommand; import org.infinispan.commands.write.EvictCommand;
import org.infinispan.commands.write.ExceptionAckCommand; import org.infinispan.commands.write.ExceptionAckCommand;
import org.infinispan.commands.write.InvalidateCommand; import org.infinispan.commands.write.InvalidateCommand;
import org.infinispan.commands.write.PrimaryAckCommand;
import org.infinispan.commands.write.PrimaryMultiKeyAckCommand;
import org.infinispan.commands.write.PutKeyValueCommand; import org.infinispan.commands.write.PutKeyValueCommand;
import org.infinispan.commands.write.PutMapCommand; import org.infinispan.commands.write.PutMapCommand;
import org.infinispan.commands.write.RemoveCommand; import org.infinispan.commands.write.RemoveCommand;
Expand Down Expand Up @@ -499,12 +497,8 @@ <K, V> WriteOnlyKeyValueCommand<K, V> buildWriteOnlyKeyValueCommand(


BackupAckCommand buildBackupAckCommand(long id, int topologyId); BackupAckCommand buildBackupAckCommand(long id, int topologyId);


PrimaryAckCommand buildPrimaryAckCommand();

BackupMultiKeyAckCommand buildBackupMultiKeyAckCommand(long id, int segment, int topologyId); BackupMultiKeyAckCommand buildBackupMultiKeyAckCommand(long id, int segment, int topologyId);


PrimaryMultiKeyAckCommand buildPrimaryMultiKeyAckCommand(long id, int topologyId);

ExceptionAckCommand buildExceptionAckCommand(long id, Throwable throwable, int topologyId); ExceptionAckCommand buildExceptionAckCommand(long id, Throwable throwable, int topologyId);


BackupWriteRcpCommand buildBackupWriteRcpCommand(DataWriteCommand command); BackupWriteRcpCommand buildBackupWriteRcpCommand(DataWriteCommand command);
Expand Down
Expand Up @@ -66,8 +66,6 @@
import org.infinispan.commands.write.ExceptionAckCommand; import org.infinispan.commands.write.ExceptionAckCommand;
import org.infinispan.commands.write.InvalidateCommand; import org.infinispan.commands.write.InvalidateCommand;
import org.infinispan.commands.write.InvalidateL1Command; import org.infinispan.commands.write.InvalidateL1Command;
import org.infinispan.commands.write.PrimaryAckCommand;
import org.infinispan.commands.write.PrimaryMultiKeyAckCommand;
import org.infinispan.commands.write.PutKeyValueCommand; import org.infinispan.commands.write.PutKeyValueCommand;
import org.infinispan.commands.write.PutMapCommand; import org.infinispan.commands.write.PutMapCommand;
import org.infinispan.commands.write.RemoveCommand; import org.infinispan.commands.write.RemoveCommand;
Expand Down Expand Up @@ -531,15 +529,9 @@ public void initializeReplicableCommand(ReplicableCommand c, boolean isRemote) {
BackupWriteRcpCommand bwc = (BackupWriteRcpCommand) c; BackupWriteRcpCommand bwc = (BackupWriteRcpCommand) c;
bwc.init(icf, interceptorChain, notifier); bwc.init(icf, interceptorChain, notifier);
break; break;
case PrimaryAckCommand.COMMAND_ID:
((PrimaryAckCommand) c).setCommandAckCollector(commandAckCollector);
break;
case BackupMultiKeyAckCommand.COMMAND_ID: case BackupMultiKeyAckCommand.COMMAND_ID:
((BackupMultiKeyAckCommand) c).setCommandAckCollector(commandAckCollector); ((BackupMultiKeyAckCommand) c).setCommandAckCollector(commandAckCollector);
break; break;
case PrimaryMultiKeyAckCommand.COMMAND_ID:
((PrimaryMultiKeyAckCommand) c).setCommandAckCollector(commandAckCollector);
break;
case ExceptionAckCommand.COMMAND_ID: case ExceptionAckCommand.COMMAND_ID:
((ExceptionAckCommand) c).setCommandAckCollector(commandAckCollector); ((ExceptionAckCommand) c).setCommandAckCollector(commandAckCollector);
break; break;
Expand Down Expand Up @@ -763,21 +755,11 @@ public BackupAckCommand buildBackupAckCommand(long id, int topologyId) {
return new BackupAckCommand(cacheName, id, topologyId); return new BackupAckCommand(cacheName, id, topologyId);
} }


@Override
public PrimaryAckCommand buildPrimaryAckCommand() {
return new PrimaryAckCommand(cacheName);
}

@Override @Override
public BackupMultiKeyAckCommand buildBackupMultiKeyAckCommand(long id, int segment, int topologyId) { public BackupMultiKeyAckCommand buildBackupMultiKeyAckCommand(long id, int segment, int topologyId) {
return new BackupMultiKeyAckCommand(cacheName, id, segment, topologyId); return new BackupMultiKeyAckCommand(cacheName, id, segment, topologyId);
} }


@Override
public PrimaryMultiKeyAckCommand buildPrimaryMultiKeyAckCommand(long id, int topologyId) {
return new PrimaryMultiKeyAckCommand(cacheName, id, topologyId);
}

@Override @Override
public ExceptionAckCommand buildExceptionAckCommand(long id, Throwable throwable, int topologyId) { public ExceptionAckCommand buildExceptionAckCommand(long id, Throwable throwable, int topologyId) {
return new ExceptionAckCommand(cacheName, id, throwable, topologyId); return new ExceptionAckCommand(cacheName, id, throwable, topologyId);
Expand Down
Expand Up @@ -3,12 +3,10 @@
import java.io.IOException; import java.io.IOException;
import java.io.ObjectInput; import java.io.ObjectInput;
import java.io.ObjectOutput; import java.io.ObjectOutput;
import java.util.concurrent.CompletableFuture;


import org.infinispan.commands.remote.BaseRpcCommand; import org.infinispan.commands.remote.BaseRpcCommand;
import org.infinispan.util.ByteString; import org.infinispan.util.ByteString;
import org.infinispan.util.concurrent.CommandAckCollector; import org.infinispan.util.concurrent.CommandAckCollector;
import org.infinispan.util.concurrent.CompletableFutures;


/** /**
* A command that represents an acknowledge sent by a backup owner to the originator. * A command that represents an acknowledge sent by a backup owner to the originator.
Expand Down Expand Up @@ -39,10 +37,8 @@ public BackupAckCommand(ByteString cacheName, long id, int topologyId) {
this.topologyId = topologyId; this.topologyId = topologyId;
} }


@Override public void ack() {
public CompletableFuture<Object> invokeAsync() throws Throwable {
commandAckCollector.backupAck(id, getOrigin(), topologyId); commandAckCollector.backupAck(id, getOrigin(), topologyId);
return CompletableFutures.completedNull();
} }


@Override @Override
Expand Down
Expand Up @@ -3,12 +3,10 @@
import java.io.IOException; import java.io.IOException;
import java.io.ObjectInput; import java.io.ObjectInput;
import java.io.ObjectOutput; import java.io.ObjectOutput;
import java.util.concurrent.CompletableFuture;


import org.infinispan.commands.remote.BaseRpcCommand; import org.infinispan.commands.remote.BaseRpcCommand;
import org.infinispan.util.ByteString; import org.infinispan.util.ByteString;
import org.infinispan.util.concurrent.CommandAckCollector; import org.infinispan.util.concurrent.CommandAckCollector;
import org.infinispan.util.concurrent.CompletableFutures;


/** /**
* A command that represents an acknowledge sent by a backup owner to the originator. * A command that represents an acknowledge sent by a backup owner to the originator.
Expand Down Expand Up @@ -43,10 +41,8 @@ public BackupMultiKeyAckCommand(ByteString cacheName, long id, int segment,
this.topologyId = topologyId; this.topologyId = topologyId;
} }


@Override public void ack() {
public CompletableFuture<Object> invokeAsync() throws Throwable {
commandAckCollector.multiKeyBackupAck(id, getOrigin(), segment, topologyId); commandAckCollector.multiKeyBackupAck(id, getOrigin(), segment, topologyId);
return CompletableFutures.completedNull();
} }


@Override @Override
Expand Down
Expand Up @@ -27,15 +27,4 @@ default void initBackupWriteRcpCommand(BackupWriteRcpCommand command) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }


/**
* Initializes the primary owner acknowledge with the return value, the {@link CommandInvocationId} and the topology
* id.
*
* @param command the {@link PrimaryAckCommand} to initialize.
* @param localReturnValue the local return value.
*/
default void initPrimaryAck(PrimaryAckCommand command, Object localReturnValue) {
throw new UnsupportedOperationException();
}

} }
Expand Up @@ -3,12 +3,10 @@
import java.io.IOException; import java.io.IOException;
import java.io.ObjectInput; import java.io.ObjectInput;
import java.io.ObjectOutput; import java.io.ObjectOutput;
import java.util.concurrent.CompletableFuture;


import org.infinispan.commands.remote.BaseRpcCommand; import org.infinispan.commands.remote.BaseRpcCommand;
import org.infinispan.util.ByteString; import org.infinispan.util.ByteString;
import org.infinispan.util.concurrent.CommandAckCollector; import org.infinispan.util.concurrent.CommandAckCollector;
import org.infinispan.util.concurrent.CompletableFutures;


/** /**
* A command that represents an exception acknowledge sent by any owner. * A command that represents an exception acknowledge sent by any owner.
Expand Down Expand Up @@ -41,10 +39,8 @@ public ExceptionAckCommand(ByteString cacheName, long id, Throwable throwable, i
this.topologyId = topologyId; this.topologyId = topologyId;
} }


@Override public void ack() {
public CompletableFuture<Object> invokeAsync() throws Throwable {
commandAckCollector.completeExceptionally(id, throwable, topologyId); commandAckCollector.completeExceptionally(id, throwable, topologyId);
return CompletableFutures.completedNull();
} }


@Override @Override
Expand Down

This file was deleted.

0 comments on commit 2be8301

Please sign in to comment.