The synchronized keyword can be applied to a method or a block of code. The primary purpose of the synchronized keyword is to lock a shared resource to a single thread. The technical term for locking a resource is called an intrinsic lock or monitor lock. In this tutorial I will demonstrate populating an ArrayList from multiple threads using the non-thread-safe add() method. This tutorial will demonstrate applying the synchronized keyword to a static method and a code block to make our method thread safe.
Sur cette page du site, vous pouvez voir la vidéo en ligne Learn Java Programming - Synchronized Static Method Tutorial durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Daniel Ross 23 décembre 2015, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 3,879 fois et il a aimé 32 téléspectateurs. Bon visionnage!