Search in sources :

Example 1 with Failure

use of com.adobe.acs.commons.fam.Failure in project acs-aem-commons by Adobe-Consulting-Services.

the class ActionManagerImpl method logError.

private void logError(Exception ex) {
    LOG.error("Caught exception in task: " + ex.getMessage(), ex);
    Failure fail = new Failure();
    fail.setNodePath(currentPath.get());
    fail.setException(ex);
    failures.add(fail);
    tasksCompleted.incrementAndGet();
    tasksError.incrementAndGet();
    if (isComplete()) {
        finished = System.currentTimeMillis();
        performAutomaticCleanup();
    }
}
Also used : Failure(com.adobe.acs.commons.fam.Failure)

Example 2 with Failure

use of com.adobe.acs.commons.fam.Failure in project acs-aem-commons by Adobe-Consulting-Services.

the class ActionManagerImpl method getFailures.

@Override
public List<CompositeData> getFailures() throws OpenDataException {
    ArrayList<CompositeData> failureData = new ArrayList<>();
    int count = 0;
    for (Failure fail : failures) {
        if (count > 5000) {
            break;
        }
        failureData.add(new CompositeDataSupport(failureCompositeType, failureItemNames, new Object[] { name, ++count, fail.getNodePath(), fail.getException() == null ? "Unknown" : fail.getException().getMessage() }));
    }
    return failureData;
}
Also used : CompositeData(javax.management.openmbean.CompositeData) CompositeDataSupport(javax.management.openmbean.CompositeDataSupport) ArrayList(java.util.ArrayList) Failure(com.adobe.acs.commons.fam.Failure)

Example 3 with Failure

use of com.adobe.acs.commons.fam.Failure in project acs-aem-commons by Adobe-Consulting-Services.

the class ActionManagerImpl method logPersistenceException.

private void logPersistenceException(List<String> items, PersistenceException ex) {
    StringBuilder itemList = new StringBuilder();
    for (String item : items) {
        itemList.append(item).append("; ");
        Failure fail = new Failure();
        fail.setNodePath(item);
        fail.setException(ex);
        failures.add(fail);
        tasksError.incrementAndGet();
        tasksSuccessful.decrementAndGet();
    }
    LOG.error("Persistence error prevented saving changes for: " + itemList, ex);
}
Also used : Failure(com.adobe.acs.commons.fam.Failure)

Example 4 with Failure

use of com.adobe.acs.commons.fam.Failure in project acs-aem-commons by Adobe-Consulting-Services.

the class ProcessInstanceImpl method run.

@Override
public final void run(ResourceResolver rr) {
    try {
        infoBean.setRequester(rr.getUserID());
        infoBean.setStartTime(System.currentTimeMillis());
        definition.buildProcess(this, rr);
        infoBean.setIsRunning(true);
        runStep(0);
    } catch (LoginException | RepositoryException ex) {
        Failure f = new Failure();
        f.setException(ex);
        f.setNodePath(getPath());
        recordErrors(-1, Arrays.asList(f), rr);
        LOG.error("Error starting managed process " + getName(), ex);
        halt();
    }
}
Also used : LoginException(org.apache.sling.api.resource.LoginException) RepositoryException(javax.jcr.RepositoryException) ArchivedProcessFailure(com.adobe.acs.commons.mcp.model.impl.ArchivedProcessFailure) Failure(com.adobe.acs.commons.fam.Failure)

Aggregations

Failure (com.adobe.acs.commons.fam.Failure)4 ArchivedProcessFailure (com.adobe.acs.commons.mcp.model.impl.ArchivedProcessFailure)1 ArrayList (java.util.ArrayList)1 RepositoryException (javax.jcr.RepositoryException)1 CompositeData (javax.management.openmbean.CompositeData)1 CompositeDataSupport (javax.management.openmbean.CompositeDataSupport)1 LoginException (org.apache.sling.api.resource.LoginException)1