aleksandra
aleksandra

Reputation: 23

Should com.oracle.bmc.monitoring.MonitoringClient be closed every time after querying for metrics?

In the examples provided on using the Monitoring Client: https://github.com/oracle/oci-java-sdk/blob/master/bmc-examples/src/main/java/MonitoringMetricListExample.java https://github.com/oracle/oci-java-sdk/blob/master/bmc-examples/src/main/java/MonitoringMetricSummarizeExample.java, for the monitoringClient.summarizeMetricsData(request) a new Monitoring Client is created and closed after a request. Is it necessary? Or can this client be reused for the new request, so for example there will be one client for the whole runtime of the application?

Upvotes: 2

Views: 163

Answers (1)

Mathias Ricken
Mathias Ricken

Reputation: 165

closing the client after every request is not necessary. You can re-use the same client for multiple requests, e.g. for the whole lifetime of the application.

Upvotes: 1

Related Questions