summary:"<xref uid=\"com.azure.core.util.ProgressReporter\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ProgressReporter\"></xref> offers a convenient way to add progress tracking to I/O operations."
summary:"Creates child <xref uid=\"com.azure.core.util.ProgressReporter\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ProgressReporter\"></xref> that can be used to track sub-progress when tracked activity spans across concurrent processes."
syntax:"public ProgressReporter createChild()"
desc:"Creates child <xref uid=\"com.azure.core.util.ProgressReporter\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ProgressReporter\"></xref> that can be used to track sub-progress when tracked activity spans across concurrent processes. Child <xref uid=\"com.azure.core.util.ProgressReporter\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ProgressReporter\"></xref> notifies parent about progress and parent notifies <xref uid=\"com.azure.core.util.ProgressListener\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ProgressListener\"></xref>."
desc:"Accumulates the provided `progress` and notifies.\n\nIf this is a root <xref uid=\"com.azure.core.util.ProgressReporter\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ProgressReporter\"></xref> then attached <xref uid=\"com.azure.core.util.ProgressListener\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ProgressListener\"></xref> is notified about accumulated progress. Otherwise, the provided `progress` is reported to the parent <xref uid=\"com.azure.core.util.ProgressReporter\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ProgressReporter\"></xref>."
desc:"Resets progress to zero and notifies.\n\nIf this is a root <xref uid=\"com.azure.core.util.ProgressReporter\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ProgressReporter\"></xref> then attached <xref uid=\"com.azure.core.util.ProgressListener\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ProgressListener\"></xref> is notified. Otherwise, already accumulated progress is subtracted from the parent <xref uid=\"com.azure.core.util.ProgressReporter\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ProgressReporter\"></xref>'s progress."
summary:"Creates a <xref uid=\"com.azure.core.util.ProgressReporter\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ProgressReporter\"></xref> that notifies <xref uid=\"com.azure.core.util.ProgressListener\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ProgressListener\"></xref>."
modifiers:
- "static"
parameters:
- description:"The <xref uid=\"com.azure.core.util.ProgressListener\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ProgressListener\"></xref> to be notified about progress. Must not be null."
desc:"<xref uid=\"com.azure.core.util.ProgressReporter\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ProgressReporter\"></xref> offers a convenient way to add progress tracking to I/O operations.\n\nThe <xref uid=\"com.azure.core.util.ProgressReporter\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ProgressReporter\"></xref> can be used to track a single operation as well as the progress of complex operations that involve multiple sub-operations. In the latter case <xref uid=\"com.azure.core.util.ProgressReporter\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ProgressReporter\"></xref> forms a tree where child nodes track the progress of sub-operations and report to the parent which in turn aggregates the total progress. The reporting tree can have arbitrary level of nesting.\n\n**Code samples**\n\n```java\n/**\n * A simple operation that simulates I/O activity.\n * @param progressReporter The {@link ProgressReporter}.\n */\n public static void simpleOperation(ProgressReporter progressReporter) {\n for (long i = 0; i < 100; i++) {\n // Simulate 100 I/Os with 10 progress.\n progressReporter.reportProgress(10);\n }\n }\n\n /**\n * A complex operation that simulates I/O activity by invoking multiple {@link #simpleOperation(ProgressReporter)}.\n * @param progressReporter The {@link ProgressReporter}.\n */\n public static void complexOperation(ProgressReporter progressReporter) {\n simpleOperation(progressReporter.createChild());\n simpleOperation(progressReporter.createChild());\n simpleOperation(progressReporter.createChild());\n }\n\n /**\n * The main method.\n * @param args Program arguments.\n */\n public static void main(String[] args) {\n // Execute simpleOperation\n ProgressReporter simpleOperationProgressReporter = ProgressReporter\n .withProgressListener(progress -> System.out.println(\"Simple operation progress \" + progress));\n simpleOperation(simpleOperationProgressReporter);\n\n // Execute complexOperation\n ProgressReporter complexOperationProgressReporter = ProgressReporter\n .withProgressListener(progress -> System.out.println(\"Complex operation progress \" + progress));\n complexOperation(complexOperationProgressReporter);\n }\n```"