static int markersSize() { return markers.size(); }
public static int getInvalidMapSize() { return invalidNamesMap.size(); }
/** * Returns the number of elements in this map. * * @return the number of elements in this map. */ @Override public boolean isEmpty() { return size() == 0; }
@Override public int size() { return WeakHashMap.this.size(); }
@Override public int size() { return WeakHashMap.this.size(); }
int getUnknownEnumValueDescriptorCount() { return unknownValues.size(); }
public static int getInvalidMapSize() { return invalidNamesMap.size(); }
private void markAcquiredConnectionsLocked(AcquiredConnectionStatus status) { if (!mAcquiredConnections.isEmpty()) { ArrayList<SQLiteConnection> keysToUpdate = new ArrayList<SQLiteConnection>( mAcquiredConnections.size()); for (Map.Entry<SQLiteConnection, AcquiredConnectionStatus> entry : mAcquiredConnections.entrySet()) { AcquiredConnectionStatus oldStatus = entry.getValue(); if (status != oldStatus && oldStatus != AcquiredConnectionStatus.DISCARD) { keysToUpdate.add(entry.getKey()); } } final int updateCount = keysToUpdate.size(); for (int i = 0; i < updateCount; i++) { mAcquiredConnections.put(keysToUpdate.get(i), status); } } }
if (map.size() != 0) { System.out.println("At iteration " + i + " the map still holds the reference on someDataObject"); } else {
public void unregisterOnTrayPreferenceChangeListener( @NonNull final OnTrayPreferenceChangeListener listener) { // noinspection ConstantConditions if (listener == null) { return; } mListeners.remove(listener); if (mListeners.size() == 0) { mContext.getContentResolver().unregisterContentObserver(mObserver); // cleanup mObserver = null; mObserverThread.quit(); mObserverThread = null; } }
ALL_CONNECTION_MANAGERS.keySet().toArray( new MultiThreadedHttpConnectionManager [ALL_CONNECTION_MANAGERS.size()] );
int openConnections = mAcquiredConnections.size(); if (mAvailablePrimaryConnection != null) { openConnections += 1;
public void testUnregister() throws Exception { final OnTrayPreferenceChangeListener listener = new OnTrayPreferenceChangeListener() { @Override public void onTrayPreferenceChanged(final Collection<TrayItem> items) { } }; final ContentProviderStorage userStorage = checkChangeListener(true, listener); assertEquals(1, userStorage.mListeners.size()); // unregister null should do nothing userStorage.unregisterOnTrayPreferenceChangeListener(null); assertEquals(1, userStorage.mListeners.size()); userStorage.unregisterOnTrayPreferenceChangeListener(listener); assertEquals(0, userStorage.mListeners.size()); assertNull(userStorage.mObserver); assertNull(userStorage.mObserverThread); }
private void dispose(boolean finalized) { if (mCloseGuard != null) { if (finalized) { mCloseGuard.warnIfOpen(); } mCloseGuard.close(); } if (!finalized) { // Close all connections. We don't need (or want) to do this // when finalized because we don't know what state the connections // themselves will be in. The finalizer is really just here for CloseGuard. // The connections will take care of themselves when their own finalizers run. synchronized (mLock) { throwIfClosedLocked(); mIsOpen = false; closeAvailableConnectionsAndLogExceptionsLocked(); final int pendingCount = mAcquiredConnections.size(); if (pendingCount != 0) { Logger.i(TAG, "The connection pool for " + mConfiguration.label + " has been closed but there are still " + pendingCount + " connections in use. They will be closed " + "as they are released back to the pool."); } wakeConnectionWaitersLocked(); } } }
public void testRegisterNull() throws Exception { final ContentProviderStorage storage = new ContentProviderStorage( getProviderMockContext(), "testRegisterNull", TrayStorage.Type.USER); storage.registerOnTrayPreferenceChangeListener(null); assertEquals(0, storage.mListeners.size()); }
/** * Return the size of the cached markers. This size can vary as markers are cached but collected during GC activity when a given prefix * is no longer in use. * * @return the size of the cached markers */ static int markersSize() { return markers.size(); }
static public int activeAccessClassLoaders () { int sz = accessClassLoaders.size(); if (selfContextAccessClassLoader != null) sz++; return sz; } }
/** * Get the ID of an object, adding it to the ID map if it isn't already registered. */ private static int getObjectId(Object object) { synchronized (objectIds) { Integer id = objectIds.get(object); if (id == null) { id = objectIds.size(); objectIds.put(object, id); } return id; } } }
private void markAcquiredConnectionsLocked(AcquiredConnectionStatus status) { if (!mAcquiredConnections.isEmpty()) { ArrayList<SQLiteConnection> keysToUpdate = new ArrayList<SQLiteConnection>( mAcquiredConnections.size()); for (Map.Entry<SQLiteConnection, AcquiredConnectionStatus> entry : mAcquiredConnections.entrySet()) { AcquiredConnectionStatus oldStatus = entry.getValue(); if (status != oldStatus && oldStatus != AcquiredConnectionStatus.DISCARD) { keysToUpdate.add(entry.getKey()); } } final int updateCount = keysToUpdate.size(); for (int i = 0; i < updateCount; i++) { mAcquiredConnections.put(keysToUpdate.get(i), status); } } }
private void dispose(boolean finalized) { if (mCloseGuard != null) { if (finalized) { mCloseGuard.warnIfOpen(); } mCloseGuard.close(); } if (!finalized) { // Close all connections. We don't need (or want) to do this // when finalized because we don't know what state the connections // themselves will be in. The finalizer is really just here for CloseGuard. // The connections will take care of themselves when their own finalizers run. synchronized (mLock) { throwIfClosedLocked(); mIsOpen = false; closeAvailableConnectionsAndLogExceptionsLocked(); final int pendingCount = mAcquiredConnections.size(); if (pendingCount != 0) { Log.i(TAG, "The connection pool for " + mConfiguration.label + " has been closed but there are still " + pendingCount + " connections in use. They will be closed " + "as they are released back to the pool."); } wakeConnectionWaitersLocked(); } } }