Without using any sort of any nasty reflection. Any quick/easy way to do it (w/o copying and pasting the Timer code)?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Don’t use
Timer, tryScheduledExecutorServiceinstead. Combine a call toExecutors.newSingleThreadScheduledExecutorwith a customThreadFactorythat creates the thread with the group you want. Of course, there’s much more flexibility available with executors and thread factories, but this most closely mimics the working of a timer (single thread per timer).