I need to pass a LinkedBlockingQueue as a bean to a number of other beans. Is it possible to define one in XML. It’s normal definition is simply:
new LinkedBlockingQueue<Runnable>()
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.
You can just do that:
I don’t think you can explicitly say that it holds Runnable instances as the queue will be created at run time where Java generics is not visible.
EDIT: You can also pass constructor arguments:
This will limit the queue size to 10.