# [Java] Object 클래슀 wait, notify, notifyAll



Java의 μ΅œμƒμœ„ 클래슀 = Object 클래슀


# Object Class κ°€ κ°–κ³  μžˆλŠ” λ©”μ„œλ“œ

  • toString()

  • hashCode()

  • wait()

    κ°–κ³  있던 고유 lock ν•΄μ œ, Threadλ₯Ό μž λ“€κ²Œ 함

  • notify()

    μž λ“€λ˜ Thread 쀑 μž„μ˜μ˜ ν•˜λ‚˜λ₯Ό 깨움.

  • notifyAll()

    μž λ“€μ–΄ 있던 Thread λ₯Ό λͺ¨λ‘ 깨움.



wait, notify, notifyAll : ν˜ΈμΆœν•˜λŠ” μŠ€λ ˆλ“œκ°€ λ°˜λ“œμ‹œ 고유 락을 κ°–κ³  μžˆμ–΄μ•Ό 함.

  • Synchronized 블둝 λ‚΄μ—μ„œ μ‹€ν–‰λ˜μ–΄μ•Ό 함.

  • κ·Έ 블둝 μ•ˆμ—μ„œ ν˜ΈμΆœν•˜λŠ” 경우 IllegalMonitorStateException λ°œμƒ.

μ΅œμ’… μˆ˜μ • : 12/17/2022, 7:23:59 AM