public void dispose() {
        if (Disposable.class.isAssignableFrom(this.type)) {
            for (T resource : this.resources) {
                ((Disposable) resource).dispose();
            }
        }
    }