< prev index next >

src/java.base/share/classes/sun/security/provider/SeedGenerator.java

Print this page

281          * and starts the thread going.
282          */
283         ThreadedSeedGenerator() {
284             pool = new byte[20];
285             start = end = 0;
286 
287             MessageDigest digest;
288 
289             try {
290                 digest = MessageDigest.getInstance("SHA");
291             } catch (NoSuchAlgorithmException e) {
292                 throw new InternalError("internal error: SHA-1 not available."
293                         , e);
294             }
295 
296             final ThreadGroup[] finalsg = new ThreadGroup[1];
297             @SuppressWarnings("removal")
298             Thread t = java.security.AccessController.doPrivileged
299                 (new java.security.PrivilegedAction<>() {
300                         @Override

301                         public Thread run() {
302                             ThreadGroup parent, group =
303                                 Thread.currentThread().getThreadGroup();
304                             while ((parent = group.getParent()) != null) {
305                                 group = parent;
306                             }
307                             finalsg[0] = new ThreadGroup
308                                 (group, "SeedGenerator ThreadGroup");
309                             Thread newT = new Thread(finalsg[0],
310                                 ThreadedSeedGenerator.this,
311                                 "SeedGenerator Thread",
312                                 0,
313                                 false);
314                             newT.setPriority(Thread.MIN_PRIORITY);
315                             newT.setDaemon(true);
316                             return newT;
317                         }
318                     });
319             seedGroup = finalsg[0];
320             t.start();

281          * and starts the thread going.
282          */
283         ThreadedSeedGenerator() {
284             pool = new byte[20];
285             start = end = 0;
286 
287             MessageDigest digest;
288 
289             try {
290                 digest = MessageDigest.getInstance("SHA");
291             } catch (NoSuchAlgorithmException e) {
292                 throw new InternalError("internal error: SHA-1 not available."
293                         , e);
294             }
295 
296             final ThreadGroup[] finalsg = new ThreadGroup[1];
297             @SuppressWarnings("removal")
298             Thread t = java.security.AccessController.doPrivileged
299                 (new java.security.PrivilegedAction<>() {
300                         @Override
301                         @SuppressWarnings("deprecation")
302                         public Thread run() {
303                             ThreadGroup parent, group =
304                                 Thread.currentThread().getThreadGroup();
305                             while ((parent = group.getParent()) != null) {
306                                 group = parent;
307                             }
308                             finalsg[0] = new ThreadGroup
309                                 (group, "SeedGenerator ThreadGroup");
310                             Thread newT = new Thread(finalsg[0],
311                                 ThreadedSeedGenerator.this,
312                                 "SeedGenerator Thread",
313                                 0,
314                                 false);
315                             newT.setPriority(Thread.MIN_PRIORITY);
316                             newT.setDaemon(true);
317                             return newT;
318                         }
319                     });
320             seedGroup = finalsg[0];
321             t.start();
< prev index next >