azure-docs-sdk-java/docs-ref-autogen/com.azure.core.util.Progres...

74 строки
9.3 KiB
YAML

### YamlMime:JavaType
uid: "com.azure.core.util.ProgressReporter"
fullName: "com.azure.core.util.ProgressReporter"
name: "ProgressReporter"
nameWithType: "ProgressReporter"
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."
inheritances:
- "<xref href=\"java.lang.Object?displayProperty=fullName\" data-throw-if-not-resolved=\"False\" />"
inheritedClassMethods:
- classRef: "java.lang.<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>"
methodsRef:
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--\">clone</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-\">equals</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--\">finalize</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--\">getClass</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--\">hashCode</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--\">notify</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--\">notifyAll</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--\">toString</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-\">wait</a>"
syntax: "public final class **ProgressReporter**"
methods:
- uid: "com.azure.core.util.ProgressReporter.createChild()"
fullName: "com.azure.core.util.ProgressReporter.createChild()"
name: "createChild()"
nameWithType: "ProgressReporter.createChild()"
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>."
returns:
description: "The child <xref uid=\"com.azure.core.util.ProgressReporter\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ProgressReporter\"></xref>."
type: "<xref href=\"com.azure.core.util.ProgressReporter?alt=com.azure.core.util.ProgressReporter&text=ProgressReporter\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.core.util.ProgressReporter.reportProgress(long)"
fullName: "com.azure.core.util.ProgressReporter.reportProgress(long progress)"
name: "reportProgress(long progress)"
nameWithType: "ProgressReporter.reportProgress(long progress)"
summary: "Accumulates the provided `progress` and notifies."
parameters:
- description: "The number to be accumulated."
name: "progress"
type: "<xref href=\"long?alt=long&text=long\" data-throw-if-not-resolved=\"False\" />"
syntax: "public void reportProgress(long progress)"
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>."
- uid: "com.azure.core.util.ProgressReporter.reset()"
fullName: "com.azure.core.util.ProgressReporter.reset()"
name: "reset()"
nameWithType: "ProgressReporter.reset()"
summary: "Resets progress to zero and notifies."
syntax: "public void reset()"
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."
- uid: "com.azure.core.util.ProgressReporter.withProgressListener(com.azure.core.util.ProgressListener)"
fullName: "com.azure.core.util.ProgressReporter.withProgressListener(ProgressListener progressListener)"
name: "withProgressListener(ProgressListener progressListener)"
nameWithType: "ProgressReporter.withProgressListener(ProgressListener progressListener)"
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."
name: "progressListener"
type: "<xref href=\"com.azure.core.util.ProgressListener?alt=com.azure.core.util.ProgressListener&text=ProgressListener\" data-throw-if-not-resolved=\"False\" />"
syntax: "public static ProgressReporter withProgressListener(ProgressListener progressListener)"
desc: "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>."
returns:
description: "The <xref uid=\"com.azure.core.util.ProgressReporter\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ProgressReporter\"></xref> instance."
type: "<xref href=\"com.azure.core.util.ProgressReporter?alt=com.azure.core.util.ProgressReporter&text=ProgressReporter\" data-throw-if-not-resolved=\"False\" />"
type: "class"
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```"
metadata: {}
package: "com.azure.core.util"
artifact: com.azure:azure-core:1.52.0