I have a queue that should be used by some classes.
it is the same queue for all of the classes so I thought maybe I will put the queue in static class as a static member.
But I understand this is not so good OOP.(although I thought that singleton is one of the design pattern)
so I would like an Idea for implement this queue,
I will need it to be unique and accessible to all the classes as all the classes use the same queue.
What you say is that your classes share some context and this context contains one queue. We can say that your classes depend on this context.
The reason for which the singleton pattern is not a good idea is because it uses the global (static) context as the common context. This is limiting for two reasons:
It is not easy to clearly identify the dependencies of your classes, and therefore it is not easy to set them up under different environments (such as a unit testing environment).
It is totally impossible to have two instances of this context run side by side.
So, an easy solution is to put all the dependencies of your classes inside a context class and then link all your classes with an instance of this class.
Another, more advanced, solution is to use a Dependency Injection framework.