Snapshot/Restore: restore with wait_for_completion=true should wait for succesfully restored shards to get started

This commit ensures that restore operation with wait_for_completion=true doesn't return until all successfully restored shards are started. Before it was returning as soon as restore operation was over, which cause some shards to be unavailable immediately after restore completion.

Fixes #8340
Snapshot/Restore: fix compilation issue for JDK 1.7