who and when notify the thread.wait() when thread.join() is called?

As for jdk7 for linux, you can get the answer from the source code of openjdk. /jdk7/hotspot/src/os/linux/vm/os_linux.cpp int ret = pthread_create(&tid, &attr, (void* (*)(void*)) java_start, thread); static void *java_start(Thread *thread) { … thread->run(); return 0; } and when start thread in java, the thread will be instanceof JavaThread. /jdk7/hotspot/src/share/vm/runtime/thread.cpp void JavaThread::run() { … thread_main_inner(); } … Read more

Join a count query on generate_series() and retrieve Null values as ‘0’

Untangled, simplified and fixed, it might look like this: SELECT to_char(s.tag,’yyyy-mm’) AS monat , count(t.id) AS eintraege FROM ( SELECT generate_series(min(date_from)::date , max(date_from)::date , interval ‘1 day’ )::date AS tag FROM mytable t ) s LEFT JOIN mytable t ON t.date_from::date = s.tag AND t.version = 1 GROUP BY 1 ORDER BY 1; db<>fiddle here … Read more

How to store a one to many relation in MySQL database?

You create a separate table for phone numbers (i.e. a 1:M relationship). create table `users` ( `id` int unsigned not null auto_increment, `name` varchar(100) not null, primary key(`id`) ); create table `phone_numbers` ( `id` int unsigned not null auto_increment, `user_id` int unsigned not null, `phone_number` varchar(25) not null, index pn_user_index(`user_id`), foreign key (`user_id`) references users(`id`) … Read more