From 6259de5991b9c11f6d46807d88f51830473adb13 Mon Sep 17 00:00:00 2001 From: jsimomaa Date: Tue, 31 Oct 2017 08:14:30 +0200 Subject: [PATCH] More DB ListenerAdapter abstract to force isDisposed implementation This forces the user of the adapter to still handle the life-cycle of the listener, which should never be neglected. refs #7581 Change-Id: I1d30f6ed8b1a3d861185b7ea36ecbab38f07171a --- .../common/procedure/adapter/AsyncMultiListenerAdapter.java | 6 ++---- .../common/procedure/adapter/AsyncSetListenerAdapter.java | 6 ++---- .../db/common/procedure/adapter/MultiListenerAdapter.java | 6 ++---- .../db/common/procedure/adapter/SetListenerAdapter.java | 6 ++---- .../common/procedure/adapter/SyncMultiListenerAdapter.java | 6 ++---- .../db/common/procedure/adapter/SyncSetListenerAdapter.java | 6 ++---- 6 files changed, 12 insertions(+), 24 deletions(-) diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/adapter/AsyncMultiListenerAdapter.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/adapter/AsyncMultiListenerAdapter.java index 29c039ca0..e7cd7d6c2 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/adapter/AsyncMultiListenerAdapter.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/adapter/AsyncMultiListenerAdapter.java @@ -14,7 +14,7 @@ package org.simantics.db.common.procedure.adapter; import org.simantics.db.AsyncReadGraph; import org.simantics.db.procedure.AsyncMultiListener; -public class AsyncMultiListenerAdapter implements AsyncMultiListener { +public abstract class AsyncMultiListenerAdapter implements AsyncMultiListener { @Override public void exception(AsyncReadGraph graph, Throwable t) { @@ -29,8 +29,6 @@ public class AsyncMultiListenerAdapter implements AsyncMultiListener { } @Override - public boolean isDisposed() { - return false; - } + public abstract boolean isDisposed(); } diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/adapter/AsyncSetListenerAdapter.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/adapter/AsyncSetListenerAdapter.java index 2e8fcf459..44bbfc02a 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/adapter/AsyncSetListenerAdapter.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/adapter/AsyncSetListenerAdapter.java @@ -14,7 +14,7 @@ package org.simantics.db.common.procedure.adapter; import org.simantics.db.AsyncReadGraph; import org.simantics.db.procedure.AsyncSetListener; -public class AsyncSetListenerAdapter implements AsyncSetListener { +public abstract class AsyncSetListenerAdapter implements AsyncSetListener { @Override public void exception(AsyncReadGraph graph, Throwable t) { @@ -29,8 +29,6 @@ public class AsyncSetListenerAdapter implements AsyncSetListener { } @Override - public boolean isDisposed() { - return false; - } + public abstract boolean isDisposed(); } diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/adapter/MultiListenerAdapter.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/adapter/MultiListenerAdapter.java index cb7d93e32..3dc1a495a 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/adapter/MultiListenerAdapter.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/adapter/MultiListenerAdapter.java @@ -13,7 +13,7 @@ package org.simantics.db.common.procedure.adapter; import org.simantics.db.procedure.MultiListener; -public class MultiListenerAdapter implements MultiListener { +public abstract class MultiListenerAdapter implements MultiListener { @Override public void execute(Result result) { @@ -28,8 +28,6 @@ public class MultiListenerAdapter implements MultiListener { } @Override - public boolean isDisposed() { - return false; - } + public abstract boolean isDisposed(); } diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/adapter/SetListenerAdapter.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/adapter/SetListenerAdapter.java index 79daa2ebd..2e3069271 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/adapter/SetListenerAdapter.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/adapter/SetListenerAdapter.java @@ -13,7 +13,7 @@ package org.simantics.db.common.procedure.adapter; import org.simantics.db.procedure.SetListener; -public class SetListenerAdapter implements SetListener { +public abstract class SetListenerAdapter implements SetListener { @Override public void exception(Throwable t) { @@ -28,8 +28,6 @@ public class SetListenerAdapter implements SetListener { } @Override - public boolean isDisposed() { - return false; - } + public abstract boolean isDisposed(); } diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/adapter/SyncMultiListenerAdapter.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/adapter/SyncMultiListenerAdapter.java index a86861349..53903b61e 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/adapter/SyncMultiListenerAdapter.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/adapter/SyncMultiListenerAdapter.java @@ -14,7 +14,7 @@ package org.simantics.db.common.procedure.adapter; import org.simantics.db.ReadGraph; import org.simantics.db.procedure.SyncMultiListener; -public class SyncMultiListenerAdapter implements SyncMultiListener { +public abstract class SyncMultiListenerAdapter implements SyncMultiListener { @Override public void exception(ReadGraph graph, Throwable t) { @@ -29,8 +29,6 @@ public class SyncMultiListenerAdapter implements SyncMultiListener { } @Override - public boolean isDisposed() { - return false; - } + public abstract boolean isDisposed(); } diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/adapter/SyncSetListenerAdapter.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/adapter/SyncSetListenerAdapter.java index da2febfa1..3d61e5bfa 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/adapter/SyncSetListenerAdapter.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/adapter/SyncSetListenerAdapter.java @@ -14,7 +14,7 @@ package org.simantics.db.common.procedure.adapter; import org.simantics.db.ReadGraph; import org.simantics.db.procedure.SyncSetListener; -public class SyncSetListenerAdapter implements SyncSetListener { +public abstract class SyncSetListenerAdapter implements SyncSetListener { @Override public void exception(ReadGraph graph, Throwable t) { @@ -29,8 +29,6 @@ public class SyncSetListenerAdapter implements SyncSetListener { } @Override - public boolean isDisposed() { - return false; - } + public abstract boolean isDisposed(); } -- 2.47.1