com.ibm.websphere.batch.devframework.datastreams.bdsadapter
Class AbstractBatchDataInputStreamRecordMetrics
- java.lang.Object
-
- com.ibm.websphere.batch.devframework.datastreams.bdsadapter.AbstractBatchDataStream
-
- com.ibm.websphere.batch.devframework.datastreams.bdsadapter.AbstractBatchDataInputStreamRecordMetrics
-
- All Implemented Interfaces:
- com.ibm.batch.api.BatchDataStream, AbstractBatchDataInputStream, AbstractBatchDataStreamRecordMetrics, RecordMetrics, java.io.Externalizable, java.io.Serializable
public abstract class AbstractBatchDataInputStreamRecordMetrics extends AbstractBatchDataStream implements AbstractBatchDataInputStream, AbstractBatchDataStreamRecordMetrics, RecordMetrics, java.io.Externalizable
Base class provides skipped-record handling.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.ibm.websphere.batch.RecordMetrics
RecordMetrics.MetricName
-
-
Field Summary
-
Fields inherited from class com.ibm.websphere.batch.devframework.datastreams.bdsadapter.AbstractBatchDataStream
jobStepKey
-
-
Constructor Summary
Constructors Constructor and Description AbstractBatchDataInputStreamRecordMetrics()
-
Method Summary
Methods Modifier and Type Method and Description abstract java.lang.String_externalizeCheckpointInformation()Abstract method implemented by sub class.protected abstract boolean_hasNext()Abstract method implemented by sub class.abstract void_internalizeCheckpointInformation(java.lang.String token)Abstract method implemented by sub class.abstract void_positionAtCurrentCheckpoint()Abstract method implemented by sub class.protected abstract java.lang.Object_read()Abstract method implemented by sub class.protected abstract java.lang.Object_read(java.lang.Object parameters)Abstract method implemented by sub class.voidaddSkipListener(SkipListener skipListener)Add a SkipListener callback to the BDS.protected voidendRPSMetric()java.lang.StringexternalizeCheckpointInformation()Encode record metric data at the beginning of the token, then call the sub class (via _externalizeCheckpointInformation) and append whatever it returns to the end of the token.abstract java.lang.ObjectfetchHeader()Returns the header data if anylonggetCumulativeTime()longgetMetric(RecordMetrics.MetricName metricName)Returns the value of the batch data stream metric specifiedlonggetRecordCount()booleanhasNext()Return a boolean indicating if there is unread data in the Input Stream.voidinitialize(java.lang.String name, java.lang.String jobstepId)Called during stream initialization.voidinternalizeCheckpointInformation(java.lang.String token)Parse record metric data from the beginning of the token, then call the sub class (via _internalizeCheckpointInformation), passing the rest of the token.voidpositionAtCurrentCheckpoint()This method calls the sub class (via _positionAtCurrentCheckpoint) to allow the sub class to position the BDS properly, then it applies checkpoint-related record metric settings to the BDS.java.lang.Objectread()Return the next record.java.lang.Objectread(java.lang.Object parameters)Return the next record based on the input parameters.voidreadExternal(java.io.ObjectInput in)protected voidsetSkipMetric()protected voidstartRPSMetric()voidwriteExternal(java.io.ObjectOutput out)-
Methods inherited from class com.ibm.websphere.batch.devframework.datastreams.bdsadapter.AbstractBatchDataStream
close, getJobstepId, getName, getProperties, getProperty, getRequiredProperty, getRequiredProperty, initialize, intermediateCheckpoint, isRestart, loadClass, open, positionAtInitialCheckpoint, setProperties, setRestart
-
-
-
-
Constructor Detail
-
AbstractBatchDataInputStreamRecordMetrics
public AbstractBatchDataInputStreamRecordMetrics()
-
-
Method Detail
-
initialize
public void initialize(java.lang.String name, java.lang.String jobstepId) throws BatchContainerDataStreamExceptionDescription copied from class:AbstractBatchDataStreamCalled during stream initialization.- Specified by:
initializein interfacecom.ibm.batch.api.BatchDataStream- Overrides:
initializein classAbstractBatchDataStream- Parameters:
name- the logical name of the BDS, this name is used to locate the resource in the job's xJCL.jobstepId- an identifier that represents the step within the batch job that is being run. This id is used to locate the resource in the job's xJCL.- Throws:
BatchContainerDataStreamException
-
_hasNext
protected abstract boolean _hasNext() throws java.lang.ExceptionAbstract method implemented by sub class. This method is called by hasNext.- Throws:
java.lang.Exception
-
hasNext
public final boolean hasNext() throws java.lang.ExceptionReturn a boolean indicating if there is unread data in the Input Stream. Delegates to _hasNext, implemented by sub class. Handle skip records, if applicable.- Specified by:
hasNextin interfaceAbstractBatchDataInputStream- Returns:
- boolean indicating if there is more data to be read
- Throws:
java.lang.Exception
-
_read
protected abstract java.lang.Object _read() throws java.lang.ExceptionAbstract method implemented by sub class. This method is called by read().- Throws:
java.lang.Exception
-
read
public final java.lang.Object read() throws java.lang.ExceptionReturn the next record. Delegates to _read, implemented by the sub class. Handle skip records, if applicable.- Specified by:
readin interfaceAbstractBatchDataInputStream- Returns:
- an object representing the next record in the inputstream
- Throws:
java.lang.Exception
-
_read
protected abstract java.lang.Object _read(java.lang.Object parameters) throws java.lang.ExceptionAbstract method implemented by sub class. This method is called by read(Object).- Throws:
java.lang.Exception
-
read
public final java.lang.Object read(java.lang.Object parameters) throws java.lang.ExceptionReturn the next record based on the input parameters. Delegates to _read(Object), implemented by the sub class. Handle skip records, if applicable.- Specified by:
readin interfaceAbstractBatchDataInputStream- Parameters:
parameters-- Returns:
- Throws:
java.lang.Exception
-
fetchHeader
public abstract java.lang.Object fetchHeader()
Description copied from interface:AbstractBatchDataInputStreamReturns the header data if any- Specified by:
fetchHeaderin interfaceAbstractBatchDataInputStream- Returns:
-
_internalizeCheckpointInformation
public abstract void _internalizeCheckpointInformation(java.lang.String token)
Abstract method implemented by sub class. This method is called by internalizeCheckpointInformation.- Parameters:
token- the checkpoint token
-
internalizeCheckpointInformation
public final void internalizeCheckpointInformation(java.lang.String token)
Parse record metric data from the beginning of the token, then call the sub class (via _internalizeCheckpointInformation), passing the rest of the token.- Specified by:
internalizeCheckpointInformationin interfacecom.ibm.batch.api.BatchDataStream- Specified by:
internalizeCheckpointInformationin classAbstractBatchDataStream- Parameters:
token- the checkpoint token
-
_externalizeCheckpointInformation
public abstract java.lang.String _externalizeCheckpointInformation()
Abstract method implemented by sub class. This method is called by externalizeCheckpointInformation.
-
externalizeCheckpointInformation
public final java.lang.String externalizeCheckpointInformation()
Encode record metric data at the beginning of the token, then call the sub class (via _externalizeCheckpointInformation) and append whatever it returns to the end of the token.- Specified by:
externalizeCheckpointInformationin interfacecom.ibm.batch.api.BatchDataStream- Specified by:
externalizeCheckpointInformationin classAbstractBatchDataStream- Returns:
- - This is a string that is created to record the BDS's position in the stream being processed. This String is opaque to anyone but the BDS, so only the BDS can interpret its content.
-
_positionAtCurrentCheckpoint
public abstract void _positionAtCurrentCheckpoint() throws BatchContainerDataStreamExceptionAbstract method implemented by sub class. This method is called by positionAtCurrentCheckpoint.
-
positionAtCurrentCheckpoint
public void positionAtCurrentCheckpoint() throws BatchContainerDataStreamExceptionThis method calls the sub class (via _positionAtCurrentCheckpoint) to allow the sub class to position the BDS properly, then it applies checkpoint-related record metric settings to the BDS.- Specified by:
positionAtCurrentCheckpointin interfacecom.ibm.batch.api.BatchDataStream- Throws:
BatchContainerDataStreamException
-
addSkipListener
public void addSkipListener(SkipListener skipListener)
Add a SkipListener callback to the BDS. The SkipListener is called by the BDS whenever the BDS fails to read or write a record and is configured to skip the failed record.
- Specified by:
addSkipListenerin interfaceAbstractBatchDataStreamRecordMetrics- Parameters:
skipListener- The user-implemented SkipListener callback.
-
getMetric
public long getMetric(RecordMetrics.MetricName metricName)
Description copied from interface:RecordMetricsReturns the value of the batch data stream metric specified- Specified by:
getMetricin interfaceRecordMetrics- Parameters:
metricName- - skip or rps- Returns:
- metricValue
-
getRecordCount
public long getRecordCount()
-
getCumulativeTime
public long getCumulativeTime()
-
startRPSMetric
protected void startRPSMetric()
-
endRPSMetric
protected void endRPSMetric()
-
setSkipMetric
protected void setSkipMetric()
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException- Specified by:
readExternalin interfacejava.io.Externalizable- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException- Specified by:
writeExternalin interfacejava.io.Externalizable- Throws:
java.io.IOException
-
-