/** * Returns a new or existing InvitationsMonitor for a given connection. * * @param conn the connection to monitor for room invitations. * @return a new or existing InvitationsMonitor for a given connection. */ public static InvitationsMonitor getInvitationsMonitor(XMPPConnection conn) { synchronized (monitors) { if (!monitors.containsKey(conn)) { // We need to use a WeakReference because the monitor references the // connection and this could prevent the GC from collecting the monitor // when no other object references the monitor monitors.put(conn, new WeakReference(new InvitationsMonitor(conn))); } // Return the InvitationsMonitor that monitors the connection return (InvitationsMonitor) ((WeakReference) monitors.get(conn)).get(); } }
/** * Removes a listener to invitation notifications. The listener will be fired anytime * an invitation is received.<p> * * If there are no more listeners to notifiy for room invitations then the monitor will * be stopped. As soon as a new listener is added to the monitor, the monitor will resume * monitoring the connection for new room invitations. * * @param listener an invitation listener. */ public void removeInvitationListener(InvitationListener listener) { synchronized (invitationsListeners) { if (invitationsListeners.contains(listener)) { invitationsListeners.remove(listener); } // If there are no more listeners to notifiy for room invitations // then proceed to cancel/release this monitor if (invitationsListeners.size() == 0) { cancel(); } } }
/** * Adds a listener to invitation notifications. The listener will be fired anytime * an invitation is received.<p> * * If this is the first monitor's listener then the monitor will be initialized in * order to start listening to room invitations. * * @param listener an invitation listener. */ public void addInvitationListener(InvitationListener listener) { synchronized (invitationsListeners) { // If this is the first monitor's listener then initialize the listeners // on the connection to detect room invitations if (invitationsListeners.size() == 0) { init(); } if (!invitationsListeners.contains(listener)) { invitationsListeners.add(listener); } } }
/** * Removes a listener to invitation notifications. The listener will be fired anytime * an invitation is received.<p> * * If there are no more listeners to notifiy for room invitations then the monitor will * be stopped. As soon as a new listener is added to the monitor, the monitor will resume * monitoring the connection for new room invitations. * * @param listener an invitation listener. */ public void removeInvitationListener(InvitationListener listener) { synchronized (invitationsListeners) { if (invitationsListeners.contains(listener)) { invitationsListeners.remove(listener); } // If there are no more listeners to notifiy for room invitations // then proceed to cancel/release this monitor if (invitationsListeners.size() == 0) { cancel(); } } }
/** * Removes a listener to invitation notifications. The listener will be fired anytime * an invitation is received.<p> * * If there are no more listeners to notifiy for room invitations then the monitor will * be stopped. As soon as a new listener is added to the monitor, the monitor will resume * monitoring the connection for new room invitations. * * @param listener an invitation listener. */ public void removeInvitationListener(InvitationListener listener) { synchronized (invitationsListeners) { if (invitationsListeners.contains(listener)) { invitationsListeners.remove(listener); } // If there are no more listeners to notifiy for room invitations // then proceed to cancel/release this monitor if (invitationsListeners.size() == 0) { cancel(); } } }
/** * Adds a listener to invitation notifications. The listener will be fired anytime * an invitation is received.<p> * * If this is the first monitor's listener then the monitor will be initialized in * order to start listening to room invitations. * * @param listener an invitation listener. */ public void addInvitationListener(InvitationListener listener) { synchronized (invitationsListeners) { // If this is the first monitor's listener then initialize the listeners // on the connection to detect room invitations if (invitationsListeners.size() == 0) { init(); } if (!invitationsListeners.contains(listener)) { invitationsListeners.add(listener); } } }
/** * Removes a listener to invitation notifications. The listener will be fired anytime * an invitation is received.<p> * * If there are no more listeners to notifiy for room invitations then the monitor will * be stopped. As soon as a new listener is added to the monitor, the monitor will resume * monitoring the connection for new room invitations. * * @param listener an invitation listener. */ public void removeInvitationListener(InvitationListener listener) { synchronized (invitationsListeners) { if (invitationsListeners.contains(listener)) { invitationsListeners.remove(listener); } // If there are no more listeners to notifiy for room invitations // then proceed to cancel/release this monitor if (invitationsListeners.size() == 0) { cancel(); } } }
/** * Adds a listener to invitation notifications. The listener will be fired anytime * an invitation is received.<p> * * If this is the first monitor's listener then the monitor will be initialized in * order to start listening to room invitations. * * @param listener an invitation listener. */ public void addInvitationListener(InvitationListener listener) { synchronized (invitationsListeners) { // If this is the first monitor's listener then initialize the listeners // on the connection to detect room invitations if (invitationsListeners.size() == 0) { init(); } if (!invitationsListeners.contains(listener)) { invitationsListeners.add(listener); } } }
/** * Adds a listener to invitation notifications. The listener will be fired anytime * an invitation is received.<p> * * If this is the first monitor's listener then the monitor will be initialized in * order to start listening to room invitations. * * @param listener an invitation listener. */ public void addInvitationListener(InvitationListener listener) { synchronized (invitationsListeners) { // If this is the first monitor's listener then initialize the listeners // on the connection to detect room invitations if (invitationsListeners.size() == 0) { init(); } if (!invitationsListeners.contains(listener)) { invitationsListeners.add(listener); } } }
/** * Returns a new or existing InvitationsMonitor for a given connection. * * @param conn the connection to monitor for room invitations. * @return a new or existing InvitationsMonitor for a given connection. */ public static InvitationsMonitor getInvitationsMonitor(Connection conn) { synchronized (monitors) { if (!monitors.containsKey(conn)) { // We need to use a WeakReference because the monitor references the // connection and this could prevent the GC from collecting the monitor // when no other object references the monitor monitors.put(conn, new WeakReference<InvitationsMonitor>(new InvitationsMonitor(conn))); } // Return the InvitationsMonitor that monitors the connection return monitors.get(conn).get(); } }
/** * Returns a new or existing InvitationsMonitor for a given connection. * * @param conn the connection to monitor for room invitations. * @return a new or existing InvitationsMonitor for a given connection. */ public static InvitationsMonitor getInvitationsMonitor(Connection conn) { synchronized (monitors) { if (!monitors.containsKey(conn)) { // We need to use a WeakReference because the monitor references the // connection and this could prevent the GC from collecting the monitor // when no other object references the monitor monitors.put(conn, new WeakReference<InvitationsMonitor>(new InvitationsMonitor(conn))); } // Return the InvitationsMonitor that monitors the connection return monitors.get(conn).get(); } }
/** * Returns a new or existing InvitationsMonitor for a given connection. * * @param conn the connection to monitor for room invitations. * @return a new or existing InvitationsMonitor for a given connection. */ public static InvitationsMonitor getInvitationsMonitor(Connection conn) { synchronized (monitors) { if (!monitors.containsKey(conn)) { // We need to use a WeakReference because the monitor references the // connection and this could prevent the GC from collecting the monitor // when no other object references the monitor monitors.put(conn, new WeakReference<InvitationsMonitor>(new InvitationsMonitor(conn))); } // Return the InvitationsMonitor that monitors the connection return monitors.get(conn).get(); } }
public void connectionClosed() { cancel(); }
public void connectionClosedOnError(Exception e) { cancel(); }
public void connectionClosed() { cancel(); }
public void connectionClosed() { cancel(); }
public void connectionClosed() { cancel(); }
/** * Adds a listener to invitation notifications. The listener will be fired anytime * an invitation is received. * * @param conn the connection where the listener will be applied. * @param listener an invitation listener. */ public static void addInvitationListener(Connection conn, InvitationListener listener) { InvitationsMonitor.getInvitationsMonitor(conn).addInvitationListener(listener); }
/** * Removes a listener to invitation notifications. The listener will be fired anytime * an invitation is received. * * @param conn the connection where the listener was applied. * @param listener an invitation listener. */ public static void removeInvitationListener(XMPPConnection conn, InvitationListener listener) { InvitationsMonitor.getInvitationsMonitor(conn).removeInvitationListener(listener); }
/** * Removes a listener to invitation notifications. The listener will be fired anytime * an invitation is received. * * @param conn the connection where the listener was applied. * @param listener an invitation listener. */ public static void removeInvitationListener(Connection conn, InvitationListener listener) { InvitationsMonitor.getInvitationsMonitor(conn).removeInvitationListener(listener); }