APIdia Launch Partner
Top Description Fields Constructors Methods
sun.awt.image

pack-priv Class ImageFetcher

Additional top-level class in compilation unit: FetcherInfo.

extends Thread
Class Inheritance
Imports
java.util.Vector

An ImageFetcher is a thread used to fetch ImageFetchable objects. Once an ImageFetchable object has been fetched, the ImageFetcher thread may also be used to animate it if necessary, via the startingAnimation() / stoppingAnimation() methods.
Authors
Jim Graham, Fred Ecks

Field Summary

Modifier and TypeField and Description
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
Inherited from java.lang.Thread:
MAX_PRIORITYMIN_PRIORITYNORM_PRIORITY

Constructor Summary

AccessConstructor and Description
private
ImageFetcher()

We must only call the 5 args super() constructor passing in "false" to indicate to not inherit locals.

private
ImageFetcher(ThreadGroup threadGroup, int index)

Constructor for ImageFetcher -- only called by add() below.

Method Summary

Modifier and TypeMethod and Description
public static boolean
add(ImageFetchable src)

Adds an ImageFetchable to the queue of items to fetch.

public static boolean
amFetcher()

Checks to see if the current thread is one of the ImageFetchers.

private static void
createFetchers(final FetcherInfo info)

Create and start ImageFetcher threads in the appropriate ThreadGroup.

private void
fetchloop()

The main ImageFetcher loop.

public static boolean
isFetcher(Thread t)

Checks to see if the given thread is one of the ImageFetchers.

private static ImageFetchable
nextImage()

Returns the next ImageFetchable to be processed.

public static void
remove(ImageFetchable src)

Removes an ImageFetchable from the queue of items to fetch.

public void
run()

Overrides java.lang.Thread.run.

Implements java.lang.Runnable.run.

The main run() method of an ImageFetcher Thread.

pack-priv static void
startingAnimation()

Recycles this ImageFetcher thread as an image animator thread.

private static void
stoppingAnimation(Thread me)

Returns this image animator thread back to service as an ImageFetcher if possible.

Inherited from java.lang.Thread:
activeCountcheckAccessclonecurrentThreaddumpStackenumerategetAllStackTracesgetContextClassLoadergetDefaultUncaughtExceptionHandlergetIdgetNamegetPrioritygetStackTracegetStategetThreadGroupgetUncaughtExceptionHandlerholdsLockinterruptinterruptedisAliveisDaemonisInterruptedisVirtualjoinjoinjoinjoinofPlatformofVirtualonSpinWaitsetContextClassLoadersetDaemonsetDefaultUncaughtExceptionHandlersetNamesetPrioritysetUncaughtExceptionHandlersleepsleepsleepstartstartVirtualThreadthreadIdtoStringyield

Field Detail

ANIM_PRIORITYback to summary
pack-priv static final int ANIM_PRIORITY
HIGH_PRIORITYback to summary
pack-priv static final int HIGH_PRIORITY
LOW_PRIORITYback to summary
pack-priv static final int LOW_PRIORITY
TIMEOUTback to summary
pack-priv static final int TIMEOUT

Constructor Detail

ImageFetcherback to summary
private ImageFetcher()

We must only call the 5 args super() constructor passing in "false" to indicate to not inherit locals.

ImageFetcherback to summary
private ImageFetcher(ThreadGroup threadGroup, int index)

Constructor for ImageFetcher -- only called by add() below.

Method Detail

addback to summary
public static boolean add(ImageFetchable src)

Adds an ImageFetchable to the queue of items to fetch. Instantiates a new ImageFetcher if it's reasonable to do so. If there is no available fetcher to process an ImageFetchable, then reports failure to caller.

amFetcherback to summary
public static boolean amFetcher()

Checks to see if the current thread is one of the ImageFetchers.

createFetchersback to summary
private static void createFetchers(final FetcherInfo info)

Create and start ImageFetcher threads in the appropriate ThreadGroup.

fetchloopback to summary
private void fetchloop()

The main ImageFetcher loop. Repeatedly calls nextImage(), and fetches the returned ImageFetchable objects until nextImage() returns null.

isFetcherback to summary
public static boolean isFetcher(Thread t)

Checks to see if the given thread is one of the ImageFetchers.

nextImageback to summary
private static ImageFetchable nextImage()

Returns the next ImageFetchable to be processed. If TIMEOUT elapses in the mean time, or if the ImageFetcher is interrupted, null is returned.

removeback to summary
public static void remove(ImageFetchable src)

Removes an ImageFetchable from the queue of items to fetch.

runback to summary
public void run()

Overrides java.lang.Thread.run.

Implements java.lang.Runnable.run.

The main run() method of an ImageFetcher Thread. Calls fetchloop() to do the work, then removes itself from the array of ImageFetchers.

startingAnimationback to summary
pack-priv static void startingAnimation()

Recycles this ImageFetcher thread as an image animator thread. Removes this ImageFetcher from the array of ImageFetchers, and resets the thread name to "ImageAnimator".

stoppingAnimationback to summary
private static void stoppingAnimation(Thread me)

Returns this image animator thread back to service as an ImageFetcher if possible. Puts it back into the array of ImageFetchers and sets the thread name back to "Image Fetcher". If there are already the maximum number of ImageFetchers, this method simply returns, and fetchloop() will drop out when it sees that this thread isn't one of the ImageFetchers, and this thread will die.