• BlackBerry Dynamics
  • Runtime library for Android applications
  • 12.0.1.79
RouteSpecificPool Class Reference

A connection sub-pool for a specific route, used by com.good.gd.apache.http.impl.conn.tsccm.ConnPoolByRoute. More...

Description

The methods in this class are unsynchronized. It is expected that the containing pool takes care of synchronization.

Notice

The following notice applies to the original API on which this API is based, and to its documentation. The documentation of this API has been revised from the original.

/*
 * Copyright (C) 2006 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

Public Member Functions

 RouteSpecificPool (HttpRoute route, int maxEntries)
 Creates a new route-specific pool. More...
 
final HttpRoute getRoute ()
 Obtains the route for which this pool is specific. More...
 
final int getMaxEntries ()
 Obtains the maximum number of entries allowed for this pool. More...
 
boolean isUnused ()
 Indicates whether this pool is unused. More...
 
int getCapacity ()
 Return remaining capacity of this pool. More...
 
final int getEntryCount ()
 Obtains the number of entries. More...
 
BasicPoolEntry allocEntry (final Object state)
 Obtains a free entry from this pool, if one is available. More...
 
void freeEntry (BasicPoolEntry entry)
 Returns an allocated entry to this pool. More...
 
void createdEntry (BasicPoolEntry entry)
 Indicates creation of an entry for this pool. More...
 
boolean deleteEntry (BasicPoolEntry entry)
 Deletes an entry from this pool. More...
 
void dropEntry ()
 Forgets about an entry from this pool. More...
 
void queueThread (WaitingThread wt)
 Adds a waiting thread. More...
 
boolean hasThread ()
 Checks whether there is a waiting thread in this pool. More...
 
WaitingThread nextThread ()
 Returns the next thread in the queue. More...
 
void removeThread (WaitingThread wt)
 Removes a waiting thread, if it is queued. More...
 

Protected Attributes

final HttpRoute route
 The route this pool is for. More...
 
final int maxEntries
 the maximum number of entries allowed for this pool
 
final LinkedList< BasicPoolEntryfreeEntries
 The list of free entries. More...
 
final Queue< WaitingThreadwaitingThreads
 The list of threads waiting for this pool. More...
 
int numEntries
 The number of created entries. More...
 

Constructor & Destructor Documentation

◆ RouteSpecificPool()

RouteSpecificPool ( HttpRoute  route,
int  maxEntries 
)
Parameters
routethe route for which to pool
maxEntriesthe maximum number of entries allowed for this pool

Member Function Documentation

◆ getRoute()

final HttpRoute getRoute ( )
Returns
the route

◆ getMaxEntries()

final int getMaxEntries ( )
Returns
the max entry number

◆ isUnused()

boolean isUnused ( )

A pool is unused if there is neither an entry nor a waiting thread. All entries count, not only the free but also the allocated ones.

Returns
true if this pool is unused, false otherwise

◆ getCapacity()

int getCapacity ( )
Returns
capacity

◆ getEntryCount()

final int getEntryCount ( )

This includes not only the free entries, but also those that have been created and are currently issued to an application.

Returns
the number of entries for the route of this pool

◆ allocEntry()

BasicPoolEntry allocEntry ( final Object  state)
Returns
an available pool entry, or null if there is none

◆ freeEntry()

void freeEntry ( BasicPoolEntry  entry)
Parameters
entrythe entry obtained from allocEntry or presented to createdEntry

◆ createdEntry()

void createdEntry ( BasicPoolEntry  entry)

The entry will not be added to the list of free entries, it is only recognized as belonging to this pool now. It can then be passed to freeEntry .

Parameters
entrythe entry that was created for this pool

◆ deleteEntry()

boolean deleteEntry ( BasicPoolEntry  entry)

Only entries that are currently free in this pool can be deleted. Allocated entries can not be deleted.

Parameters
entrythe entry to delete from this pool
Returns
true if the entry was found and deleted, or false if the entry was not found

◆ dropEntry()

void dropEntry ( )

This method is used to indicate that an entry allocated from this pool has been lost and will not be returned.

◆ queueThread()

void queueThread ( WaitingThread  wt)

This pool makes no attempt to match waiting threads with pool entries. It is the caller's responsibility to check that there is no entry before adding a waiting thread.

Parameters
wtthe waiting thread

◆ hasThread()

boolean hasThread ( )
Returns
true if there is a waiting thread, false otherwise

◆ nextThread()

WaitingThread nextThread ( )
Returns
a waiting thread, or null if there is none

◆ removeThread()

void removeThread ( WaitingThread  wt)
Parameters
wtthe waiting thread

Member Data Documentation

◆ route

final HttpRoute route
protected

◆ freeEntries

final LinkedList<BasicPoolEntry> freeEntries
protected

This list is managed LIFO, to increase idle times and allow for closing connections that are not really needed.

◆ waitingThreads

final Queue<WaitingThread> waitingThreads
protected

◆ numEntries

int numEntries
protected