@Lock public void remove( final JID jid ) { listeners.remove( jid ); } }
@Lock public void addPresenceListener( final JID jid, final PresenceListener l ) { getSet( jid ).add( l ); }
@Lock public void removePresenceListener( final JID jid, final PresenceListener l ) { getSet( jid ).remove( l ); }
@Lock public void presenceChange( final Presence presence ) throws MessageException { final JID from = presence.getFrom(); final Set<PresenceListener> set = listeners.get( from ); if( set != null && !set.isEmpty() ) { fireEvent( set, presence ); } }
/** * Mark an entry to be refreshed, getting the Factory to perform the refresh * the next time the entry is aquired. When possible the refresh() method * should be used instead, as this hardcodes the refresh against the mode * of the pool. * * @param identity Identity to refresh * @return true if the identity exists, false if not */ @Lock public final boolean refreshLazily( final I identity ) { // remove the Entry if it exists, removing it if this was the last // holder of that entry final Entry<I, T> entry = entries.get( identity ); if( entry == null ) { return false; } entry.refreshRequired(); return true; }
/** * Remove the value associated by identity from the pool. If another Thread * has aquired this entry, then the entry will remain in the pool until all * aquirers have released or removed their copies. Until all copies have been * released, any attempt to call aquire will return null. * @param identity */ @Lock public final void remove( final I identity ) { // remove the Entry if it exists, removing it if this was the last // holder of that entry final Entry<I, T> e = entries.get( identity ); if( e != null && e.removed() ) { entries.remove( identity ); factory.removed( identity, e.getValue() ); } }
@Lock public final boolean refreshEagerly( final I identity )
@Lock public final void initialise()
@Lock public final void release( final I identity )
/** * Aquire the entry by increasing it's inUseCount then returning the value. * When the Mode is BLOCKING, this will cause the calling Thread to AWAIT * until it is available. * @return */ public T aquire() throws InterruptedException { awaitUntilAvailable(); // If we are removable, then fail the aquire as this entry is now dead if( isRemovable() ) { return null; } inUseCount++; return value; }