2 ms·
Well, it does sound like a bad design, because they should just be using an ExecutorService.. better implementation and industry-standard interface. Plus you
by jbooth 15y ago
Well, it does sound like a bad design, because they should just be using an ExecutorService.. better implementation and industry-standard interface. Plus you could just do new Server(Executors.newCachingThreadPool(10)).
Smart job skipping past my initial point to the deeper point, that constructor values would just accumulate, which creates a need for the builder pattern in the absence of named parameters (which would be sweet.. java 7 supposedly will give us map literals which can substitute).
- PaulHoule 15y agoIt ~is~ an ExecutorService, but it's funky because the Thread(s) that this system needs are special subclasses of Thread... Which in turn means you need a special ThreadFactory and such. Which of course points out more ugliness in Java; if there was a better generics implementation we could have the type system enforcing the correct choice of a ThreadFactory.
- jbooth 15y agoEh, it's an ugliness in this particular program IMO. You should not be subclassing Thread, pretty much ever, and every competent Java programmer will tell you so. That's like me writing Perl or Python code that uses globals for everything and then complaining that they're unmaintainable languages. Out of curiosity, which system are we talking about here? Jboss or something? Java protip, avoid any library involving the letters "EE".
- PaulHoule 15y agoGrizzly, a part of Glassfish. Officially sponsored by Sun^h^h^h^h Oracle.
- jbooth 15y agoYeah, there's your problem right there :) Never even looked at Glassfish but it was pretty much panned from the moment it came out. Sorry you have to work with it. Recommend Jetty or Netty if you want an embedded server to work with.