Skip to content
Advertisement

Tag: multithreading

How can I guarantee a thread is safely unlocking a lock upon termination, while all methods already handle it?

A server project, might run for very long time and create many threads. In the following code I ask myself do i have to protect the lock somehow in addition to an overall try catch in method setData(MyData data): note: assuming its thread-safe, i am not really familiar with other reasons or natural disasters that may cause thread termination, like

How to run a thread for one hour in java

I will be receiving an attribute and I want to run a job for that attribute for 1 hour – monitoring and logging things related to that attribute. After that one hour, the job will stop. Is there a way to run a task, thread or a job for one hour given a id for that thread? As far as

Advertisement