Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Using the Built-in Observer and Observable Classes

In think that in the implementation of the "update" method of the Server, it's missing the "isAvailable" check.

In the implementation solution delivered by Craig in the video, there is the "isAvailable" check missing.

I had implemented something like this in "Server.java":

@Override
public void update(Observable observable, Object arg) {
    Table table = (Table) observable;

    if (isAvailable) {
        if (table.getStatus().equals(Status.AVAILABLE)) {
            leadToTable(table);
        } else if (table.getStatus().equals(Status.FINISHED)) {
            closeOutTable(table);
        }
    }
}

What do you say?