Search in sources :

Example 1 with AtlasBaseModelObject

use of org.apache.atlas.model.AtlasBaseModelObject in project atlas by apache.

the class DataAccess method load.

public <T extends AtlasBaseModelObject> Iterable<T> load(final Iterable<T> objects) throws AtlasBaseException {
    Objects.requireNonNull(objects, "Objects to load");
    AtlasPerfTracer perf = null;
    try {
        if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
            perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "DataAccess.multiLoad()");
        }
        List<AtlasBaseModelObject> ret = new ArrayList<>();
        for (T object : objects) {
            try {
                ret.add(load(object));
            } catch (AtlasBaseException e) {
                // In case of bulk load, some entities might be in deleted state causing an exception to be thrown
                // by the single load API call
                LOG.warn("Bulk load encountered an error.", e);
            }
        }
        return (Iterable<T>) ret;
    } finally {
        AtlasPerfTracer.log(perf);
    }
}
Also used : AtlasBaseException(org.apache.atlas.exception.AtlasBaseException) AtlasPerfTracer(org.apache.atlas.utils.AtlasPerfTracer) ArrayList(java.util.ArrayList) AtlasBaseModelObject(org.apache.atlas.model.AtlasBaseModelObject)

Aggregations

ArrayList (java.util.ArrayList)1 AtlasBaseException (org.apache.atlas.exception.AtlasBaseException)1 AtlasBaseModelObject (org.apache.atlas.model.AtlasBaseModelObject)1 AtlasPerfTracer (org.apache.atlas.utils.AtlasPerfTracer)1