From 00d4298065db08943a4fba52801b27303ff61cb0 Mon Sep 17 00:00:00 2001 From: Robin Bygrave Date: Thu, 21 Apr 2016 12:33:06 +1200 Subject: [PATCH] #656 - Remove remoteInsert(), remoteUpdate() remoteDelete() methods from BeanPersistListener --- .../event/AbstractBeanPersistListener.java | 29 ------------------- .../ebean/event/BeanPersistListener.java | 24 --------------- .../server/core/PersistRequestBean.java | 7 ++--- .../deploy/ChainedBeanPersistListener.java | 19 ------------ .../server/transaction/BeanPersistIds.java | 20 +------------ 5 files changed, 4 insertions(+), 95 deletions(-) diff --git a/src/main/java/com/avaje/ebean/event/AbstractBeanPersistListener.java b/src/main/java/com/avaje/ebean/event/AbstractBeanPersistListener.java index 000d39b1f..4fc999d34 100644 --- a/src/main/java/com/avaje/ebean/event/AbstractBeanPersistListener.java +++ b/src/main/java/com/avaje/ebean/event/AbstractBeanPersistListener.java @@ -46,33 +46,4 @@ public abstract class AbstractBeanPersistListener implements BeanPersistListener return false; } - /** - * Notify that a bean was inserted on another node of the cluster. - * - * @param id the id value of the inserted bean - */ - @Override - public void remoteInsert(Object id) { - // do nothing - } - - /** - * Notify that a bean was updated on another node of the cluster. - * - * @param id the id value of the updated bean. - */ - @Override - public void remoteUpdate(Object id) { - // do nothing - } - - /** - * Notify that a bean was deleted on another node of the cluster. - * - * @param id the id value of the deleted bean. - */ - @Override - public void remoteDelete(Object id) { - // do nothing - } } diff --git a/src/main/java/com/avaje/ebean/event/BeanPersistListener.java b/src/main/java/com/avaje/ebean/event/BeanPersistListener.java index 84f923c46..a4004a0dc 100644 --- a/src/main/java/com/avaje/ebean/event/BeanPersistListener.java +++ b/src/main/java/com/avaje/ebean/event/BeanPersistListener.java @@ -74,28 +74,4 @@ public interface BeanPersistListener { */ boolean deleted(Object bean); - /** - * Notify that a bean was inserted on another node of the cluster. - * - * @param id - * the id value of the inserted bean - */ - void remoteInsert(Object id); - - /** - * Notify that a bean was updated on another node of the cluster. - * - * @param id - * the id value of the updated bean. - */ - void remoteUpdate(Object id); - - /** - * Notify that a bean was deleted on another node of the cluster. - * - * @param id - * the id value of the deleted bean. - */ - void remoteDelete(Object id); - } diff --git a/src/main/java/com/avaje/ebeaninternal/server/core/PersistRequestBean.java b/src/main/java/com/avaje/ebeaninternal/server/core/PersistRequestBean.java index 31589cb4e..14969340f 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/core/PersistRequestBean.java +++ b/src/main/java/com/avaje/ebeaninternal/server/core/PersistRequestBean.java @@ -304,7 +304,7 @@ public final class PersistRequestBean extends PersistRequest implements BeanP /** * Set the cache notify status. */ - public void setNotifyCache() { + private void setNotifyCache() { this.notifyCache = beanDescriptor.isCacheNotify(publish); } @@ -327,7 +327,7 @@ public final class PersistRequestBean extends PersistRequest implements BeanP } /** - * Notify/Update the local L2 cache after the transaction has successfully committed. + * Collect L2 cache changes to be applied after the transaction has successfully committed. */ public void notifyCache(CacheChangeSet changeSet) { if (notifyCache) { @@ -340,7 +340,6 @@ public final class PersistRequestBean extends PersistRequest implements BeanP break; case DELETE: case SOFT_DELETE: - // Bean deleted from cache early via postDelete() beanDescriptor.cacheHandleDelete(idValue, this, changeSet); break; default: @@ -949,7 +948,7 @@ public final class PersistRequestBean extends PersistRequest implements BeanP * Takes into account transaction setting and JDBC batch. *

*/ - public boolean determineUpdateAllLoadedProperties() { + private boolean determineUpdateAllLoadedProperties() { Boolean txnUpdateAll = transaction.isUpdateAllLoadedProperties(); if (txnUpdateAll != null) { diff --git a/src/main/java/com/avaje/ebeaninternal/server/deploy/ChainedBeanPersistListener.java b/src/main/java/com/avaje/ebeaninternal/server/deploy/ChainedBeanPersistListener.java index 71930ceec..c7d111c09 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/deploy/ChainedBeanPersistListener.java +++ b/src/main/java/com/avaje/ebeaninternal/server/deploy/ChainedBeanPersistListener.java @@ -83,7 +83,6 @@ public class ChainedBeanPersistListener implements BeanPersistListener { } } - public boolean deleted(Object bean) { boolean notifyCluster = false; for (int i = 0; i < chain.length; i++) { @@ -104,24 +103,6 @@ public class ChainedBeanPersistListener implements BeanPersistListener { return notifyCluster; } - public void remoteDelete(Object id) { - for (int i = 0; i < chain.length; i++) { - chain[i].remoteDelete(id); - } - } - - public void remoteInsert(Object id) { - for (int i = 0; i < chain.length; i++) { - chain[i].remoteInsert(id); - } - } - - public void remoteUpdate(Object id) { - for (int i = 0; i < chain.length; i++) { - chain[i].remoteUpdate(id); - } - } - public boolean updated(Object bean, Set updatedProperties) { boolean notifyCluster = false; for (int i = 0; i < chain.length; i++) { diff --git a/src/main/java/com/avaje/ebeaninternal/server/transaction/BeanPersistIds.java b/src/main/java/com/avaje/ebeaninternal/server/transaction/BeanPersistIds.java index 88aa79c22..9c888394b 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/transaction/BeanPersistIds.java +++ b/src/main/java/com/avaje/ebeaninternal/server/transaction/BeanPersistIds.java @@ -1,6 +1,5 @@ package com.avaje.ebeaninternal.server.transaction; -import com.avaje.ebean.event.BeanPersistListener; import com.avaje.ebeaninternal.api.SpiEbeanServer; import com.avaje.ebeaninternal.server.cluster.BinaryMessage; import com.avaje.ebeaninternal.server.cluster.BinaryMessageList; @@ -215,41 +214,24 @@ public class BeanPersistIds { } /** - * Notify the cache and local BeanPersistListener of this event that came - * from another server in the cluster. + * Notify the cache of this event that came from another server in the cluster. */ void notifyCacheAndListener() { - BeanPersistListener listener = beanDescriptor.getPersistListener(); - // any change invalidates the query cache beanDescriptor.queryCacheClear(); - if (insertIds != null) { - if (listener != null) { - for (int i = 0; i < insertIds.size(); i++) { - listener.remoteInsert(insertIds.get(i)); - } - } - } if (updateIds != null) { for (int i = 0; i < updateIds.size(); i++) { Object id = updateIds.get(i); beanDescriptor.cacheHandleDeleteById(id); - if (listener != null) { - listener.remoteUpdate(id); - } } } if (deleteIds != null) { for (int i = 0; i < deleteIds.size(); i++) { Object id = deleteIds.get(i); beanDescriptor.cacheHandleDeleteById(id); - if (listener != null) { - listener.remoteDelete(id); - } } } - } }