diff --git a/src/views/core.clj b/src/views/core.clj index b3d1bce..d4021f4 100644 --- a/src/views/core.clj +++ b/src/views/core.clj @@ -304,7 +304,7 @@ (defn stop-update-watcher! "Stops threads for the views refresh watcher and worker threads." - [^Atom view-system & [wait-for-threads?]] + [^Atom view-system & [dont-wait-for-threads?]] (trace "stopping refresh watcher and workers") (let [worker-threads (:workers @view-system) watcher-thread (:refresh-watcher @view-system) @@ -316,7 +316,7 @@ :stop-workers? true) (doseq [^Thread t threads] (.interrupt t)) - (if wait-for-threads? + (if-not dont-wait-for-threads? (doseq [^Thread t threads] (.join t))) (swap! view-system assoc @@ -355,12 +355,12 @@ (defn stop-logger! "Stops the logger thread." - [^Atom view-system & [wait-for-thread?]] + [^Atom view-system & [dont-wait-for-thread?]] (trace "stopping logger") (let [^Thread logger-thread (get-in @view-system [:statistics :logger])] (swap! view-system assoc-in [:statistics :stop?] true) (if logger-thread (.interrupt logger-thread)) - (if wait-for-thread? (.join logger-thread)) + (if-not dont-wait-for-thread? (.join logger-thread)) (swap! view-system assoc-in [:statistics :logger] nil))) (defn hint @@ -486,10 +486,10 @@ (defn shutdown! "Shuts the view system down, terminating all worker threads and clearing all view subscriptions and data." - [^Atom view-system & [wait-for-threads?]] + [^Atom view-system & [dont-wait-for-threads?]] (trace "shutting down views sytem") - (stop-update-watcher! view-system wait-for-threads?) + (stop-update-watcher! view-system dont-wait-for-threads?) (if (:logging? @view-system) - (stop-logger! view-system wait-for-threads?)) + (stop-logger! view-system dont-wait-for-threads?)) (reset! view-system {}) view-system) diff --git a/test/views/basic_system_init_tests.clj b/test/views/basic_system_init_tests.clj index 2113ee1..5ca8555 100644 --- a/test/views/basic_system_init_tests.clj +++ b/test/views/basic_system_init_tests.clj @@ -39,7 +39,7 @@ (doseq [^Thread t workers] (is (.isAlive t))) ; 2. shutdown views (and wait for all threads to also finish) - (shutdown! test-views-system true) + (shutdown! test-views-system) (is (empty? @test-views-system)) (is (not (.isAlive ^Thread refresh-watcher))) (doseq [^Thread t workers] @@ -56,7 +56,7 @@ (let [logger-thread (get-in @test-views-system [:statistics :logger])] (is (.isAlive ^Thread logger-thread)) ; 2. shutdown views - (shutdown! test-views-system true) + (shutdown! test-views-system) (is (nil? (get-in @test-views-system [:statistics :logger]))) (is (not (.isAlive ^Thread logger-thread)))))) @@ -77,7 +77,7 @@ (contains-view? test-views-system :one) (contains-view? test-views-system :two))) ; 3. shutdown views - (shutdown! test-views-system true))) + (shutdown! test-views-system))) (deftest can-replace-views-after-init (let [options test-options @@ -95,4 +95,4 @@ (contains-view? test-views-system :baz))) (is (= replacement-view (get-in @test-views-system [:views :foo]))) ; 3. shutdown views - (shutdown! test-views-system true))) + (shutdown! test-views-system))) diff --git a/test/views/test_view_system.clj b/test/views/test_view_system.clj index fd89fd5..b64b363 100644 --- a/test/views/test_view_system.clj +++ b/test/views/test_view_system.clj @@ -22,7 +22,7 @@ (reset! test-views-system {}) (f) (if (seq @test-views-system) - (shutdown! test-views-system true))) + (shutdown! test-views-system))) (def memory-view-hint-type :memory-db)