private void scheduleCommitTask() { commitTask = new TimerTask() { @Override public boolean cancel() { return super.cancel(); } @Override public void run() { if (shouldClose()) { openCloseLock.lock(); //while on lock the index was opened if (!shouldClose()) return; try { close(); } finally { openCloseLock.unlock(); } } if (!closed.get()) { OLogManager.instance().debug(this, "Flushing index: " + indexName()); flush(); } } }; Orient.instance().scheduleTask(commitTask, firstFlushAfter, flushIndexInterval); }
protected void installMemoryChecker() { final long memoryCheckInterval = OGlobalConfiguration.PROFILER_MEMORYCHECK_INTERVAL.getValueAsLong(); if (memoryCheckInterval > 0) Orient.instance().scheduleTask(new MemoryChecker(), memoryCheckInterval, memoryCheckInterval); }
public OScheduledEvent schedule() { if (timer != null) timer.cancel(); bindDb(); timer = new ScheduledTimer(); nextExecutionId = getNextExecutionId() + 1; Orient.instance().scheduleTask(timer, cron.getNextValidTimeAfter(new Date()), 0); return this; }
@Override public void setAutoDump(final int iSeconds) { if (autoDumpTask != null) { // CANCEL ANY PREVIOUS RUNNING TASK autoDumpTask.cancel(); autoDumpTask = null; } if (iSeconds > 0) { OLogManager.instance().info(this, "Enabled auto dump of profiler every %d second(s)", iSeconds); final int ms = iSeconds * 1000; autoDumpTask = new TimerTask() { @Override public void run() { final StringBuilder output = new StringBuilder(); final String dumpType = OGlobalConfiguration.PROFILER_AUTODUMP_TYPE.getValueAsString(); output.append( "\n*******************************************************************************************************************************************"); output.append("\nPROFILER AUTO DUMP '" + dumpType + "' OUTPUT (to disabled it set 'profiler.autoDump.interval' = 0):\n"); output.append(dump(dumpType)); output.append( "\n*******************************************************************************************************************************************"); OLogManager.instance().info(null, output.toString()); } }; Orient.instance().scheduleTask(autoDumpTask, ms, ms); } else OLogManager.instance().info(this, "Auto dump of profiler disabled", iSeconds); }
protected void begin() { out(LOG_LEVELS.INFO, "BEGIN ETL PROCESSOR"); final Integer cfgMaxRetries = (Integer) context.getVariable("maxRetries"); if (cfgMaxRetries != null) maxRetries = cfgMaxRetries; final Integer dumpEveryMs = (Integer) context.getVariable("dumpEveryMs"); if (dumpEveryMs != null && dumpEveryMs > 0) { dumpTask = new TimerTask() { @Override public void run() { dumpProgress(); } }; Orient.instance().scheduleTask(dumpTask, dumpEveryMs, dumpEveryMs); startTime = System.currentTimeMillis(); } for (OBlock t : beginBlocks) { t.begin(); t.execute(); t.end(); } if (source != null) source.begin(); extractor.begin(); }
protected void begin() { OETLContextWrapper.getInstance().getMessageHandler().info(this, "BEGIN ETL PROCESSOR"); final Integer cfgMaxRetries = (Integer) context.getVariable("maxRetries"); if (cfgMaxRetries != null) maxRetries = cfgMaxRetries; final Integer dumpEveryMs = (Integer) context.getVariable("dumpEveryMs"); if (dumpEveryMs != null && dumpEveryMs > 0) { dumpTask = new TimerTask() { @Override public void run() { dumpProgress(); } }; Orient.instance().scheduleTask(dumpTask, dumpEveryMs, dumpEveryMs); startTime = System.currentTimeMillis(); } for (OETLBlock block : beginBlocks) { block.begin(null); block.execute(); block.end(); } if (source != null) { source.begin(null); } extractor.begin(null); }