当前位置: 首页>>代码示例>>Java>>正文


Java StepPerformanceSnapShot.getSeqNr方法代码示例

本文整理汇总了Java中org.pentaho.di.trans.performance.StepPerformanceSnapShot.getSeqNr方法的典型用法代码示例。如果您正苦于以下问题:Java StepPerformanceSnapShot.getSeqNr方法的具体用法?Java StepPerformanceSnapShot.getSeqNr怎么用?Java StepPerformanceSnapShot.getSeqNr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pentaho.di.trans.performance.StepPerformanceSnapShot的用法示例。


在下文中一共展示了StepPerformanceSnapShot.getSeqNr方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLogRecord

import org.pentaho.di.trans.performance.StepPerformanceSnapShot; //导入方法依赖的package包/类
/**
 * This method calculates all the values that are required
 * @param id the id to use or -1 if no id is needed
 * @param status the log status to use
 */
public RowMetaAndData getLogRecord(LogStatus status, Object subject, Object parent) {
	if (subject==null || subject instanceof StepPerformanceSnapShot) {
		StepPerformanceSnapShot snapShot = (StepPerformanceSnapShot) subject;
		
		RowMetaAndData row = new RowMetaAndData();
		
		for (LogTableField field : fields) {
			if (field.isEnabled()) {
				Object value = null;
				if (subject!=null) {
					switch(ID.valueOf(field.getId())){
					
					case ID_BATCH : value = new Long(snapShot.getBatchId()); break;
					case SEQ_NR :  value = new Long(snapShot.getSeqNr()); break;
					case LOGDATE: value = snapShot.getDate(); break;
					case TRANSNAME : value = snapShot.getTransName(); break;
					case STEPNAME:  value = snapShot.getStepName(); break;
					case STEP_COPY:  value = new Long(snapShot.getStepCopy()); break;
					case LINES_READ : value = new Long(snapShot.getLinesRead()); break;
					case LINES_WRITTEN : value = new Long(snapShot.getLinesWritten()); break;
					case LINES_INPUT : value = new Long(snapShot.getLinesInput()); break;
					case LINES_OUTPUT : value = new Long(snapShot.getLinesOutput()); break;
					case LINES_UPDATED : value = new Long(snapShot.getLinesUpdated()); break;
					case LINES_REJECTED : value = new Long(snapShot.getLinesRejected()); break;
					case ERRORS: value = new Long(snapShot.getErrors()); break;
					case INPUT_BUFFER_ROWS: value = new Long(snapShot.getInputBufferSize()); break;
					case OUTPUT_BUFFER_ROWS: value = new Long(snapShot.getOutputBufferSize()); break;
					}
				}

				row.addValue(field.getFieldName(), field.getDataType(), value);
				row.getRowMeta().getValueMeta(row.size()-1).setLength(field.getLength());
			}
		}
			
		return row;
	}
	else {
		return null;
	}
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:47,代码来源:PerformanceLogTable.java

示例2: writeStepPerformanceLogRecords

import org.pentaho.di.trans.performance.StepPerformanceSnapShot; //导入方法依赖的package包/类
/**
 * Write step performance log records.
 *
 * @param startSequenceNr the start sequence numberr
 * @param status the logging status. If this is End, perform cleanup
 * @return the new sequence number
 * @throws KettleException if any errors occur during logging
 */
private int writeStepPerformanceLogRecords(int startSequenceNr, LogStatus status) throws KettleException {
	int lastSeqNr = 0;
	Database ldb = null;
	PerformanceLogTable performanceLogTable = transMeta.getPerformanceLogTable();
	
	if (!performanceLogTable.isDefined() || !transMeta.isCapturingStepPerformanceSnapShots() || stepPerformanceSnapShots==null || stepPerformanceSnapShots.isEmpty()) {
		return 0; // nothing to do here!
	}
	
	try {
		ldb = new Database(this, performanceLogTable.getDatabaseMeta());
		ldb.shareVariablesWith(this);
		ldb.connect();
		ldb.setCommit(logCommitSize);

		// Write to the step performance log table...
		//
		RowMetaInterface rowMeta = performanceLogTable.getLogRecord(LogStatus.START, null, null).getRowMeta();
		ldb.prepareInsert(rowMeta, performanceLogTable.getActualSchemaName(), performanceLogTable.getActualTableName());
		
		synchronized(stepPerformanceSnapShots) {
			Iterator<List<StepPerformanceSnapShot>> iterator = stepPerformanceSnapShots.values().iterator();
			while(iterator.hasNext()) {
				List<StepPerformanceSnapShot> snapshots = iterator.next();
				synchronized(snapshots) {
				  Iterator<StepPerformanceSnapShot> snapshotsIterator = snapshots.iterator();
				  while(snapshotsIterator.hasNext()) {
				    StepPerformanceSnapShot snapshot=snapshotsIterator.next();
             if (snapshot.getSeqNr()>=startSequenceNr && snapshot.getSeqNr()<=lastStepPerformanceSnapshotSeqNrAdded) {
               
               RowMetaAndData row = performanceLogTable.getLogRecord(LogStatus.START, snapshot, null);
               
               ldb.setValuesInsert(row.getRowMeta(), row.getData());
               ldb.insertRow(true);
             }
             lastSeqNr = snapshot.getSeqNr();
				  }
				}
			}
		}
		
		ldb.insertFinished(true);
		
		// Finally, see if the log table needs cleaning up...
		//
		if (status.equals(LogStatus.END)) {
			ldb.cleanupLogRecords(performanceLogTable);
		}

	} catch(Exception e) {
		throw new KettleException(BaseMessages.getString(PKG, "Trans.Exception.ErrorWritingStepPerformanceLogRecordToTable"), e);
	} finally {
		if (ldb!=null) {
			ldb.disconnect();
		}
	}
	
	return lastSeqNr+1;
}
 
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:68,代码来源:Trans.java

示例3: writeStepPerformanceLogRecords

import org.pentaho.di.trans.performance.StepPerformanceSnapShot; //导入方法依赖的package包/类
/**
 * Write step performance log records.
 *
 * @param startSequenceNr
 *          the start sequence numberr
 * @param status
 *          the logging status. If this is End, perform cleanup
 * @return the new sequence number
 * @throws KettleException
 *           if any errors occur during logging
 */
private int writeStepPerformanceLogRecords( int startSequenceNr, LogStatus status ) throws KettleException {
  int lastSeqNr = 0;
  Database ldb = null;
  PerformanceLogTable performanceLogTable = transMeta.getPerformanceLogTable();

  if ( !performanceLogTable.isDefined() || !transMeta.isCapturingStepPerformanceSnapShots()
      || stepPerformanceSnapShots == null || stepPerformanceSnapShots.isEmpty() ) {
    return 0; // nothing to do here!
  }

  try {
    ldb = new Database( this, performanceLogTable.getDatabaseMeta() );
    ldb.shareVariablesWith( this );
    ldb.connect();
    ldb.setCommit( logCommitSize );

    // Write to the step performance log table...
    //
    RowMetaInterface rowMeta = performanceLogTable.getLogRecord( LogStatus.START, null, null ).getRowMeta();
    ldb.prepareInsert( rowMeta, performanceLogTable.getActualSchemaName(), performanceLogTable.getActualTableName() );

    synchronized ( stepPerformanceSnapShots ) {
      Iterator<List<StepPerformanceSnapShot>> iterator = stepPerformanceSnapShots.values().iterator();
      while ( iterator.hasNext() ) {
        List<StepPerformanceSnapShot> snapshots = iterator.next();
        synchronized ( snapshots ) {
          Iterator<StepPerformanceSnapShot> snapshotsIterator = snapshots.iterator();
          while ( snapshotsIterator.hasNext() ) {
            StepPerformanceSnapShot snapshot = snapshotsIterator.next();
            if ( snapshot.getSeqNr() >= startSequenceNr && snapshot
                .getSeqNr() <= lastStepPerformanceSnapshotSeqNrAdded ) {

              RowMetaAndData row = performanceLogTable.getLogRecord( LogStatus.START, snapshot, null );

              ldb.setValuesInsert( row.getRowMeta(), row.getData() );
              ldb.insertRow( true );
            }
            lastSeqNr = snapshot.getSeqNr();
          }
        }
      }
    }

    ldb.insertFinished( true );

    // Finally, see if the log table needs cleaning up...
    //
    if ( status.equals( LogStatus.END ) ) {
      ldb.cleanupLogRecords( performanceLogTable );
    }

  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString( PKG,
        "Trans.Exception.ErrorWritingStepPerformanceLogRecordToTable" ), e );
  } finally {
    if ( ldb != null ) {
      ldb.disconnect();
    }
  }

  return lastSeqNr + 1;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:74,代码来源:Trans.java

示例4: getLogRecord

import org.pentaho.di.trans.performance.StepPerformanceSnapShot; //导入方法依赖的package包/类
/**
 * This method calculates all the values that are required
 *
 * @param id
 *          the id to use or -1 if no id is needed
 * @param status
 *          the log status to use
 */
public RowMetaAndData getLogRecord( LogStatus status, Object subject, Object parent ) {
  if ( subject == null || subject instanceof StepPerformanceSnapShot ) {
    StepPerformanceSnapShot snapShot = (StepPerformanceSnapShot) subject;

    RowMetaAndData row = new RowMetaAndData();

    for ( LogTableField field : fields ) {
      if ( field.isEnabled() ) {
        Object value = null;
        if ( subject != null ) {
          switch ( ID.valueOf( field.getId() ) ) {

            case ID_BATCH:
              value = new Long( snapShot.getBatchId() );
              break;
            case SEQ_NR:
              value = new Long( snapShot.getSeqNr() );
              break;
            case LOGDATE:
              value = snapShot.getDate();
              break;
            case TRANSNAME:
              value = snapShot.getTransName();
              break;
            case STEPNAME:
              value = snapShot.getStepName();
              break;
            case STEP_COPY:
              value = new Long( snapShot.getStepCopy() );
              break;
            case LINES_READ:
              value = new Long( snapShot.getLinesRead() );
              break;
            case LINES_WRITTEN:
              value = new Long( snapShot.getLinesWritten() );
              break;
            case LINES_INPUT:
              value = new Long( snapShot.getLinesInput() );
              break;
            case LINES_OUTPUT:
              value = new Long( snapShot.getLinesOutput() );
              break;
            case LINES_UPDATED:
              value = new Long( snapShot.getLinesUpdated() );
              break;
            case LINES_REJECTED:
              value = new Long( snapShot.getLinesRejected() );
              break;
            case ERRORS:
              value = new Long( snapShot.getErrors() );
              break;
            case INPUT_BUFFER_ROWS:
              value = new Long( snapShot.getInputBufferSize() );
              break;
            case OUTPUT_BUFFER_ROWS:
              value = new Long( snapShot.getOutputBufferSize() );
              break;
            default:
              break;
          }
        }

        row.addValue( field.getFieldName(), field.getDataType(), value );
        row.getRowMeta().getValueMeta( row.size() - 1 ).setLength( field.getLength() );
      }
    }

    return row;
  } else {
    return null;
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:81,代码来源:PerformanceLogTable.java


注:本文中的org.pentaho.di.trans.performance.StepPerformanceSnapShot.getSeqNr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。