< prev index next >

src/java.desktop/share/classes/sun/awt/image/ImageFetcher.java

Print this page

259             for (int i = 0; i < info.fetchers.length; i++) {
260                 if (info.fetchers[i] == me) {
261                     return;
262                 }
263                 if (info.fetchers[i] == null) {
264                     index = i;
265                 }
266             }
267             if (index >= 0) {
268                 info.fetchers[index] = me;
269                 info.numFetchers++;
270                 me.setName("Image Fetcher " + index);
271                 return;
272             }
273         }
274     }
275 
276     /**
277       * Create and start ImageFetcher threads in the appropriate ThreadGroup.
278       */
279     @SuppressWarnings("removal")
280     private static void createFetchers(final FetcherInfo info) {
281        // We need to instantiate a new ImageFetcher thread.
282        // First, figure out which ThreadGroup we'll put the
283        // new ImageFetcher into
284        final AppContext appContext = AppContext.getAppContext();
285        ThreadGroup threadGroup = appContext.getThreadGroup();
286        ThreadGroup fetcherThreadGroup;
287        try {
288           if (threadGroup.getParent() != null) {
289              // threadGroup is not the root, so we proceed
290              fetcherThreadGroup = threadGroup;
291           } else {
292              // threadGroup is the root ("system") ThreadGroup.
293              // We instead want to use its child: the "main"
294              // ThreadGroup.  Thus, we start with the current
295              // ThreadGroup, and go up the tree until
296              // threadGroup.getParent().getParent() == null.
297              threadGroup = Thread.currentThread().getThreadGroup();
298              ThreadGroup parent = threadGroup.getParent();
299              while ((parent != null)

259             for (int i = 0; i < info.fetchers.length; i++) {
260                 if (info.fetchers[i] == me) {
261                     return;
262                 }
263                 if (info.fetchers[i] == null) {
264                     index = i;
265                 }
266             }
267             if (index >= 0) {
268                 info.fetchers[index] = me;
269                 info.numFetchers++;
270                 me.setName("Image Fetcher " + index);
271                 return;
272             }
273         }
274     }
275 
276     /**
277       * Create and start ImageFetcher threads in the appropriate ThreadGroup.
278       */
279     @SuppressWarnings({"deprecation", "removal"})
280     private static void createFetchers(final FetcherInfo info) {
281        // We need to instantiate a new ImageFetcher thread.
282        // First, figure out which ThreadGroup we'll put the
283        // new ImageFetcher into
284        final AppContext appContext = AppContext.getAppContext();
285        ThreadGroup threadGroup = appContext.getThreadGroup();
286        ThreadGroup fetcherThreadGroup;
287        try {
288           if (threadGroup.getParent() != null) {
289              // threadGroup is not the root, so we proceed
290              fetcherThreadGroup = threadGroup;
291           } else {
292              // threadGroup is the root ("system") ThreadGroup.
293              // We instead want to use its child: the "main"
294              // ThreadGroup.  Thus, we start with the current
295              // ThreadGroup, and go up the tree until
296              // threadGroup.getParent().getParent() == null.
297              threadGroup = Thread.currentThread().getThreadGroup();
298              ThreadGroup parent = threadGroup.getParent();
299              while ((parent != null)
< prev index next >