I am looking out for a way in java, by which we can achieve time based locking for java threads OR may be time based interruption. consider this.
A java thread calls following function,
private DATA getData() {
   DATA data;
   synchronized(dataLock) {
       data = fetchData()
   }
   return data
}
Now assume call to fetchData() is hung, doesn't return. is there a way to timeout on this lock(dataLock) here, or interrupt this thread ?