Kaynağa Gözat

Merge pull request #124 from csmith/master

Make QueueHandlerFactory final.
pull/125/head
Greg Holmes 8 yıl önce
ebeveyn
işleme
cf4d6411fd

+ 16
- 22
irc/src/com/dmdirc/parser/irc/outputqueue/OutputQueue.java Dosyayı Görüntüle

47
     /** Thread for the sending queue. */
47
     /** Thread for the sending queue. */
48
     private QueueHandler queueHandler;
48
     private QueueHandler queueHandler;
49
     /** The QueueHandlerFactory for this OutputQueue. */
49
     /** The QueueHandlerFactory for this OutputQueue. */
50
-    private QueueHandlerFactory queueHandlerFactory = PriorityQueueHandler.getFactory();
50
+    private final QueueHandlerFactory queueHandlerFactory;
51
 
51
 
52
     /**
52
     /**
53
-     * Set the output stream for this queue.
54
-     *
55
-     * @param outputStream Output Stream to use.
53
+     * Creates a new output queue using the default handler.
56
      */
54
      */
57
-    public void setOutputStream(final OutputStream outputStream) {
58
-        this.out = new PrintWriter(outputStream, true);
55
+    public OutputQueue() {
56
+        this(PriorityQueueHandler.getFactory());
59
     }
57
     }
60
 
58
 
61
     /**
59
     /**
62
-     * Is output queueing enabled?
60
+     * Creates a new output queue using a handler from the given factory.
63
      *
61
      *
64
-     * @return true if output queueing is enabled.
62
+     * @param queueHandlerFactory The factory to use to create {@link QueueHandler}s.
65
      */
63
      */
66
-    public boolean isQueueEnabled() {
67
-        return queueEnabled;
64
+    public OutputQueue(final QueueHandlerFactory queueHandlerFactory) {
65
+        this.queueHandlerFactory = queueHandlerFactory;
68
     }
66
     }
69
 
67
 
70
     /**
68
     /**
71
-     * Set the QueueHandlerFactory.
72
-     * Changing this will not change an existing QueueHandler unless queueing is
73
-     * disabled and reenabled.
74
-     * If this is called before the first lien of output is queued then there is
75
-     * no need to disable and reenable the queue.
69
+     * Set the output stream for this queue.
76
      *
70
      *
77
-     * @param factory New QueueHandlerFactory to use.
71
+     * @param outputStream Output Stream to use.
78
      */
72
      */
79
-    public void setQueueHandlerFactory(final QueueHandlerFactory factory) {
80
-        queueHandlerFactory = factory;
73
+    public void setOutputStream(final OutputStream outputStream) {
74
+        this.out = new PrintWriter(outputStream, true);
81
     }
75
     }
82
 
76
 
83
     /**
77
     /**
84
-     * Get the QueueHandlerFactory.
78
+     * Is output queueing enabled?
85
      *
79
      *
86
-     * @return The current QueueHandlerFactory.
80
+     * @return true if output queueing is enabled.
87
      */
81
      */
88
-    public QueueHandlerFactory getQueueHandlerFactory() {
89
-        return queueHandlerFactory;
82
+    public boolean isQueueEnabled() {
83
+        return queueEnabled;
90
     }
84
     }
91
 
85
 
92
     /**
86
     /**

Loading…
İptal
Kaydet