JDK-8154801 : deprecate Observer and Observable
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.util
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-04-20
  • Updated: 2017-05-17
  • Resolved: 2016-04-28
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b117Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
The classes java.util.Observer and java.util.Observable should be deprecated. Applications should no longer use them.

They don't provide a rich enough event model for applications. For example, they support only the notion that something has changed, but they don't convey any information about what has changed. There are also some thread-safety and sequencing issues that cannot be fixed compatibly.

The evaluation of JDK-4180466, dating back to 1998 and 1999, states in part,

    [Observable] is no longer under active development. It is largely unused in
    the JDK, and has, for the most part, been superseded by the 1.1 Beans/AWT
    event model.

    Observable has fallen into disuse and is no longer under active development.

Application developers should consider using java.beans for a richer change notification model. Or they should consider constructs in java.util.concurrent such as queues or semaphores to pass messages among threads, with reliable ordering and synchronization properties.