#656 - Remove remoteInsert(), remoteUpdate() remoteDelete() methods from BeanPersistListener

This commit is contained in:
Robin Bygrave
2016-04-21 12:33:06 +12:00
parent 4eb1aded2d
commit 00d4298065
5 changed files with 4 additions and 95 deletions
@@ -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
}
}
@@ -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);
}
@@ -304,7 +304,7 @@ public final class PersistRequestBean<T> 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<T> 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<T> 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<T> extends PersistRequest implements BeanP
* Takes into account transaction setting and JDBC batch.
* </p>
*/
public boolean determineUpdateAllLoadedProperties() {
private boolean determineUpdateAllLoadedProperties() {
Boolean txnUpdateAll = transaction.isUpdateAllLoadedProperties();
if (txnUpdateAll != null) {
@@ -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<String> updatedProperties) {
boolean notifyCluster = false;
for (int i = 0; i < chain.length; i++) {
@@ -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);
}
}
}
}
}