Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2009-10-20 12:40:32 +0000
committerEike Stepper2009-10-20 12:40:32 +0000
commita6c9dbf092072d10d44fa522414d7cffac9172d1 (patch)
treed9f936af45b2bb4f8f0383785ca98eb96f7eea50 /plugins/org.eclipse.net4j.buddies.common
parentc0237b4d53ce950b0312327916143015b9d9659a (diff)
downloadcdo-a6c9dbf092072d10d44fa522414d7cffac9172d1.tar.gz
cdo-a6c9dbf092072d10d44fa522414d7cffac9172d1.tar.xz
cdo-a6c9dbf092072d10d44fa522414d7cffac9172d1.zip
[292736] Optimize IListener management and notification
https://bugs.eclipse.org/bugs/show_bug.cgi?id=292736
Diffstat (limited to 'plugins/org.eclipse.net4j.buddies.common')
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Buddy.java7
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/BuddyContainer.java15
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Collaboration.java8
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/CollaborationContainer.java17
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/MembershipContainer.java15
5 files changed, 51 insertions, 11 deletions
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Buddy.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Buddy.java
index 9e57211420..45d107502f 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Buddy.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Buddy.java
@@ -18,6 +18,7 @@ import org.eclipse.net4j.buddies.common.ISession;
import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.event.Event;
import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.PlatformObject;
@@ -67,7 +68,11 @@ public abstract class Buddy extends MembershipContainer implements IBuddy
{
IEvent event = new BuddyStateEvent(this.state, state);
this.state = state;
- fireEvent(event);
+ IListener[] listeners = getListeners();
+ if (listeners != null)
+ {
+ fireEvent(event, listeners);
+ }
}
}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/BuddyContainer.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/BuddyContainer.java
index 4e640b6379..09e6d3d488 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/BuddyContainer.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/BuddyContainer.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Eike Stepper - initial API and implementation
*/
@@ -55,7 +55,12 @@ public class BuddyContainer extends Lifecycle implements IBuddyContainer, IListe
if (!buddies.containsKey(userID))
{
buddies.put(userID, buddy);
- fireEvent(new SingleDeltaContainerEvent<IBuddy>(this, buddy, IContainerDelta.Kind.ADDED));
+ IListener[] listeners = getListeners();
+ if (listeners != null)
+ {
+ fireEvent(new SingleDeltaContainerEvent<IBuddy>(this, buddy, IContainerDelta.Kind.ADDED), listeners);
+ }
+
buddy.addListener(this);
return true;
}
@@ -75,7 +80,11 @@ public class BuddyContainer extends Lifecycle implements IBuddyContainer, IListe
if (buddy != null)
{
buddy.removeListener(this);
- fireEvent(new SingleDeltaContainerEvent<IBuddy>(this, buddy, IContainerDelta.Kind.REMOVED));
+ IListener[] listeners = getListeners();
+ if (listeners != null)
+ {
+ fireEvent(new SingleDeltaContainerEvent<IBuddy>(this, buddy, IContainerDelta.Kind.REMOVED), listeners);
+ }
}
return buddy;
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Collaboration.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Collaboration.java
index 4f1d6fef51..dffc5d7c52 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Collaboration.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Collaboration.java
@@ -22,6 +22,7 @@ import org.eclipse.net4j.signal.SignalProtocol;
import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.event.Event;
import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.core.runtime.Platform;
@@ -149,7 +150,12 @@ public class Collaboration extends MembershipContainer implements ICollaboration
if (!facilities.containsKey(type))
{
facilities.put(type, facility);
- fireEvent(new FacilityInstalledEvent(this, facility, remote));
+ IListener[] listeners = getListeners();
+ if (listeners != null)
+ {
+ fireEvent(new FacilityInstalledEvent(this, facility, remote), listeners);
+ }
+
facility.addListener(this);
return true;
}
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/CollaborationContainer.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/CollaborationContainer.java
index db00d9052c..707a18cdf2 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/CollaborationContainer.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/CollaborationContainer.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Eike Stepper - initial API and implementation
*/
@@ -58,7 +58,13 @@ public class CollaborationContainer extends Lifecycle implements ICollaborationC
}
}
- fireEvent(new SingleDeltaContainerEvent<ICollaboration>(this, collaboration, IContainerDelta.Kind.ADDED));
+ IListener[] listeners = getListeners();
+ if (listeners != null)
+ {
+ fireEvent(new SingleDeltaContainerEvent<ICollaboration>(this, collaboration, IContainerDelta.Kind.ADDED),
+ listeners);
+ }
+
collaboration.addListener(this);
}
@@ -73,7 +79,12 @@ public class CollaborationContainer extends Lifecycle implements ICollaborationC
if (collaboration != null)
{
collaboration.removeListener(this);
- fireEvent(new SingleDeltaContainerEvent<ICollaboration>(this, collaboration, IContainerDelta.Kind.REMOVED));
+ IListener[] listeners = getListeners();
+ if (listeners != null)
+ {
+ fireEvent(new SingleDeltaContainerEvent<ICollaboration>(this, collaboration, IContainerDelta.Kind.REMOVED),
+ listeners);
+ }
}
return collaboration;
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/MembershipContainer.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/MembershipContainer.java
index 9a25277e9c..1ca091b7f3 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/MembershipContainer.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/MembershipContainer.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Eike Stepper - initial API and implementation
*/
@@ -40,7 +40,12 @@ public class MembershipContainer extends Lifecycle implements IMembershipContain
{
if (memberships.putIfAbsent(membership, membership) == null)
{
- fireEvent(new SingleDeltaContainerEvent<IMembership>(this, membership, IContainerDelta.Kind.ADDED));
+ IListener[] listeners = getListeners();
+ if (listeners != null)
+ {
+ fireEvent(new SingleDeltaContainerEvent<IMembership>(this, membership, IContainerDelta.Kind.ADDED), listeners);
+ }
+
membership.addListener(this);
}
}
@@ -61,7 +66,11 @@ public class MembershipContainer extends Lifecycle implements IMembershipContain
if (membership != null)
{
membership.removeListener(this);
- fireEvent(new SingleDeltaContainerEvent<IMembership>(this, membership, IContainerDelta.Kind.REMOVED));
+ IListener[] listeners = getListeners();
+ if (listeners != null)
+ {
+ fireEvent(new SingleDeltaContainerEvent<IMembership>(this, membership, IContainerDelta.Kind.REMOVED), listeners);
+ }
}
return membership;

Back to the top