protected WorkSchedulePath(WorkSchedulePath parent, Work work) { parentPath = parent.getPath(); name = name(work); scheduleStackTrace = isCaptureStackEnabled() ? new Trace(parent.scheduleStackTrace) : null; }
public String getPath() { return path(this); }
protected Trace(Trace cause) { super(getPath(), cause); }
@Override public String toString() { StringBuilder buf = new StringBuilder(); buf.append(getClass().getSimpleName()); buf.append('('); if (docId != null) { buf.append(docId); buf.append(", "); } else if (docIds != null && docIds.size() > 0) { buf.append(docIds.get(0)); buf.append("..., "); } buf.append(getSchedulePath().getParentPath()); buf.append(", "); buf.append(getProgress()); buf.append(", "); buf.append(getStatus()); buf.append(')'); return buf.toString(); }
if (!isSuspending()) { log.error("Exception during work: " + this, e); if (WorkSchedulePath.isCaptureStackEnabled()) { WorkSchedulePath.log.error("Work schedule path", getSchedulePath().getStack());
Exception exc = null; try { WorkSchedulePath.handleEnter(this); WorkSchedulePath.handleReturn(); try { setCompletionTime();
return; WorkSchedulePath.newInstance(work);
public static synchronized boolean toggleCaptureStack() { captureStack = Boolean.valueOf(!isCaptureStackEnabled()); return captureStack.booleanValue(); }
public static void newInstance(Work work) { Work entered = enteredLocal.get(); WorkSchedulePath path = new WorkSchedulePath(entered == null ? EMPTY : entered.getSchedulePath(), work); work.setSchedulePath(path); }
@Override protected void doWork() { String jobName = getSchedulePath().getPath(); if (log.isDebugEnabled()) { log.debug(String.format("Re-indexing job: %s started, NXQL: %s on repository: %s", jobName, nxql,
@Override protected void doWork() { ElasticSearchIndexing esi = Framework.getService(ElasticSearchIndexing.class); openSystemSession(); int bucketSize = Math.min(documentCount, getBucketSize()); List<String> ids = new ArrayList<>(bucketSize); for (DocumentLocation doc : getDocuments()) { ids.add(doc.getIdRef().value); if ((ids.size() % bucketSize) == 0) { esi.indexNonRecursive(getIndexingCommands(session, ids)); ids.clear(); TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); } } if (!ids.isEmpty()) { esi.indexNonRecursive(getIndexingCommands(session, ids)); ids.clear(); } if (syncAlias) { log.warn(String.format("Re-indexing job: %s completed.", getSchedulePath().getParentPath())); ElasticSearchAdmin esa = Framework.getService(ElasticSearchAdmin.class); esa.syncSearchAndWriteAlias(esa.getIndexNameForRepository(repositoryName)); } }
WorkSchedulePath.newInstance(work); switch (scheduling) { case ENQUEUE: