Skip to end of metadata
Go to start of metadata

Interfaces for: (tick) READ-WRITE with SYNCHRONIZATION and EVENTS

Why is this different?

We specifically have placed the responsibility for being safe on the implementor. Any client code wishing to be kept in the loop can listen to events.

Story: Working with a user interface to define styles as the screen is being refreshed.

Create

 

not required

Read

(tick)

Readers should listen to events

Visit

 

not required

Write

(tick)

Recommend many readers / single writer approach

Thread-safe

(tick)

Inter-thread communication via events

Mixed Implementations

(tick)

 

The GeoTools style interface represents an bad example of this done at an interface level, the Swing Document implementation is a good example where many readers are allowed at a time and a single writer is allowed in at a time.

Mutable Interface

Checklist:

  • (tick) Class javadocs ask implementor to make this threadsafe
  • (tick) Some form of event notification (we used PropertyChangeEvents here - which is a poor fit with Collections)

Mutable Implementation

Notes:

  • There are many implementations of List out there on the web that can fire events (choose one don't roll your own as in this example)
Labels
  • None