Fork me on GitHub
#clojure-nl
<
2022-01-06
>
Thierry09:01:19

Working on a new module for the app I maintain 🙂

Mno11:01:01

I just removed 400 lines of code from our codebase while gaining functionality and losing none of it.

thomas14:01:20

Those are the best changes

Mno11:01:19

I like to think I'm pretty ok at refactoring

🎉 3
Thierry16:01:16

Can anyone tell me if and or how I can access items inside a java.util.concurrent.ConcurrentHashMap ?

borkdude16:01:31

@thierry572

user=> (get (java.util.concurrent.ConcurrentHashMap. {:a 1}) :a)
1

👍 1
Thierry16:01:42

ahh cool thanks

borkdude16:01:00

everything that implements java.util.Map you can access with get

arnout16:01:45

Most functions will work, also stuff like keys or seq. The thing that makes it a bit different is that you can't use it in function position.

Thierry16:01:43

Allright, good to know. I need to create a visible and resettable queue because with high load some items in the queue just hang if a process isnt finished succesfull while others continue

Thierry16:01:02

Whats a good replacement for https://github.com/overtone/at-at ? This repo isnt mainted and the fork isnt maintained either.

Thierry14:01:01

Trying to implement this without any knowledge of quartz proves to be quite a hassle haha. No idea where to start

borkdude14:01:52

Perhaps you can also look at https://kit-clj.github.io/ which includes a module for quartz

borkdude14:01:02

This is a brand new Clojure framework

Thierry15:01:31

well thats a no go as the project i work on would require a complete rework and im still learning clojure. the project i work on uses at-at and im trying to replace that so i can have a better scheduler. furthermore it uses concurrenthashmaps that i want to make visible including the scheduled items.

borkdude15:01:46

yeah, I recommend going forward with using the clojure quartz lib then

Thierry16:01:28

For now clojurequartz is a bridge too far for me.

Thierry16:01:33

ill stick with at-at for now

borkdude16:01:50

because it's macro-heavy?

Thierry18:01:21

Dunno why, it's just not that easy to understand for me. I never used quartz and im fairly new to clojure.

borkdude19:01:38

OK, makes sense.

Thierry16:01:06

Thanks @borkdude, ill have a look at it

borkdude16:01:02

There is also tick , haven't used that.

borkdude16:01:23

Could also just use cron jobs ;)

Thierry16:01:47

could, yes, would, nah 🙂

Thierry16:01:00

its not cron related imho 😉

Thierry16:01:09

thanks for the tip

Thierry17:01:01

I have this concurrent hash map and am trying to get the items inside it but clojure wont budge haha, what can i do? #object[java.util.concurrent.ConcurrentHashMap 0x58880fd3 {{:id 5, :name X, :parent 1, :slug 5}=java.util.concurrent.Executors$FinalizableDelegatedExecutorService@4005060c, {:id 6, :name Y, :parent 1, :slug 6}=java.util.concurrent.Executors$FinalizableDelegatedExecutorService@5cdf28a5, {:id 25, :name Z, :parent nil, :slug 25}=java.util.concurrent.Executors$FinalizableDelegatedExecutorService@12b00802, {:id 4, :name V, :parent 1, :slug 4}=java.util.concurrent.Executors$FinalizableDelegatedExecutorService@f236faa, {:id 7, :name U, :parent 1, :slug 7}=java.util.concurrent.Executors$FinalizableDelegatedExecutorService@1e934a98}]

arnout17:01:50

Are the keys in the map what you expect? I.e. a map?

Thierry17:01:46

I got it to work

Thierry17:01:51

the keys are maps

Thierry17:01:59

and the values are objects

Thierry17:01:25

In this case the vals are: (vals aorta.process/executors) (#object[java.util.concurrent.Executors$FinalizableDelegatedExecutorService 0xb68d9e8 "java.util.concurrent.Executors$FinalizableDelegatedExecutorService@b68d9e8"]  `#object[java.util.concurrent.Executors$FinalizableDelegatedExecutorService 0xe968607 "java.util.concurrent.Executors$FinalizableDelegatedExecutorService@e968607"]`  `#object[java.util.concurrent.Executors$FinalizableDelegatedExecutorService 0x3a6f9718 "java.util.concurrent.Executors$FinalizableDelegatedExecutorService@3a6f9718"]`  `#object[java.util.concurrent.Executors$FinalizableDelegatedExecutorService 0x1f3415b6 "java.util.concurrent.Executors$FinalizableDelegatedExecutorService@1f3415b6"]`  `#object[java.util.concurrent.Executors$FinalizableDelegatedExecutorService 0x525e3821 "java.util.concurrent.Executors$FinalizableDelegatedExecutorService@525e3821"])`