I know that in C #, when you have an object that you want to use as a lock for multithreading, you must declare it static inside the class, which will instantiate the class in a separate thread.
Is this also true for Java? Some examples online seem to declare the lock object as final ...
Edit: I have a resource that I want to limit to only one streaming access at a time. A class that extends the stream will be used to create multiple instances and run at the same time. What should i use?
Thanks.
source share