src/share/classes/sun/print/ServiceNotifier.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -41,18 +41,18 @@
  * any changes.
  */
 class ServiceNotifier extends Thread {
 
     private PrintService service;
-    private Vector listeners;
+    private Vector<PrintServiceAttributeListener> listeners;
     private boolean stop = false;
     private PrintServiceAttributeSet lastSet;
 
     ServiceNotifier(PrintService service) {
         super(service.getName() + " notifier");
         this.service = service;
-        listeners = new Vector();
+        listeners = new Vector<>();
         try {
               setPriority(Thread.NORM_PRIORITY-1);
               setDaemon(true);
               start();
         } catch (SecurityException e) {

@@ -126,12 +126,11 @@
                     } else {
                        psa = service.getAttributes();
                     }
                     if (psa != null && !psa.isEmpty()) {
                         for (int i = 0; i < listeners.size() ; i++) {
-                            listener = (PrintServiceAttributeListener)
-                                listeners.elementAt(i);
+                            listener = listeners.elementAt(i);
                             attrs =
                                 new HashPrintServiceAttributeSet(psa);
                             attrEvent =
                                 new PrintServiceAttributeEvent(service, attrs);
                             listener.attributeUpdate(attrEvent);