Example usage for org.apache.mahout.cf.taste.common Refreshable refresh

List of usage examples for org.apache.mahout.cf.taste.common Refreshable refresh

Introduction

In this page you can find the example usage for org.apache.mahout.cf.taste.common Refreshable refresh.

Prototype

void refresh(Collection<Refreshable> alreadyRefreshed);

Source Link

Document

Triggers "refresh" -- whatever that means -- of the implementation.

Usage

From source file:net.ufida.info.mahout.common.RefreshHelper.java

License:Apache License

/**
 * Adds the specified {@link Refreshable} to the given collection of {@link Refreshable}s if it is not
 * already there and immediately refreshes it.
 * /*  ww  w.  j  a  v  a2  s .com*/
 * @param alreadyRefreshed
 *          the collection of {@link Refreshable}s
 * @param refreshable
 *          the {@link Refreshable} to potentially add and refresh
 */
public static void maybeRefresh(Collection<Refreshable> alreadyRefreshed, Refreshable refreshable) {
    if (!alreadyRefreshed.contains(refreshable)) {
        alreadyRefreshed.add(refreshable);
        log.info("Added refreshable: {}", refreshable);
        refreshable.refresh(alreadyRefreshed);
        log.info("Refreshed: {}", alreadyRefreshed);
    }
}