diff --git a/build/build.xml b/build/build.xml index 1a92ddb80..e7766b640 100644 --- a/build/build.xml +++ b/build/build.xml @@ -351,6 +351,7 @@ migrating + finalizers diff --git a/source/org/jivesoftware/smackx/MessageEventManager.java b/source/org/jivesoftware/smackx/MessageEventManager.java index 15017b85c..4409c11e5 100644 --- a/source/org/jivesoftware/smackx/MessageEventManager.java +++ b/source/org/jivesoftware/smackx/MessageEventManager.java @@ -22,12 +22,17 @@ package org.jivesoftware.smackx; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.util.*; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; -import org.jivesoftware.smack.*; -import org.jivesoftware.smack.filter.*; -import org.jivesoftware.smack.packet.*; -import org.jivesoftware.smackx.packet.*; +import org.jivesoftware.smack.PacketListener; +import org.jivesoftware.smack.XMPPConnection; +import org.jivesoftware.smack.filter.PacketExtensionFilter; +import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.packet.Message; +import org.jivesoftware.smack.packet.Packet; +import org.jivesoftware.smackx.packet.MessageEvent; /** * Manages message events requests and notifications. A MessageEventManager provides a high @@ -38,8 +43,8 @@ import org.jivesoftware.smackx.packet.*; */ public class MessageEventManager { - private List messageEventNotificationListeners = new ArrayList(); - private List messageEventRequestListeners = new ArrayList(); + private List messageEventNotificationListeners = new ArrayList(); + private List messageEventRequestListeners = new ArrayList(); private XMPPConnection con; @@ -298,7 +303,8 @@ public class MessageEventManager { } } - public void finalize() { + protected void finalize() throws Throwable { destroy(); + super.finalize(); } } \ No newline at end of file diff --git a/source/org/jivesoftware/smackx/PEPManager.java b/source/org/jivesoftware/smackx/PEPManager.java index a5b1d399e..c839fb48a 100644 --- a/source/org/jivesoftware/smackx/PEPManager.java +++ b/source/org/jivesoftware/smackx/PEPManager.java @@ -151,7 +151,8 @@ public class PEPManager { } - public void finalize() { + protected void finalize() throws Throwable { destroy(); + super.finalize(); } } \ No newline at end of file diff --git a/source/org/jivesoftware/smackx/RosterExchangeManager.java b/source/org/jivesoftware/smackx/RosterExchangeManager.java index 90809f14f..d3960ae01 100644 --- a/source/org/jivesoftware/smackx/RosterExchangeManager.java +++ b/source/org/jivesoftware/smackx/RosterExchangeManager.java @@ -20,11 +20,19 @@ package org.jivesoftware.smackx; -import java.util.*; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; -import org.jivesoftware.smack.*; -import org.jivesoftware.smack.filter.*; -import org.jivesoftware.smack.packet.*; +import org.jivesoftware.smack.PacketListener; +import org.jivesoftware.smack.Roster; +import org.jivesoftware.smack.RosterEntry; +import org.jivesoftware.smack.RosterGroup; +import org.jivesoftware.smack.XMPPConnection; +import org.jivesoftware.smack.filter.PacketExtensionFilter; +import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.packet.Message; +import org.jivesoftware.smack.packet.Packet; import org.jivesoftware.smackx.packet.RosterExchange; /** @@ -38,7 +46,7 @@ import org.jivesoftware.smackx.packet.RosterExchange; */ public class RosterExchangeManager { - private List rosterExchangeListeners = new ArrayList(); + private List rosterExchangeListeners = new ArrayList(); private XMPPConnection con; @@ -172,7 +180,8 @@ public class RosterExchangeManager { con.removePacketListener(packetListener); } - public void finalize() { + protected void finalize() throws Throwable { destroy(); + super.finalize(); } } \ No newline at end of file diff --git a/source/org/jivesoftware/smackx/muc/MultiUserChat.java b/source/org/jivesoftware/smackx/muc/MultiUserChat.java index 9f75c9c80..11875fc35 100644 --- a/source/org/jivesoftware/smackx/muc/MultiUserChat.java +++ b/source/org/jivesoftware/smackx/muc/MultiUserChat.java @@ -20,20 +20,50 @@ package org.jivesoftware.smackx.muc; -import org.jivesoftware.smack.*; -import org.jivesoftware.smack.filter.*; -import org.jivesoftware.smack.packet.*; -import org.jivesoftware.smackx.Form; -import org.jivesoftware.smackx.NodeInformationProvider; -import org.jivesoftware.smackx.ServiceDiscoveryManager; -import org.jivesoftware.smackx.packet.*; - import java.lang.ref.WeakReference; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.WeakHashMap; import java.util.concurrent.ConcurrentHashMap; +import org.jivesoftware.smack.Chat; +import org.jivesoftware.smack.ConnectionCreationListener; +import org.jivesoftware.smack.ConnectionListener; +import org.jivesoftware.smack.MessageListener; +import org.jivesoftware.smack.PacketCollector; +import org.jivesoftware.smack.PacketInterceptor; +import org.jivesoftware.smack.PacketListener; +import org.jivesoftware.smack.SmackConfiguration; +import org.jivesoftware.smack.XMPPConnection; +import org.jivesoftware.smack.XMPPException; +import org.jivesoftware.smack.filter.AndFilter; +import org.jivesoftware.smack.filter.FromMatchesFilter; +import org.jivesoftware.smack.filter.MessageTypeFilter; +import org.jivesoftware.smack.filter.PacketExtensionFilter; +import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.filter.PacketIDFilter; +import org.jivesoftware.smack.filter.PacketTypeFilter; +import org.jivesoftware.smack.packet.IQ; +import org.jivesoftware.smack.packet.Message; +import org.jivesoftware.smack.packet.Packet; +import org.jivesoftware.smack.packet.Presence; +import org.jivesoftware.smack.packet.Registration; +import org.jivesoftware.smackx.Form; +import org.jivesoftware.smackx.NodeInformationProvider; +import org.jivesoftware.smackx.ServiceDiscoveryManager; +import org.jivesoftware.smackx.packet.DiscoverInfo; +import org.jivesoftware.smackx.packet.DiscoverItems; +import org.jivesoftware.smackx.packet.MUCAdmin; +import org.jivesoftware.smackx.packet.MUCInitialPresence; +import org.jivesoftware.smackx.packet.MUCOwner; +import org.jivesoftware.smackx.packet.MUCUser; + /** * A MultiUserChat is a conversation that takes place among many users in a virtual * room. A room could have many occupants with different affiliation and roles. @@ -2500,8 +2530,7 @@ public class MultiUserChat { } } - public void finalize() throws Throwable { - super.finalize(); + protected void finalize() throws Throwable { try { if (connection != null) { roomListenerMultiplexor.removeRoom(room); @@ -2514,6 +2543,7 @@ public class MultiUserChat { catch (Exception e) { // Do nothing } + super.finalize(); } /**