ByteCode.News
Submit RSS Atom Podcast Sign in

Back to the channels

#java

  1. llanhmock p
  2. llanhmock 33333333333333333333333333333333
  3. llanhmock sorry about that folks
  4. Optic cats eh
  5. Optic always causing trouble
  6. NeXeN yes! i did it
  7. NeXeN you know, building a rom for nes isn't that hard. they're very simplistic. i'm working on building a rom editor/game engine for nes and i got my first little sprite to move around with the joystick
  8. NeXeN i love that feeling when it actually works, but i hate it because that means now you know you have all this work ahead. usually where my personal projects meet their end
  9. NeXeN i don't understand the opcodes well but at least i can implement the spec. going to take forever to figure out what everything does
  10. Optic that's a great education project
  11. NeXeN i was bored. and i was also debugging a problem with my joystick, then decided hey i can just go ahead and do a little more
  12. odinsbane I have an `Executors.newSingleThreadExecutorService` it spontaneously ends up not accepting new tasks.
  13. odinsbane There is a point in the code where I call a shutdown, but that occurs on a windows listener when the window is closed.
  14. odinsbane Is there any other reason I would suddenly start getting "RejectedExecution" exceptions while using a single thread executor service.
  15. odinsbane The only thing I can think of is a spurious windowclosed event gets passed even though the window isn't closed.
  16. odinsbane ... that doesn't make sense though because in that case a flag is set that would cause warnings to occur.
  17. NeXeN hrmm lets see...
  18. NeXeN well, swing does have a little issue with race condition on window teardown
  19. NeXeN window listeners can trigger RejectedExecutionExceptions
  20. NeXeN might have duplicate listeners as well, which is easy to do. and they can sometimes be doing things
  21. NeXeN but afaik, the newSingleThreadExecutor() uses an unbounded link blocking queue, and it only throws rejected execution when the queue reaches maximum capacity, or usually the executor is shutting down, so yeah the window event is where i would look
  22. NeXeN also if you tell me what you did before you suddenly started seeing anything, 75% chance that is it
  23. odinsbane It only happens when I run my program through fiji. If I run it stand alone, it works. I have tried to repeat exactly what I did, and I cannot repeat the problem.
  24. NeXeN yeah, https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/concurrent/Executors.html#newSingleThreadExecutor() it is unbound queue
  25. nevet Executors (Java SE 21 & JDK 21)
  26. NeXeN doesn't fiji have it's own lifecycle, memory, and window management behaviour?
  27. odinsbane Yes, I am not sure of all the differences.
  28. NeXeN if you're depending on Executors.newSingleThreadExecutor()'s auto closing wrapper, maybe try to construct a concrete threadpool yourself, and just keep explicit reference lifecycle tied to the window's own lifecycle
  29. NeXeN that way you are the one in control, and you're not depending on the who knows what is going on within that lifecycle, because from what you said that's my first instinct is lifecycle management
  30. odinsbane I'm not using the autoclose, I just use it to create an exector. Then when the window gets closed, it shutsdown the executor.
  31. deebo unless you constantly need new ones for some reason, just create one and tie it to the process' exit listener to shut down
  32. NeXeN yeah, explicitly manage it is the fool proof way
  33. deebo anyone using apache hc5 with connection pooling in spring boot and creating a single pool shared between all clients (web/restclient)? would be interested in seeing configs as i can't come up with a config that is not annoying to read and might get broken in upgrades
  34. deebo the autoconfiguration for these is soooo complicated, and there's no trivial path to a shared connection manager without losing some spring internal config bindings etc
  35. NeXeN well if you wanna share hc5 connection pool across both the rest client and web client, you could probably ....hold on let me read the docs real quick
  36. NeXeN ok, so if you make a bean to back both client builders....and of course you'd want a closeable http client...hrmm
  37. Para I think I've done that somewhere.
  38. Para Now is it public, hmm...
  39. NeXeN https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/http/client/reactive/HttpComponentsClientHttpConnector.html ok found what i was looking for
  40. nevet HttpComponentsClientHttpConnector (Spring Framework 7.0.9 API)
  41. Para (FWIW I don't like Apache HC, after version 3 they went full design patterns for patterns' sake)
  42. NeXeN is that not the worst named class ever?
  43. NeXeN wait, RestClient is blocking, and webcleint is non-blocking async....ok so you'll want async request factory or ....i dunno maybe both builders share the same configuration/customizer
  44. NeXeN yeah you are right deebo, it is complicated
  45. NeXeN Para: design patterns are nice when you recognize them, not so nice if you gotta look them up in a catalogue