Skip to content

Commit

Permalink
GEODE-6339: Revert TransactionEvent Generification
Browse files Browse the repository at this point in the history
  • Loading branch information
demery-pivotal authored and kirklund committed Feb 1, 2019
1 parent 5ee6fdc commit 657458c
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 142 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1774,8 +1774,8 @@ abstract class txCallback {
protected boolean isAccessor;
protected Exception ex = null;

protected void verify(TransactionEvent<Object, Object> txEvent) {
for (CacheEvent<Object, Object> e : txEvent.getEvents()) {
protected void verify(TransactionEvent txEvent) {
for (CacheEvent<?, ?> e : txEvent.getEvents()) {
verifyOrigin(e);
verifyPutAll(e);
}
Expand All @@ -1789,11 +1789,11 @@ private void verifyOrigin(CacheEvent event) {
}
}

private void verifyPutAll(CacheEvent<Object, Object> p_event) {
private void verifyPutAll(CacheEvent<?, ?> p_event) {
if (!(p_event instanceof EntryEvent)) {
return;
}
EntryEvent<Object, Object> event = (EntryEvent<Object, Object>) p_event;
EntryEvent<?, ?> event = (EntryEvent<?, ?>) p_event;
CustId knownCustId = new CustId(1);
OrderId knownOrderId = new OrderId(2, knownCustId);
if (event.getKey().equals(knownOrderId)) {
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
* @see EntryEvent
* @since GemFire 4.0
*/
public interface TransactionEvent<K, V> {
public interface TransactionEvent {

/**
* Gets the <code>TransactionId</code> associated this TransactionEvent.
Expand All @@ -63,7 +63,7 @@ public interface TransactionEvent<K, V> {
* operation performed by this transaction.
* @since GemFire 5.0
*/
List<CacheEvent<K, V>> getEvents();
List<CacheEvent<?, ?>> getEvents();

/**
* Gets the Cache for this transaction event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,23 @@
* @see CacheTransactionManager#getListener
* @since GemFire 4.0
*/
public interface TransactionListener<K, V> extends CacheCallback {
public interface TransactionListener extends CacheCallback {

/**
* Called after a successful commit of a transaction.
*
* @param event the TransactionEvent
* @see CacheTransactionManager#commit
*/
void afterCommit(TransactionEvent<K, V> event);
void afterCommit(TransactionEvent event);

/**
* Called after an unsuccessful commit operation.
*
* @param event the TransactionEvent
* @see CacheTransactionManager#commit
*/
void afterFailedCommit(TransactionEvent<K, V> event);
void afterFailedCommit(TransactionEvent event);

/**
* Called after an explicit rollback of a transaction.
Expand All @@ -64,5 +64,5 @@ public interface TransactionListener<K, V> extends CacheCallback {
* @see CacheTransactionManager#rollback
* @see CacheTransactionManager#commit
*/
void afterRollback(TransactionEvent<K, V> event);
void afterRollback(TransactionEvent event);
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.junit.Test;
Expand Down Expand Up @@ -513,7 +512,7 @@ abstract static class txCallback {
protected Exception ex = null;

protected void verify(TransactionEvent txEvent) {
for (CacheEvent e : (List<CacheEvent>) txEvent.getEvents()) {
for (CacheEvent<?, ?> e : txEvent.getEvents()) {
verifyOrigin(e);
verifyPutAll(e);
}
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class TxEventTestUtil {
*
* @return list of entry create events from the given cache events
*/
public static <K, V> List<EntryEvent<K, V>> getCreateEvents(List<CacheEvent<K, V>> cacheEvents) {
public static List<EntryEvent<?, ?>> getCreateEvents(List<CacheEvent<?, ?>> cacheEvents) {
return getEntryEventsWithOperation(cacheEvents, Operation::isCreate);
}

Expand All @@ -44,7 +44,7 @@ public static <K, V> List<EntryEvent<K, V>> getCreateEvents(List<CacheEvent<K, V
*
* @return list of entry update events from the given cache events
*/
public static <K, V> List<EntryEvent<K, V>> getPutEvents(List<CacheEvent<K, V>> cacheEvents) {
public static List<EntryEvent<?, ?>> getPutEvents(List<CacheEvent<?, ?>> cacheEvents) {
return getEntryEventsWithOperation(cacheEvents, Operation::isUpdate);
}

Expand All @@ -53,8 +53,8 @@ public static <K, V> List<EntryEvent<K, V>> getPutEvents(List<CacheEvent<K, V>>
*
* @return list of entry invalidate events from the given cache events
*/
public static <K, V> List<EntryEvent<K, V>> getInvalidateEvents(
List<CacheEvent<K, V>> cacheEvents) {
public static List<EntryEvent<?, ?>> getInvalidateEvents(
List<CacheEvent<?, ?>> cacheEvents) {
return getEntryEventsWithOperation(cacheEvents, Operation::isInvalidate);
}

Expand All @@ -63,7 +63,7 @@ public static <K, V> List<EntryEvent<K, V>> getInvalidateEvents(
*
* @return list of entry destroy events from the given cache events
*/
public static <K, V> List<EntryEvent<K, V>> getDestroyEvents(List<CacheEvent<K, V>> cacheEvents) {
public static List<EntryEvent<?, ?>> getDestroyEvents(List<CacheEvent<?, ?>> cacheEvents) {
return getEntryEventsWithOperation(cacheEvents, Operation::isDestroy);
}

Expand All @@ -77,8 +77,8 @@ public static <K, V> List<EntryEvent<K, V>> getDestroyEvents(List<CacheEvent<K,
* @throws ClassCastException if the predicate matches the operation of an event that is not an
* {@code EntryEvent}
*/
public static <K, V> List<EntryEvent<K, V>> getEntryEventsWithOperation(
List<CacheEvent<K, V>> cacheEvents,
public static List<EntryEvent<?, ?>> getEntryEventsWithOperation(
List<CacheEvent<?, ?>> cacheEvents,
Predicate<Operation> operationPredicate) {
return getEntryEventsMatching(cacheEvents, e -> operationPredicate.test(e.getOperation()));
}
Expand All @@ -91,15 +91,15 @@ public static <K, V> List<EntryEvent<K, V>> getEntryEventsWithOperation(
* @return list of entry events that match the predicate
* @throws ClassCastException if the predicate matches an event that is not an {@code EntryEvent}
*/
public static <K, V> List<EntryEvent<K, V>> getEntryEventsMatching(
List<CacheEvent<K, V>> cacheEvents,
Predicate<? super EntryEvent<K, V>> predicate) {
public static List<EntryEvent<?, ?>> getEntryEventsMatching(
List<CacheEvent<?, ?>> cacheEvents,
Predicate<? super EntryEvent<?, ?>> predicate) {
if (isNull(cacheEvents)) {
return Collections.emptyList();
}
return cacheEvents.stream()
.filter(EntryEvent.class::isInstance)
.map(cacheEvent -> (EntryEvent<K, V>) cacheEvent)
.map(cacheEvent -> (EntryEvent<?, ?>) cacheEvent)
.filter(predicate)
.collect(Collectors.toList());
}
Expand Down

0 comments on commit 657458c

Please sign in to comment.