comment
stringlengths
1
45k
method_body
stringlengths
23
281k
target_code
stringlengths
0
5.16k
method_body_after
stringlengths
12
281k
context_before
stringlengths
8
543k
context_after
stringlengths
8
543k
listDeletedCertificatesNextPage doesn't need the parameter `includePending`?
PagedFlux<DeletedCertificate> listDeletedCertificates(Boolean includePending, Context context) { return new PagedFlux<>( () -> listDeletedCertificatesFirstPage(includePending, context), continuationToken -> listDeletedCertificatesNextPage(continuationToken, context)); }
continuationToken -> listDeletedCertificatesNextPage(continuationToken, context));
PagedFlux<DeletedCertificate> listDeletedCertificates(Boolean includePending, Context context) { return new PagedFlux<>( () -> listDeletedCertificatesFirstPage(includePending, context), continuationToken -> listDeletedCertificatesNextPage(continuationToken, context)); }
class CertificateAsyncClient { static final String API_VERSION = "7.0"; static final String ACCEPT_LANGUAGE = "en-US"; static final int DEFAULT_MAX_PAGE_RESULTS = 25; static final String CONTENT_TYPE_HEADER_VALUE = "application/json"; private final String vaultUrl; private final CertificateService service; private fina...
class CertificateAsyncClient { static final String API_VERSION = "7.0"; static final String ACCEPT_LANGUAGE = "en-US"; static final int DEFAULT_MAX_PAGE_RESULTS = 25; static final String CONTENT_TYPE_HEADER_VALUE = "application/json"; static final String KEY_VAULT_SCOPE = "https: private final String vaultUrl; private ...
nope, next page just needs the continuationToken.
PagedFlux<DeletedCertificate> listDeletedCertificates(Boolean includePending, Context context) { return new PagedFlux<>( () -> listDeletedCertificatesFirstPage(includePending, context), continuationToken -> listDeletedCertificatesNextPage(continuationToken, context)); }
continuationToken -> listDeletedCertificatesNextPage(continuationToken, context));
PagedFlux<DeletedCertificate> listDeletedCertificates(Boolean includePending, Context context) { return new PagedFlux<>( () -> listDeletedCertificatesFirstPage(includePending, context), continuationToken -> listDeletedCertificatesNextPage(continuationToken, context)); }
class CertificateAsyncClient { static final String API_VERSION = "7.0"; static final String ACCEPT_LANGUAGE = "en-US"; static final int DEFAULT_MAX_PAGE_RESULTS = 25; static final String CONTENT_TYPE_HEADER_VALUE = "application/json"; private final String vaultUrl; private final CertificateService service; private fina...
class CertificateAsyncClient { static final String API_VERSION = "7.0"; static final String ACCEPT_LANGUAGE = "en-US"; static final int DEFAULT_MAX_PAGE_RESULTS = 25; static final String CONTENT_TYPE_HEADER_VALUE = "application/json"; static final String KEY_VAULT_SCOPE = "https: private final String vaultUrl; private ...
updated
Mono<Response<CertificateOperation>> createCertificateWithResponse(String name, CertificatePolicy certificatePolicy, boolean enabled, Map<String, String> tags, Context context) { CertificateRequestParameters certificateRequestParameters = new CertificateRequestParameters() .certificatePolicy(new CertificatePolicyReques...
return service.createCertificate(vaultUrl, name, API_VERSION, ACCEPT_LANGUAGE, certificateRequestParameters, CONTENT_TYPE_HEADER_VALUE, context);
new CertificateRequestParameters() .certificatePolicy(new CertificatePolicyRequest(certificatePolicy)) .certificateAttributes(new CertificateRequestAttributes().enabled(enabled)) .tags(tags); return service.createCertificate(vaultUrl, name, API_VERSION, ACCEPT_LANGUAGE, certificateRequestParameters, CONTENT_TYPE_HEADER...
class CertificateAsyncClient { static final String API_VERSION = "7.0"; static final String ACCEPT_LANGUAGE = "en-US"; static final int DEFAULT_MAX_PAGE_RESULTS = 25; static final String CONTENT_TYPE_HEADER_VALUE = "application/json"; private final String vaultUrl; private final CertificateService service; private fina...
class CertificateAsyncClient { static final String API_VERSION = "7.0"; static final String ACCEPT_LANGUAGE = "en-US"; static final int DEFAULT_MAX_PAGE_RESULTS = 25; static final String CONTENT_TYPE_HEADER_VALUE = "application/json"; static final String KEY_VAULT_SCOPE = "https: private final String vaultUrl; private ...
What if message already has diagnostic-id? We should not create message span or stamp context on the message
private EventData setSpanContext(EventData event, Context parentContext) { Context eventSpanContext = tracerProvider.startSpan(parentContext, ProcessKind.MESSAGE); if (eventSpanContext != null) { Optional<Object> eventDiagnosticIdOptional = eventSpanContext.getData(DIAGNOSTIC_ID_KEY); if (eventDiagnosticIdOptional.isPr...
event.addProperty(DIAGNOSTIC_ID_KEY, eventDiagnosticIdOptional.get().toString());
private EventData setSpanContext(EventData event, Context parentContext) { Optional<Object> eventContextData = event.getContext().getData(SPAN_CONTEXT_KEY); if (eventContextData.isPresent()) { return event; } else { Context eventSpanContext = tracerProvider.startSpan(parentContext, ProcessKind.MESSAGE); if (eventSpanCo...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final BatchOptions DEFAULT_BATCH_OPTIONS...
class EventHubProducerAsyncClient implements Closeable { private static final int MAX_PARTITION_KEY_LENGTH = 128; private static final String SENDER_ENTITY_PATH_FORMAT = "%s/Partitions/%s"; private static final SendOptions DEFAULT_SEND_OPTIONS = new SendOptions(); private static final CreateBatchOptions DEFAULT_BATCH_O...
Thinking about the arguments... it should be (Context context, String key, T defaultValue, Class<T> clazz).
private void addSpanRequestAttributes(Span span, Context context, String spanName) { Objects.requireNonNull(span, "'span' cannot be null."); span.putAttribute(COMPONENT, AttributeValue.stringAttributeValue(parseComponentValue(spanName))); span.putAttribute( MESSAGE_BUS_DESTINATION, AttributeValue.stringAttributeValue(g...
AttributeValue.stringAttributeValue(getOrDefault(HOST_NAME_KEY, "", String.class, context)));
private void addSpanRequestAttributes(Span span, Context context, String spanName) { Objects.requireNonNull(span, "'span' cannot be null."); span.putAttribute(COMPONENT, AttributeValue.stringAttributeValue(parseComponentValue(spanName))); span.putAttribute( MESSAGE_BUS_DESTINATION, AttributeValue.stringAttributeValue(g...
class OpenCensusTracer implements com.azure.core.util.tracing.Tracer { private static final Tracer TRACER = Tracing.getTracer(); static final String COMPONENT = "component"; static final String MESSAGE_BUS_DESTINATION = "message_bus.destination"; static final String PEER_ENDPOINT = "peer.address"; private final ClientL...
class OpenCensusTracer implements com.azure.core.util.tracing.Tracer { private static final Tracer TRACER = Tracing.getTracer(); static final String COMPONENT = "component"; static final String MESSAGE_BUS_DESTINATION = "message_bus.destination"; static final String PEER_ENDPOINT = "peer.address"; private final ClientL...
I'm not strong on this change.
public static void validateCpk(CpkInfo customerProvidedKey, String endpoint) { if (customerProvidedKey != null && !BlobUrlParts.parse(endpoint).getScheme().equals(Constants.HTTPS)) { throw new IllegalArgumentException("Using a customer provided key requires https"); } }
throw new IllegalArgumentException("Using a customer provided key requires https");
public static void validateCpk(CpkInfo customerProvidedKey, String endpoint) { if (customerProvidedKey != null && !BlobUrlParts.parse(endpoint).getScheme().equals(Constants.HTTPS)) { throw new IllegalArgumentException("Using a customer provided key requires https"); } }
class BuilderHelper { private static final String DEFAULT_USER_AGENT_NAME = "azure-storage-blob"; private static final String DEFAULT_USER_AGENT_VERSION = "12.1.0-beta.1"; /** * Constructs a {@link HttpPipeline} from values passed from a builder. * * @param storageSharedKeyCredential {@link StorageSharedKeyCredential} ...
class BuilderHelper { private static final String DEFAULT_USER_AGENT_NAME = "azure-storage-blob"; private static final String DEFAULT_USER_AGENT_VERSION = "12.1.0-beta.1"; /** * Constructs a {@link HttpPipeline} from values passed from a builder. * * @param storageSharedKeyCredential {@link StorageSharedKeyCredential} ...
Should this throw an `IllegalStateException` instead? This feels more like an invalid state than an invalid argument.
public static void validateCpk(CpkInfo customerProvidedKey, String endpoint) { if (customerProvidedKey != null && !BlobUrlParts.parse(endpoint).getScheme().equals(Constants.HTTPS)) { throw new IllegalArgumentException("Using a customer provided key requires https"); } }
throw new IllegalArgumentException("Using a customer provided key requires https");
public static void validateCpk(CpkInfo customerProvidedKey, String endpoint) { if (customerProvidedKey != null && !BlobUrlParts.parse(endpoint).getScheme().equals(Constants.HTTPS)) { throw new IllegalArgumentException("Using a customer provided key requires https"); } }
class BuilderHelper { private static final String DEFAULT_USER_AGENT_NAME = "azure-storage-blob"; private static final String DEFAULT_USER_AGENT_VERSION = "12.1.0-beta.1"; /** * Constructs a {@link HttpPipeline} from values passed from a builder. * * @param storageSharedKeyCredential {@link StorageSharedKeyCredential} ...
class BuilderHelper { private static final String DEFAULT_USER_AGENT_NAME = "azure-storage-blob"; private static final String DEFAULT_USER_AGENT_VERSION = "12.1.0-beta.1"; /** * Constructs a {@link HttpPipeline} from values passed from a builder. * * @param storageSharedKeyCredential {@link StorageSharedKeyCredential} ...
Could you add a check before this call to ensure there is a credential set in the builder? The changes made here no longer have it throw an `IllegalArgumentException` when no credential has been set.
public BlobServiceAsyncClient buildAsyncClient() { BuilderHelper.validateCpk(customerProvidedKey, endpoint); BlobServiceVersion serviceVersion = version != null ? version : BlobServiceVersion.getLatest(); HttpPipeline pipeline = (httpPipeline != null) ? httpPipeline : BuilderHelper.buildPipeline( storageSharedKeyCreden...
HttpPipeline pipeline = (httpPipeline != null) ? httpPipeline : BuilderHelper.buildPipeline(
public BlobServiceAsyncClient buildAsyncClient() { BuilderHelper.validateCpk(customerProvidedKey, endpoint); if (Objects.isNull(storageSharedKeyCredential) && Objects.isNull(tokenCredential) && Objects.isNull(sasTokenCredential)) { throw logger.logExceptionAsError(new IllegalArgumentException("Blob Service Client canno...
class BlobServiceClientBuilder { private final ClientLogger logger = new ClientLogger(BlobServiceClientBuilder.class); private String endpoint; private String accountName; private CpkInfo customerProvidedKey; private StorageSharedKeyCredential storageSharedKeyCredential; private TokenCredential tokenCredential; private...
class BlobServiceClientBuilder { private final ClientLogger logger = new ClientLogger(BlobServiceClientBuilder.class); private String endpoint; private String accountName; private CpkInfo customerProvidedKey; private StorageSharedKeyCredential storageSharedKeyCredential; private TokenCredential tokenCredential; private...
Good catch!
public BlobServiceAsyncClient buildAsyncClient() { BuilderHelper.validateCpk(customerProvidedKey, endpoint); BlobServiceVersion serviceVersion = version != null ? version : BlobServiceVersion.getLatest(); HttpPipeline pipeline = (httpPipeline != null) ? httpPipeline : BuilderHelper.buildPipeline( storageSharedKeyCreden...
HttpPipeline pipeline = (httpPipeline != null) ? httpPipeline : BuilderHelper.buildPipeline(
public BlobServiceAsyncClient buildAsyncClient() { BuilderHelper.validateCpk(customerProvidedKey, endpoint); if (Objects.isNull(storageSharedKeyCredential) && Objects.isNull(tokenCredential) && Objects.isNull(sasTokenCredential)) { throw logger.logExceptionAsError(new IllegalArgumentException("Blob Service Client canno...
class BlobServiceClientBuilder { private final ClientLogger logger = new ClientLogger(BlobServiceClientBuilder.class); private String endpoint; private String accountName; private CpkInfo customerProvidedKey; private StorageSharedKeyCredential storageSharedKeyCredential; private TokenCredential tokenCredential; private...
class BlobServiceClientBuilder { private final ClientLogger logger = new ClientLogger(BlobServiceClientBuilder.class); private String endpoint; private String accountName; private CpkInfo customerProvidedKey; private StorageSharedKeyCredential storageSharedKeyCredential; private TokenCredential tokenCredential; private...
what happens if eventData already have the same property? Will it throw/override?
private EventData traceMessageSpan(EventData eventData) { Optional<Object> eventContextData = eventData.getContext().getData(SPAN_CONTEXT_KEY); if (eventContextData.isPresent()) { return eventData; } else { Context eventSpanContext = tracerProvider.startSpan(eventData.getContext(), ProcessKind.MESSAGE); Optional<Object...
eventData.addProperty(DIAGNOSTIC_ID_KEY, eventDiagnosticIdOptional.get().toString());
private EventData traceMessageSpan(EventData eventData) { Optional<Object> eventContextData = eventData.getContext().getData(SPAN_CONTEXT_KEY); if (eventContextData.isPresent()) { return eventData; } else { Context eventSpanContext = tracerProvider.startSpan(eventData.getContext(), ProcessKind.MESSAGE); Optional<Object...
class EventDataBatch { private final ClientLogger logger = new ClientLogger(EventDataBatch.class); private final Object lock = new Object(); private final int maxMessageSize; private final String partitionKey; private final ErrorContextProvider contextProvider; private final List<EventData> events; private final byte[]...
class EventDataBatch { private final ClientLogger logger = new ClientLogger(EventDataBatch.class); private final Object lock = new Object(); private final int maxMessageSize; private final String partitionKey; private final ErrorContextProvider contextProvider; private final List<EventData> events; private final byte[]...
I think the `properties` on eventData is a hashmap so it would just override. @conniey ^^
private EventData traceMessageSpan(EventData eventData) { Optional<Object> eventContextData = eventData.getContext().getData(SPAN_CONTEXT_KEY); if (eventContextData.isPresent()) { return eventData; } else { Context eventSpanContext = tracerProvider.startSpan(eventData.getContext(), ProcessKind.MESSAGE); Optional<Object...
eventData.addProperty(DIAGNOSTIC_ID_KEY, eventDiagnosticIdOptional.get().toString());
private EventData traceMessageSpan(EventData eventData) { Optional<Object> eventContextData = eventData.getContext().getData(SPAN_CONTEXT_KEY); if (eventContextData.isPresent()) { return eventData; } else { Context eventSpanContext = tracerProvider.startSpan(eventData.getContext(), ProcessKind.MESSAGE); Optional<Object...
class EventDataBatch { private final ClientLogger logger = new ClientLogger(EventDataBatch.class); private final Object lock = new Object(); private final int maxMessageSize; private final String partitionKey; private final ErrorContextProvider contextProvider; private final List<EventData> events; private final byte[]...
class EventDataBatch { private final ClientLogger logger = new ClientLogger(EventDataBatch.class); private final Object lock = new Object(); private final int maxMessageSize; private final String partitionKey; private final ErrorContextProvider contextProvider; private final List<EventData> events; private final byte[]...
Override
private EventData traceMessageSpan(EventData eventData) { Optional<Object> eventContextData = eventData.getContext().getData(SPAN_CONTEXT_KEY); if (eventContextData.isPresent()) { return eventData; } else { Context eventSpanContext = tracerProvider.startSpan(eventData.getContext(), ProcessKind.MESSAGE); Optional<Object...
eventData.addProperty(DIAGNOSTIC_ID_KEY, eventDiagnosticIdOptional.get().toString());
private EventData traceMessageSpan(EventData eventData) { Optional<Object> eventContextData = eventData.getContext().getData(SPAN_CONTEXT_KEY); if (eventContextData.isPresent()) { return eventData; } else { Context eventSpanContext = tracerProvider.startSpan(eventData.getContext(), ProcessKind.MESSAGE); Optional<Object...
class EventDataBatch { private final ClientLogger logger = new ClientLogger(EventDataBatch.class); private final Object lock = new Object(); private final int maxMessageSize; private final String partitionKey; private final ErrorContextProvider contextProvider; private final List<EventData> events; private final byte[]...
class EventDataBatch { private final ClientLogger logger = new ClientLogger(EventDataBatch.class); private final Object lock = new Object(); private final int maxMessageSize; private final String partitionKey; private final ErrorContextProvider contextProvider; private final List<EventData> events; private final byte[]...
same as above
private BlobContainerClientBuilder getBlobContainerClientBuilder(String dfsEndpoint, HttpPipeline pipeline) { String blobEndpoint = BlobUrlParts.parse( DataLakeImplUtils.endpointToDesiredEndpoint(dfsEndpoint, "blob", "dfs")).toUrl().toString(); return new BlobContainerClientBuilder() .pipeline(pipeline) .endpoint(blobE...
DataLakeImplUtils.endpointToDesiredEndpoint(dfsEndpoint, "blob", "dfs")).toUrl().toString();
private BlobContainerClientBuilder getBlobContainerClientBuilder(String dfsEndpoint, HttpPipeline pipeline) { String blobEndpoint = DataLakeImplUtils.endpointToDesiredEndpoint(dfsEndpoint, "blob", "dfs"); return new BlobContainerClientBuilder() .pipeline(pipeline) .endpoint(blobEndpoint) .serviceVersion(BlobServiceVers...
class DataLakeLeaseClientBuilder { final BlobLeaseClientBuilder blobLeaseClientBuilder; /** * Creates a new instance of {@link DataLakeLeaseClientBuilder}. */ public DataLakeLeaseClientBuilder() { blobLeaseClientBuilder = new BlobLeaseClientBuilder(); } /** * Creates a {@link DataLakeLeaseClient} based on the configura...
class DataLakeLeaseClientBuilder { final BlobLeaseClientBuilder blobLeaseClientBuilder; /** * Creates a new instance of {@link DataLakeLeaseClientBuilder}. */ public DataLakeLeaseClientBuilder() { blobLeaseClientBuilder = new BlobLeaseClientBuilder(); } /** * Creates a {@link DataLakeLeaseClient} based on the configura...
please don't call this a regex
public static String endpointToDesiredEndpoint(String endpoint, String desiredEndpoint, String currentEndpoint) { String desiredRegex = "." + desiredEndpoint + "."; String currentRegex = "." + currentEndpoint + "."; if (endpoint.contains(desiredRegex)) { return endpoint; } else { return endpoint.replaceFirst(currentReg...
String desiredRegex = "." + desiredEndpoint + ".";
public static String endpointToDesiredEndpoint(String endpoint, String desiredEndpoint, String currentEndpoint) { String desiredStringToMatch = "." + desiredEndpoint + "."; String currentStringToMatch = "." + currentEndpoint + "."; if (endpoint.contains(desiredStringToMatch)) { return endpoint; } else { return endpoint...
class DataLakeImplUtils { }
class DataLakeImplUtils { }
make this simple like the others.
private SpecializedBlobClientBuilder getSpecializedBlobClientBuilder(String dfsEndpoint, HttpPipeline pipeline) { String blobEndpoint = BlobUrlParts.parse( DataLakeImplUtils.endpointToDesiredEndpoint(dfsEndpoint, "blob", "dfs")).toUrl().toString(); return new SpecializedBlobClientBuilder() .pipeline(pipeline) .endpoint...
DataLakeImplUtils.endpointToDesiredEndpoint(dfsEndpoint, "blob", "dfs")).toUrl().toString();
private SpecializedBlobClientBuilder getSpecializedBlobClientBuilder(String dfsEndpoint, HttpPipeline pipeline) { String blobEndpoint = DataLakeImplUtils.endpointToDesiredEndpoint(dfsEndpoint, "blob", "dfs"); return new SpecializedBlobClientBuilder() .pipeline(pipeline) .endpoint(blobEndpoint) .serviceVersion(BlobServi...
class DataLakeLeaseClientBuilder { final BlobLeaseClientBuilder blobLeaseClientBuilder; /** * Creates a new instance of {@link DataLakeLeaseClientBuilder}. */ public DataLakeLeaseClientBuilder() { blobLeaseClientBuilder = new BlobLeaseClientBuilder(); } /** * Creates a {@link DataLakeLeaseClient} based on the configura...
class DataLakeLeaseClientBuilder { final BlobLeaseClientBuilder blobLeaseClientBuilder; /** * Creates a new instance of {@link DataLakeLeaseClientBuilder}. */ public DataLakeLeaseClientBuilder() { blobLeaseClientBuilder = new BlobLeaseClientBuilder(); } /** * Creates a {@link DataLakeLeaseClient} based on the configura...
done
private SpecializedBlobClientBuilder getSpecializedBlobClientBuilder(String dfsEndpoint, HttpPipeline pipeline) { String blobEndpoint = BlobUrlParts.parse( DataLakeImplUtils.endpointToDesiredEndpoint(dfsEndpoint, "blob", "dfs")).toUrl().toString(); return new SpecializedBlobClientBuilder() .pipeline(pipeline) .endpoint...
DataLakeImplUtils.endpointToDesiredEndpoint(dfsEndpoint, "blob", "dfs")).toUrl().toString();
private SpecializedBlobClientBuilder getSpecializedBlobClientBuilder(String dfsEndpoint, HttpPipeline pipeline) { String blobEndpoint = DataLakeImplUtils.endpointToDesiredEndpoint(dfsEndpoint, "blob", "dfs"); return new SpecializedBlobClientBuilder() .pipeline(pipeline) .endpoint(blobEndpoint) .serviceVersion(BlobServi...
class DataLakeLeaseClientBuilder { final BlobLeaseClientBuilder blobLeaseClientBuilder; /** * Creates a new instance of {@link DataLakeLeaseClientBuilder}. */ public DataLakeLeaseClientBuilder() { blobLeaseClientBuilder = new BlobLeaseClientBuilder(); } /** * Creates a {@link DataLakeLeaseClient} based on the configura...
class DataLakeLeaseClientBuilder { final BlobLeaseClientBuilder blobLeaseClientBuilder; /** * Creates a new instance of {@link DataLakeLeaseClientBuilder}. */ public DataLakeLeaseClientBuilder() { blobLeaseClientBuilder = new BlobLeaseClientBuilder(); } /** * Creates a {@link DataLakeLeaseClient} based on the configura...
done
private BlobContainerClientBuilder getBlobContainerClientBuilder(String dfsEndpoint, HttpPipeline pipeline) { String blobEndpoint = BlobUrlParts.parse( DataLakeImplUtils.endpointToDesiredEndpoint(dfsEndpoint, "blob", "dfs")).toUrl().toString(); return new BlobContainerClientBuilder() .pipeline(pipeline) .endpoint(blobE...
DataLakeImplUtils.endpointToDesiredEndpoint(dfsEndpoint, "blob", "dfs")).toUrl().toString();
private BlobContainerClientBuilder getBlobContainerClientBuilder(String dfsEndpoint, HttpPipeline pipeline) { String blobEndpoint = DataLakeImplUtils.endpointToDesiredEndpoint(dfsEndpoint, "blob", "dfs"); return new BlobContainerClientBuilder() .pipeline(pipeline) .endpoint(blobEndpoint) .serviceVersion(BlobServiceVers...
class DataLakeLeaseClientBuilder { final BlobLeaseClientBuilder blobLeaseClientBuilder; /** * Creates a new instance of {@link DataLakeLeaseClientBuilder}. */ public DataLakeLeaseClientBuilder() { blobLeaseClientBuilder = new BlobLeaseClientBuilder(); } /** * Creates a {@link DataLakeLeaseClient} based on the configura...
class DataLakeLeaseClientBuilder { final BlobLeaseClientBuilder blobLeaseClientBuilder; /** * Creates a new instance of {@link DataLakeLeaseClientBuilder}. */ public DataLakeLeaseClientBuilder() { blobLeaseClientBuilder = new BlobLeaseClientBuilder(); } /** * Creates a {@link DataLakeLeaseClient} based on the configura...
changed to stringToMatch
public static String endpointToDesiredEndpoint(String endpoint, String desiredEndpoint, String currentEndpoint) { String desiredRegex = "." + desiredEndpoint + "."; String currentRegex = "." + currentEndpoint + "."; if (endpoint.contains(desiredRegex)) { return endpoint; } else { return endpoint.replaceFirst(currentReg...
String desiredRegex = "." + desiredEndpoint + ".";
public static String endpointToDesiredEndpoint(String endpoint, String desiredEndpoint, String currentEndpoint) { String desiredStringToMatch = "." + desiredEndpoint + "."; String currentStringToMatch = "." + currentEndpoint + "."; if (endpoint.contains(desiredStringToMatch)) { return endpoint; } else { return endpoint...
class DataLakeImplUtils { }
class DataLakeImplUtils { }
thoughts on moving 429 and 503 checks to `RetryStrategy::calculateRetryDelay(HttpResponse, int)` as well? this way we ensure `RetryStrategy::calculateRetryDelay(HttpResponse, int)` is always gets called
private Duration determineDelayDuration(HttpResponse response, int tryCount) { int code = response.getStatusCode(); if (code != 429 && code != 503) { return retryStrategy.calculateRetryDelay(tryCount); } return retryStrategy.calculateRetryDelay(response, tryCount); }
&& code != 503) {
private Duration determineDelayDuration(HttpResponse response, int tryCount) { int code = response.getStatusCode(); if (code != 429 && code != 503) { return retryStrategy.calculateRetryDelay(tryCount); } String retryHeaderValue = null; if (!isNullOrEmpty(this.retryAfterHeader)) { retryHeaderValue = response.getHeaderVa...
class RetryPolicy implements HttpPipelinePolicy { private final ClientLogger logger = new ClientLogger(RetryPolicy.class); private final RetryStrategy retryStrategy; /** * Creates {@link RetryPolicy} with default {@link ExponentialBackoff} as {@link RetryStrategy} and use * 'retry-after-ms' in {@link HttpResponse} head...
class RetryPolicy implements HttpPipelinePolicy { private final ClientLogger logger = new ClientLogger(RetryPolicy.class); private final RetryStrategy retryStrategy; private final String retryAfterHeader; private final ChronoUnit retryAfterTimeUnit; /** * Creates {@link RetryPolicy} with default {@link ExponentialBacko...
Looks like by default we handle following headers in `RetryStrategy` default method: ``` retry-after-ms x-ms-retry-after-ms ``` so I guess we don't need this customization in AzConfig?
public ConfigurationAsyncClient buildAsyncClient() { Configuration buildConfiguration = (configuration == null) ? Configuration.getGlobalConfiguration().clone() : configuration; ConfigurationClientCredentials configurationCredentials = getConfigurationCredentials(buildConfiguration); String buildEndpoint = getBuildEndp...
String delay = httpResponse.getHeaderValue(RETRY_AFTER_MS_HEADER);
public ConfigurationAsyncClient buildAsyncClient() { Configuration buildConfiguration = (configuration == null) ? Configuration.getGlobalConfiguration().clone() : configuration; ConfigurationClientCredentials configurationCredentials = getConfigurationCredentials(buildConfiguration); String buildEndpoint = getBuildEndp...
class ConfigurationClientBuilder { private static final String ECHO_REQUEST_ID_HEADER = "x-ms-return-client-request-id"; private static final String CONTENT_TYPE_HEADER = "Content-Type"; private static final String CONTENT_TYPE_HEADER_VALUE = "application/json"; private static final String ACCEPT_HEADER = "Accept"; pri...
class ConfigurationClientBuilder { private static final String ECHO_REQUEST_ID_HEADER = "x-ms-return-client-request-id"; private static final String CONTENT_TYPE_HEADER = "Content-Type"; private static final String CONTENT_TYPE_HEADER_VALUE = "application/json"; private static final String ACCEPT_HEADER = "Accept"; pri...
based on what we spoke today, we will only use one response header to avoid any complexity in core. Header name x-ms-retry-after-ms
public ConfigurationAsyncClient buildAsyncClient() { Configuration buildConfiguration = (configuration == null) ? Configuration.getGlobalConfiguration().clone() : configuration; ConfigurationClientCredentials configurationCredentials = getConfigurationCredentials(buildConfiguration); String buildEndpoint = getBuildEndp...
String delay = httpResponse.getHeaderValue(RETRY_AFTER_MS_HEADER);
public ConfigurationAsyncClient buildAsyncClient() { Configuration buildConfiguration = (configuration == null) ? Configuration.getGlobalConfiguration().clone() : configuration; ConfigurationClientCredentials configurationCredentials = getConfigurationCredentials(buildConfiguration); String buildEndpoint = getBuildEndp...
class ConfigurationClientBuilder { private static final String ECHO_REQUEST_ID_HEADER = "x-ms-return-client-request-id"; private static final String CONTENT_TYPE_HEADER = "Content-Type"; private static final String CONTENT_TYPE_HEADER_VALUE = "application/json"; private static final String ACCEPT_HEADER = "Accept"; pri...
class ConfigurationClientBuilder { private static final String ECHO_REQUEST_ID_HEADER = "x-ms-return-client-request-id"; private static final String CONTENT_TYPE_HEADER = "Content-Type"; private static final String CONTENT_TYPE_HEADER_VALUE = "application/json"; private static final String ACCEPT_HEADER = "Accept"; pri...
We are using HttpHeaders because, There can be multiple headers which are of ID nature. We already have been asked for multiple id related headers by app config "x-ms-client-request-id" "x-ms-correlation-request-id" Thus `HttpHeaders` represent multiple Headers which client can set.
public RequestIdPolicy(Supplier<HttpHeaders> requestIdSupplier) { this.requestIdSupplier = requestIdSupplier; }
this.requestIdSupplier = requestIdSupplier;
public RequestIdPolicy(Supplier<HttpHeaders> requestIdSupplier) { this.requestIdSupplier = Objects.requireNonNull(requestIdSupplier, "'requestIdSupplier' must not be null"); }
class RequestIdPolicy implements HttpPipelinePolicy { private static final String REQUEST_ID_HEADER = "x-ms-client-request-id"; private final Supplier<HttpHeaders> requestIdSupplier; /** * Creates default {@link RequestIdPolicy}. */ public RequestIdPolicy() { requestIdSupplier = null; } /** * Creates {@link RequestIdPo...
class RequestIdPolicy implements HttpPipelinePolicy { private static final String REQUEST_ID_HEADER = "x-ms-client-request-id"; private final Supplier<HttpHeaders> requestIdSupplier; /** * Creates default {@link RequestIdPolicy}. */ public RequestIdPolicy() { requestIdSupplier = () -> new HttpHeaders().put(REQUEST_ID_H...
Instead of setting this to `null` here could we just insert a default supplier which replicates current functionality? That way we don't need to do the initial `null` check when applying the policy.
public RequestIdPolicy() { requestIdSupplier = null; }
requestIdSupplier = null;
public RequestIdPolicy() { requestIdSupplier = () -> new HttpHeaders().put(REQUEST_ID_HEADER, UUID.randomUUID().toString()); }
class RequestIdPolicy implements HttpPipelinePolicy { private static final String REQUEST_ID_HEADER = "x-ms-client-request-id"; private final Supplier<HttpHeaders> requestIdSupplier; /** * Creates default {@link RequestIdPolicy}. */ /** * Creates {@link RequestIdPolicy} with provided {@link Supplier} to dynamically gen...
class RequestIdPolicy implements HttpPipelinePolicy { private static final String REQUEST_ID_HEADER = "x-ms-client-request-id"; private final Supplier<HttpHeaders> requestIdSupplier; /** * Creates default {@link RequestIdPolicy}. */ /** * Creates {@link RequestIdPolicy} with provided {@link Supplier} to dynamically gen...
Do we want this to be nullable?
public RequestIdPolicy(Supplier<HttpHeaders> requestIdSupplier) { this.requestIdSupplier = requestIdSupplier; }
this.requestIdSupplier = requestIdSupplier;
public RequestIdPolicy(Supplier<HttpHeaders> requestIdSupplier) { this.requestIdSupplier = Objects.requireNonNull(requestIdSupplier, "'requestIdSupplier' must not be null"); }
class RequestIdPolicy implements HttpPipelinePolicy { private static final String REQUEST_ID_HEADER = "x-ms-client-request-id"; private final Supplier<HttpHeaders> requestIdSupplier; /** * Creates default {@link RequestIdPolicy}. */ public RequestIdPolicy() { requestIdSupplier = null; } /** * Creates {@link RequestIdPo...
class RequestIdPolicy implements HttpPipelinePolicy { private static final String REQUEST_ID_HEADER = "x-ms-client-request-id"; private final Supplier<HttpHeaders> requestIdSupplier; /** * Creates default {@link RequestIdPolicy}. */ public RequestIdPolicy() { requestIdSupplier = () -> new HttpHeaders().put(REQUEST_ID_H...
This is a general question for all policies which mutate the request, should this just insert the header value? @JonathanGiles @srnagar
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { if (Objects.nonNull(requestIdSupplier)) { HttpHeaders httpHeaders = requestIdSupplier.get(); if (Objects.nonNull(httpHeaders) && httpHeaders.getSize() > 0) { httpHeaders.stream().forEach(httpHeader -> { String requestIdHea...
if (requestIdHeaderValue == null) {
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { HttpHeaders httpHeaders = requestIdSupplier.get(); if (Objects.nonNull(httpHeaders) && httpHeaders.getSize() > 0) { for (HttpHeader header : httpHeaders) { String requestIdHeaderValue = context.getHttpRequest().getHeaders(...
class RequestIdPolicy implements HttpPipelinePolicy { private static final String REQUEST_ID_HEADER = "x-ms-client-request-id"; private final Supplier<HttpHeaders> requestIdSupplier; /** * Creates default {@link RequestIdPolicy}. */ public RequestIdPolicy() { requestIdSupplier = null; } /** * Creates {@link RequestIdPo...
class RequestIdPolicy implements HttpPipelinePolicy { private static final String REQUEST_ID_HEADER = "x-ms-client-request-id"; private final Supplier<HttpHeaders> requestIdSupplier; /** * Creates default {@link RequestIdPolicy}. */ public RequestIdPolicy() { requestIdSupplier = () -> new HttpHeaders().put(REQUEST_ID_H...
Could we use a `for` loop as `HttpHeaders` implements `Iterable<HttpHeader>`
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { if (Objects.nonNull(requestIdSupplier)) { HttpHeaders httpHeaders = requestIdSupplier.get(); if (Objects.nonNull(httpHeaders) && httpHeaders.getSize() > 0) { httpHeaders.stream().forEach(httpHeader -> { String requestIdHea...
httpHeaders.stream().forEach(httpHeader -> {
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { HttpHeaders httpHeaders = requestIdSupplier.get(); if (Objects.nonNull(httpHeaders) && httpHeaders.getSize() > 0) { for (HttpHeader header : httpHeaders) { String requestIdHeaderValue = context.getHttpRequest().getHeaders(...
class RequestIdPolicy implements HttpPipelinePolicy { private static final String REQUEST_ID_HEADER = "x-ms-client-request-id"; private final Supplier<HttpHeaders> requestIdSupplier; /** * Creates default {@link RequestIdPolicy}. */ public RequestIdPolicy() { requestIdSupplier = null; } /** * Creates {@link RequestIdPo...
class RequestIdPolicy implements HttpPipelinePolicy { private static final String REQUEST_ID_HEADER = "x-ms-client-request-id"; private final Supplier<HttpHeaders> requestIdSupplier; /** * Creates default {@link RequestIdPolicy}. */ public RequestIdPolicy() { requestIdSupplier = () -> new HttpHeaders().put(REQUEST_ID_H...
Continuing from a previous comment, if the supplier is made non-nullable and we add a default header in the base constructor (and possible default to this is null is passed into the overloaded constructor), should we do nothing if the supplier returns nothing. `x-ms-client-request-id` is optional by many services, so t...
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { if (Objects.nonNull(requestIdSupplier)) { HttpHeaders httpHeaders = requestIdSupplier.get(); if (Objects.nonNull(httpHeaders) && httpHeaders.getSize() > 0) { httpHeaders.stream().forEach(httpHeader -> { String requestIdHea...
if (Objects.nonNull(httpHeaders) && httpHeaders.getSize() > 0) {
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { HttpHeaders httpHeaders = requestIdSupplier.get(); if (Objects.nonNull(httpHeaders) && httpHeaders.getSize() > 0) { for (HttpHeader header : httpHeaders) { String requestIdHeaderValue = context.getHttpRequest().getHeaders(...
class RequestIdPolicy implements HttpPipelinePolicy { private static final String REQUEST_ID_HEADER = "x-ms-client-request-id"; private final Supplier<HttpHeaders> requestIdSupplier; /** * Creates default {@link RequestIdPolicy}. */ public RequestIdPolicy() { requestIdSupplier = null; } /** * Creates {@link RequestIdPo...
class RequestIdPolicy implements HttpPipelinePolicy { private static final String REQUEST_ID_HEADER = "x-ms-client-request-id"; private final Supplier<HttpHeaders> requestIdSupplier; /** * Creates default {@link RequestIdPolicy}. */ public RequestIdPolicy() { requestIdSupplier = () -> new HttpHeaders().put(REQUEST_ID_H...
based on above suggestion, I am making it not nullable.
public RequestIdPolicy(Supplier<HttpHeaders> requestIdSupplier) { this.requestIdSupplier = requestIdSupplier; }
this.requestIdSupplier = requestIdSupplier;
public RequestIdPolicy(Supplier<HttpHeaders> requestIdSupplier) { this.requestIdSupplier = Objects.requireNonNull(requestIdSupplier, "'requestIdSupplier' must not be null"); }
class RequestIdPolicy implements HttpPipelinePolicy { private static final String REQUEST_ID_HEADER = "x-ms-client-request-id"; private final Supplier<HttpHeaders> requestIdSupplier; /** * Creates default {@link RequestIdPolicy}. */ public RequestIdPolicy() { requestIdSupplier = null; } /** * Creates {@link RequestIdPo...
class RequestIdPolicy implements HttpPipelinePolicy { private static final String REQUEST_ID_HEADER = "x-ms-client-request-id"; private final Supplier<HttpHeaders> requestIdSupplier; /** * Creates default {@link RequestIdPolicy}. */ public RequestIdPolicy() { requestIdSupplier = () -> new HttpHeaders().put(REQUEST_ID_H...
You answered , I think, In order to track request, we do need request id. And if client does not provide or give us empty .. we should provide it.
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { if (Objects.nonNull(requestIdSupplier)) { HttpHeaders httpHeaders = requestIdSupplier.get(); if (Objects.nonNull(httpHeaders) && httpHeaders.getSize() > 0) { httpHeaders.stream().forEach(httpHeader -> { String requestIdHea...
if (Objects.nonNull(httpHeaders) && httpHeaders.getSize() > 0) {
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { HttpHeaders httpHeaders = requestIdSupplier.get(); if (Objects.nonNull(httpHeaders) && httpHeaders.getSize() > 0) { for (HttpHeader header : httpHeaders) { String requestIdHeaderValue = context.getHttpRequest().getHeaders(...
class RequestIdPolicy implements HttpPipelinePolicy { private static final String REQUEST_ID_HEADER = "x-ms-client-request-id"; private final Supplier<HttpHeaders> requestIdSupplier; /** * Creates default {@link RequestIdPolicy}. */ public RequestIdPolicy() { requestIdSupplier = null; } /** * Creates {@link RequestIdPo...
class RequestIdPolicy implements HttpPipelinePolicy { private static final String REQUEST_ID_HEADER = "x-ms-client-request-id"; private final Supplier<HttpHeaders> requestIdSupplier; /** * Creates default {@link RequestIdPolicy}. */ public RequestIdPolicy() { requestIdSupplier = () -> new HttpHeaders().put(REQUEST_ID_H...
```suggestion for (HttpHeader header : httpHeaders) { ```
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { HttpHeaders httpHeaders = requestIdSupplier.get(); if (Objects.nonNull(httpHeaders) && httpHeaders.getSize() > 0) { for (HttpHeader header:httpHeaders) { String requestIdHeaderValue = context.getHttpRequest().getHeaders()....
for (HttpHeader header:httpHeaders) {
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { HttpHeaders httpHeaders = requestIdSupplier.get(); if (Objects.nonNull(httpHeaders) && httpHeaders.getSize() > 0) { for (HttpHeader header : httpHeaders) { String requestIdHeaderValue = context.getHttpRequest().getHeaders(...
class RequestIdPolicy implements HttpPipelinePolicy { private static final String REQUEST_ID_HEADER = "x-ms-client-request-id"; private final Supplier<HttpHeaders> requestIdSupplier; /** * Creates default {@link RequestIdPolicy}. */ public RequestIdPolicy() { requestIdSupplier = () -> new HttpHeaders().put(REQUEST_ID_H...
class RequestIdPolicy implements HttpPipelinePolicy { private static final String REQUEST_ID_HEADER = "x-ms-client-request-id"; private final Supplier<HttpHeaders> requestIdSupplier; /** * Creates default {@link RequestIdPolicy}. */ public RequestIdPolicy() { requestIdSupplier = () -> new HttpHeaders().put(REQUEST_ID_H...
Wouldn't this allow users to provide a random set of HTTP headers and not just the request id headers? For e.g. the supplier can return ```java new HttpHeaders().put("foo", "bar").put(REQUEST_ID_HEADER, UUID.randomUUID().toString()); ```
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { HttpHeaders httpHeaders = requestIdSupplier.get(); if (Objects.nonNull(httpHeaders) && httpHeaders.getSize() > 0) { for (HttpHeader header : httpHeaders) { String requestIdHeaderValue = context.getHttpRequest().getHeaders(...
HttpHeaders httpHeaders = requestIdSupplier.get();
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { HttpHeaders httpHeaders = requestIdSupplier.get(); if (Objects.nonNull(httpHeaders) && httpHeaders.getSize() > 0) { for (HttpHeader header : httpHeaders) { String requestIdHeaderValue = context.getHttpRequest().getHeaders(...
class RequestIdPolicy implements HttpPipelinePolicy { private static final String REQUEST_ID_HEADER = "x-ms-client-request-id"; private final Supplier<HttpHeaders> requestIdSupplier; /** * Creates default {@link RequestIdPolicy}. */ public RequestIdPolicy() { requestIdSupplier = () -> new HttpHeaders().put(REQUEST_ID_H...
class RequestIdPolicy implements HttpPipelinePolicy { private static final String REQUEST_ID_HEADER = "x-ms-client-request-id"; private final Supplier<HttpHeaders> requestIdSupplier; /** * Creates default {@link RequestIdPolicy}. */ public RequestIdPolicy() { requestIdSupplier = () -> new HttpHeaders().put(REQUEST_ID_H...
yes . But unless we keep a bag of valid request id header, we can not validate. And whenever a new request-id header is introduced, we need to update the bag and release.
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { HttpHeaders httpHeaders = requestIdSupplier.get(); if (Objects.nonNull(httpHeaders) && httpHeaders.getSize() > 0) { for (HttpHeader header : httpHeaders) { String requestIdHeaderValue = context.getHttpRequest().getHeaders(...
HttpHeaders httpHeaders = requestIdSupplier.get();
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { HttpHeaders httpHeaders = requestIdSupplier.get(); if (Objects.nonNull(httpHeaders) && httpHeaders.getSize() > 0) { for (HttpHeader header : httpHeaders) { String requestIdHeaderValue = context.getHttpRequest().getHeaders(...
class RequestIdPolicy implements HttpPipelinePolicy { private static final String REQUEST_ID_HEADER = "x-ms-client-request-id"; private final Supplier<HttpHeaders> requestIdSupplier; /** * Creates default {@link RequestIdPolicy}. */ public RequestIdPolicy() { requestIdSupplier = () -> new HttpHeaders().put(REQUEST_ID_H...
class RequestIdPolicy implements HttpPipelinePolicy { private static final String REQUEST_ID_HEADER = "x-ms-client-request-id"; private final Supplier<HttpHeaders> requestIdSupplier; /** * Creates default {@link RequestIdPolicy}. */ public RequestIdPolicy() { requestIdSupplier = () -> new HttpHeaders().put(REQUEST_ID_H...
OperatingSystemMXBean from java.lang.management does not have precise information of CPU usage in percentage , therefore using com.sun.management. Java.lang have https://docs.oracle.com/javase/7/docs/api/java/lang/management/OperatingSystemMXBean.html#getSystemLoadAverage(), which after running on VMs unable to get th...
private void printSystemInformation(StringBuilder stringBuilder) { try { long totalMemory = Runtime.getRuntime().totalMemory() / 1024; long freeMemory = Runtime.getRuntime().freeMemory() / 1024; long maxMemory = Runtime.getRuntime().maxMemory() / 1024; String used_Memory = totalMemory - freeMemory + " KB"; String avail...
OperatingSystemMXBean mbean = (com.sun.management.OperatingSystemMXBean)
private void printSystemInformation(StringBuilder stringBuilder) { try { long totalMemory = Runtime.getRuntime().totalMemory() / 1024; long freeMemory = Runtime.getRuntime().freeMemory() / 1024; long maxMemory = Runtime.getRuntime().maxMemory() / 1024; String usedMemory = totalMemory - freeMemory + " KB"; String availa...
class ClientSideRequestStatistics { private final static int MAX_SUPPLEMENTAL_REQUESTS_FOR_TO_STRING = 10; private final static DateTimeFormatter responseTimeFormatter = DateTimeFormatter.ofPattern("dd MMM yyyy HH:mm:ss.SSS").withLocale(Locale.US); private ZonedDateTime requestStartTime; private ZonedDateTime requestEn...
class ClientSideRequestStatistics { private final static int MAX_SUPPLEMENTAL_REQUESTS_FOR_TO_STRING = 10; private final static DateTimeFormatter responseTimeFormatter = DateTimeFormatter.ofPattern("dd MMM yyyy HH:mm:ss.SSS").withLocale(Locale.US); private final static OperatingSystemMXBean mbean = (com.sun.management....
This is oracle specific implementation. There are other JVMs too: IBM, Azul, Openjdk, etc, if the JVM is not oracle based implementation is com.sun.management available?
private void printSystemInformation(StringBuilder stringBuilder) { try { long totalMemory = Runtime.getRuntime().totalMemory() / 1024; long freeMemory = Runtime.getRuntime().freeMemory() / 1024; long maxMemory = Runtime.getRuntime().maxMemory() / 1024; String used_Memory = totalMemory - freeMemory + " KB"; String avail...
OperatingSystemMXBean mbean = (com.sun.management.OperatingSystemMXBean)
private void printSystemInformation(StringBuilder stringBuilder) { try { long totalMemory = Runtime.getRuntime().totalMemory() / 1024; long freeMemory = Runtime.getRuntime().freeMemory() / 1024; long maxMemory = Runtime.getRuntime().maxMemory() / 1024; String usedMemory = totalMemory - freeMemory + " KB"; String availa...
class ClientSideRequestStatistics { private final static int MAX_SUPPLEMENTAL_REQUESTS_FOR_TO_STRING = 10; private final static DateTimeFormatter responseTimeFormatter = DateTimeFormatter.ofPattern("dd MMM yyyy HH:mm:ss.SSS").withLocale(Locale.US); private ZonedDateTime requestStartTime; private ZonedDateTime requestEn...
class ClientSideRequestStatistics { private final static int MAX_SUPPLEMENTAL_REQUESTS_FOR_TO_STRING = 10; private final static DateTimeFormatter responseTimeFormatter = DateTimeFormatter.ofPattern("dd MMM yyyy HH:mm:ss.SSS").withLocale(Locale.US); private final static OperatingSystemMXBean mbean = (com.sun.management....
see this comment from stackoverflow around OperatingSystemMXBean > Thanks for this answer but i have observed that running this code increases CPU utilization by 30-40%. This means that we get increased CPU Utilization whenever we run this code from: https://stackoverflow.com/questions/19781087/using-operatingsystemm...
private void printSystemInformation(StringBuilder stringBuilder) { try { long totalMemory = Runtime.getRuntime().totalMemory() / 1024; long freeMemory = Runtime.getRuntime().freeMemory() / 1024; long maxMemory = Runtime.getRuntime().maxMemory() / 1024; String usedMemory = totalMemory - freeMemory + " KB"; String availa...
String systemCpuLoad = Double.toString(mbean.getSystemCpuLoad());
private void printSystemInformation(StringBuilder stringBuilder) { try { long totalMemory = Runtime.getRuntime().totalMemory() / 1024; long freeMemory = Runtime.getRuntime().freeMemory() / 1024; long maxMemory = Runtime.getRuntime().maxMemory() / 1024; String usedMemory = totalMemory - freeMemory + " KB"; String availa...
class ClientSideRequestStatistics { private final static int MAX_SUPPLEMENTAL_REQUESTS_FOR_TO_STRING = 10; private final static DateTimeFormatter responseTimeFormatter = DateTimeFormatter.ofPattern("dd MMM yyyy HH:mm:ss.SSS").withLocale(Locale.US); private ZonedDateTime requestStartTime; private ZonedDateTime requestEn...
class ClientSideRequestStatistics { private final static int MAX_SUPPLEMENTAL_REQUESTS_FOR_TO_STRING = 10; private final static DateTimeFormatter responseTimeFormatter = DateTimeFormatter.ofPattern("dd MMM yyyy HH:mm:ss.SSS").withLocale(Locale.US); private final static OperatingSystemMXBean mbean = (com.sun.management....
Openjdk has com.sun.management available , and is giving numbers. I will try with another jdk maybe IBM
private void printSystemInformation(StringBuilder stringBuilder) { try { long totalMemory = Runtime.getRuntime().totalMemory() / 1024; long freeMemory = Runtime.getRuntime().freeMemory() / 1024; long maxMemory = Runtime.getRuntime().maxMemory() / 1024; String used_Memory = totalMemory - freeMemory + " KB"; String avail...
OperatingSystemMXBean mbean = (com.sun.management.OperatingSystemMXBean)
private void printSystemInformation(StringBuilder stringBuilder) { try { long totalMemory = Runtime.getRuntime().totalMemory() / 1024; long freeMemory = Runtime.getRuntime().freeMemory() / 1024; long maxMemory = Runtime.getRuntime().maxMemory() / 1024; String usedMemory = totalMemory - freeMemory + " KB"; String availa...
class ClientSideRequestStatistics { private final static int MAX_SUPPLEMENTAL_REQUESTS_FOR_TO_STRING = 10; private final static DateTimeFormatter responseTimeFormatter = DateTimeFormatter.ofPattern("dd MMM yyyy HH:mm:ss.SSS").withLocale(Locale.US); private ZonedDateTime requestStartTime; private ZonedDateTime requestEn...
class ClientSideRequestStatistics { private final static int MAX_SUPPLEMENTAL_REQUESTS_FOR_TO_STRING = 10; private final static DateTimeFormatter responseTimeFormatter = DateTimeFormatter.ofPattern("dd MMM yyyy HH:mm:ss.SSS").withLocale(Locale.US); private final static OperatingSystemMXBean mbean = (com.sun.management....
Tested on AdoptSDk,IBM SDK , ZULU they all have support for com.sun.management
private void printSystemInformation(StringBuilder stringBuilder) { try { long totalMemory = Runtime.getRuntime().totalMemory() / 1024; long freeMemory = Runtime.getRuntime().freeMemory() / 1024; long maxMemory = Runtime.getRuntime().maxMemory() / 1024; String used_Memory = totalMemory - freeMemory + " KB"; String avail...
OperatingSystemMXBean mbean = (com.sun.management.OperatingSystemMXBean)
private void printSystemInformation(StringBuilder stringBuilder) { try { long totalMemory = Runtime.getRuntime().totalMemory() / 1024; long freeMemory = Runtime.getRuntime().freeMemory() / 1024; long maxMemory = Runtime.getRuntime().maxMemory() / 1024; String usedMemory = totalMemory - freeMemory + " KB"; String availa...
class ClientSideRequestStatistics { private final static int MAX_SUPPLEMENTAL_REQUESTS_FOR_TO_STRING = 10; private final static DateTimeFormatter responseTimeFormatter = DateTimeFormatter.ofPattern("dd MMM yyyy HH:mm:ss.SSS").withLocale(Locale.US); private ZonedDateTime requestStartTime; private ZonedDateTime requestEn...
class ClientSideRequestStatistics { private final static int MAX_SUPPLEMENTAL_REQUESTS_FOR_TO_STRING = 10; private final static DateTimeFormatter responseTimeFormatter = DateTimeFormatter.ofPattern("dd MMM yyyy HH:mm:ss.SSS").withLocale(Locale.US); private final static OperatingSystemMXBean mbean = (com.sun.management....
Thanks that was helpful
private void printSystemInformation(StringBuilder stringBuilder) { try { long totalMemory = Runtime.getRuntime().totalMemory() / 1024; long freeMemory = Runtime.getRuntime().freeMemory() / 1024; long maxMemory = Runtime.getRuntime().maxMemory() / 1024; String usedMemory = totalMemory - freeMemory + " KB"; String availa...
String systemCpuLoad = Double.toString(mbean.getSystemCpuLoad());
private void printSystemInformation(StringBuilder stringBuilder) { try { long totalMemory = Runtime.getRuntime().totalMemory() / 1024; long freeMemory = Runtime.getRuntime().freeMemory() / 1024; long maxMemory = Runtime.getRuntime().maxMemory() / 1024; String usedMemory = totalMemory - freeMemory + " KB"; String availa...
class ClientSideRequestStatistics { private final static int MAX_SUPPLEMENTAL_REQUESTS_FOR_TO_STRING = 10; private final static DateTimeFormatter responseTimeFormatter = DateTimeFormatter.ofPattern("dd MMM yyyy HH:mm:ss.SSS").withLocale(Locale.US); private ZonedDateTime requestStartTime; private ZonedDateTime requestEn...
class ClientSideRequestStatistics { private final static int MAX_SUPPLEMENTAL_REQUESTS_FOR_TO_STRING = 10; private final static DateTimeFormatter responseTimeFormatter = DateTimeFormatter.ofPattern("dd MMM yyyy HH:mm:ss.SSS").withLocale(Locale.US); private final static OperatingSystemMXBean mbean = (com.sun.management....
as long as you are using a shared collection from TestSuiteBase, you don't need to delete documents, the test framework will do that when needed. please remove deleteItem here and elsewhere
public void gatewayDiagnostics() throws CosmosClientException { CosmosItemProperties cosmosItemProperties = getCosmosItemProperties(); CosmosItemResponse createResponse = container.createItem(cosmosItemProperties); String diagnostics = createResponse.getCosmosResponseDiagnostics().toString(); assertThat(diagnostics).co...
deleteItem(createResponse);
public void gatewayDiagnostics() throws CosmosClientException { CosmosItemProperties cosmosItemProperties = getCosmosItemProperties(); CosmosItemResponse createResponse = container.createItem(cosmosItemProperties); String diagnostics = createResponse.getCosmosResponseDiagnostics().toString(); assertThat(diagnostics).co...
class CosmosResponseDiagnosticsTest extends TestSuiteBase { private CosmosClient gatewayClient; private CosmosClient directClient; private CosmosContainer container; private CosmosAsyncContainer cosmosAsyncContainer; @BeforeClass(groups = {"simple"}, timeOut = SETUP_TIMEOUT) public void beforeClass() throws Exception {...
class CosmosResponseDiagnosticsTest extends TestSuiteBase { private CosmosClient gatewayClient; private CosmosClient directClient; private CosmosContainer container; private CosmosAsyncContainer cosmosAsyncContainer; @BeforeClass(groups = {"simple"}, timeOut = SETUP_TIMEOUT) public void beforeClass() throws Exception {...
as long as you are using a shared collection from TestSuiteBase, you don't need to delete documents, the test framework will do that when needed. please remove deleteItem here and elsewhere
public void gatewayDiagnosticsOnException() throws CosmosClientException { CosmosItemProperties cosmosItemProperties = getCosmosItemProperties(); CosmosItemResponse createResponse = null; try { createResponse = this.container.createItem(cosmosItemProperties); CosmosItemRequestOptions cosmosItemRequestOptions = new Cosm...
deleteItem(createResponse);
public void gatewayDiagnosticsOnException() throws CosmosClientException { CosmosItemProperties cosmosItemProperties = getCosmosItemProperties(); CosmosItemResponse createResponse = null; try { createResponse = this.container.createItem(cosmosItemProperties); CosmosItemRequestOptions cosmosItemRequestOptions = new Cosm...
class CosmosResponseDiagnosticsTest extends TestSuiteBase { private CosmosClient gatewayClient; private CosmosClient directClient; private CosmosContainer container; private CosmosAsyncContainer cosmosAsyncContainer; @BeforeClass(groups = {"simple"}, timeOut = SETUP_TIMEOUT) public void beforeClass() throws Exception {...
class CosmosResponseDiagnosticsTest extends TestSuiteBase { private CosmosClient gatewayClient; private CosmosClient directClient; private CosmosContainer container; private CosmosAsyncContainer cosmosAsyncContainer; @BeforeClass(groups = {"simple"}, timeOut = SETUP_TIMEOUT) public void beforeClass() throws Exception {...
done
public void gatewayDiagnostics() throws CosmosClientException { CosmosItemProperties cosmosItemProperties = getCosmosItemProperties(); CosmosItemResponse createResponse = container.createItem(cosmosItemProperties); String diagnostics = createResponse.getCosmosResponseDiagnostics().toString(); assertThat(diagnostics).co...
deleteItem(createResponse);
public void gatewayDiagnostics() throws CosmosClientException { CosmosItemProperties cosmosItemProperties = getCosmosItemProperties(); CosmosItemResponse createResponse = container.createItem(cosmosItemProperties); String diagnostics = createResponse.getCosmosResponseDiagnostics().toString(); assertThat(diagnostics).co...
class CosmosResponseDiagnosticsTest extends TestSuiteBase { private CosmosClient gatewayClient; private CosmosClient directClient; private CosmosContainer container; private CosmosAsyncContainer cosmosAsyncContainer; @BeforeClass(groups = {"simple"}, timeOut = SETUP_TIMEOUT) public void beforeClass() throws Exception {...
class CosmosResponseDiagnosticsTest extends TestSuiteBase { private CosmosClient gatewayClient; private CosmosClient directClient; private CosmosContainer container; private CosmosAsyncContainer cosmosAsyncContainer; @BeforeClass(groups = {"simple"}, timeOut = SETUP_TIMEOUT) public void beforeClass() throws Exception {...
done
public void gatewayDiagnosticsOnException() throws CosmosClientException { CosmosItemProperties cosmosItemProperties = getCosmosItemProperties(); CosmosItemResponse createResponse = null; try { createResponse = this.container.createItem(cosmosItemProperties); CosmosItemRequestOptions cosmosItemRequestOptions = new Cosm...
deleteItem(createResponse);
public void gatewayDiagnosticsOnException() throws CosmosClientException { CosmosItemProperties cosmosItemProperties = getCosmosItemProperties(); CosmosItemResponse createResponse = null; try { createResponse = this.container.createItem(cosmosItemProperties); CosmosItemRequestOptions cosmosItemRequestOptions = new Cosm...
class CosmosResponseDiagnosticsTest extends TestSuiteBase { private CosmosClient gatewayClient; private CosmosClient directClient; private CosmosContainer container; private CosmosAsyncContainer cosmosAsyncContainer; @BeforeClass(groups = {"simple"}, timeOut = SETUP_TIMEOUT) public void beforeClass() throws Exception {...
class CosmosResponseDiagnosticsTest extends TestSuiteBase { private CosmosClient gatewayClient; private CosmosClient directClient; private CosmosContainer container; private CosmosAsyncContainer cosmosAsyncContainer; @BeforeClass(groups = {"simple"}, timeOut = SETUP_TIMEOUT) public void beforeClass() throws Exception {...
We should also consider what happens to the user agent strings that were generated with the released version of the API and how this change will impact the user data analytics. Do we have other languages also making these changes to the user agent string?
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { String overrideUserAgent = (String) context.getData(OVERRIDE_USER_AGENT_CONTEXT_KEY).orElse(null); String appendUserAgent = (String) context.getData(APPEND_USER_AGENT_CONTEXT_KEY).orElse(null); String userAgentValue; if (!...
String overrideUserAgent = (String) context.getData(OVERRIDE_USER_AGENT_CONTEXT_KEY).orElse(null);
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { String overrideUserAgent = (String) context.getData(OVERRIDE_USER_AGENT_CONTEXT_KEY).orElse(null); String appendUserAgent = (String) context.getData(APPEND_USER_AGENT_CONTEXT_KEY).orElse(null); String userAgentValue; if (!...
class UserAgentPolicy implements HttpPipelinePolicy { private static final String USER_AGENT = "User-Agent"; private static final String DEFAULT_USER_AGENT_HEADER = "azsdk-java"; /** * Key for {@link Context} to add a value which will override the User-Agent supplied in this policy in an ad-hoc * manner. */ public stat...
class UserAgentPolicy implements HttpPipelinePolicy { private static final String USER_AGENT = "User-Agent"; private static final String DEFAULT_USER_AGENT_HEADER = "azsdk-java"; /** * Key for {@link Context} to add a value which will override the User-Agent supplied in this policy in an ad-hoc * manner. */ public stat...
I'll search the other languages handling on this, if need be we can revert this portion of the change.
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { String overrideUserAgent = (String) context.getData(OVERRIDE_USER_AGENT_CONTEXT_KEY).orElse(null); String appendUserAgent = (String) context.getData(APPEND_USER_AGENT_CONTEXT_KEY).orElse(null); String userAgentValue; if (!...
String overrideUserAgent = (String) context.getData(OVERRIDE_USER_AGENT_CONTEXT_KEY).orElse(null);
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { String overrideUserAgent = (String) context.getData(OVERRIDE_USER_AGENT_CONTEXT_KEY).orElse(null); String appendUserAgent = (String) context.getData(APPEND_USER_AGENT_CONTEXT_KEY).orElse(null); String userAgentValue; if (!...
class UserAgentPolicy implements HttpPipelinePolicy { private static final String USER_AGENT = "User-Agent"; private static final String DEFAULT_USER_AGENT_HEADER = "azsdk-java"; /** * Key for {@link Context} to add a value which will override the User-Agent supplied in this policy in an ad-hoc * manner. */ public stat...
class UserAgentPolicy implements HttpPipelinePolicy { private static final String USER_AGENT = "User-Agent"; private static final String DEFAULT_USER_AGENT_HEADER = "azsdk-java"; /** * Key for {@link Context} to add a value which will override the User-Agent supplied in this policy in an ad-hoc * manner. */ public stat...
If this is null do we want to add a null value into the converted list?
private static BlobSignedIdentifier toBlobIdentifier(DataLakeSignedIdentifier identifier) { if (identifier == null) { return null; } return new BlobSignedIdentifier() .setId(identifier.getId()) .setAccessPolicy(Transforms.toBlobAccessPolicy(identifier.getAccessPolicy())); }
if (identifier == null) {
private static BlobSignedIdentifier toBlobIdentifier(DataLakeSignedIdentifier identifier) { if (identifier == null) { return null; } return new BlobSignedIdentifier() .setId(identifier.getId()) .setAccessPolicy(Transforms.toBlobAccessPolicy(identifier.getAccessPolicy())); }
class Transforms { static com.azure.storage.blob.models.PublicAccessType toBlobPublicAccessType(PublicAccessType fileSystemPublicAccessType) { if (fileSystemPublicAccessType == null) { return null; } return com.azure.storage.blob.models.PublicAccessType.fromString(fileSystemPublicAccessType.toString()); } private stati...
class Transforms { static com.azure.storage.blob.models.PublicAccessType toBlobPublicAccessType(PublicAccessType fileSystemPublicAccessType) { if (fileSystemPublicAccessType == null) { return null; } return com.azure.storage.blob.models.PublicAccessType.fromString(fileSystemPublicAccessType.toString()); } private stati...
Since the datalake API just calls into the blob API, we're basically just spitting out exactly what was given to us to pipe it to the corresponding type, so I think its fine to have that null check
private static BlobSignedIdentifier toBlobIdentifier(DataLakeSignedIdentifier identifier) { if (identifier == null) { return null; } return new BlobSignedIdentifier() .setId(identifier.getId()) .setAccessPolicy(Transforms.toBlobAccessPolicy(identifier.getAccessPolicy())); }
if (identifier == null) {
private static BlobSignedIdentifier toBlobIdentifier(DataLakeSignedIdentifier identifier) { if (identifier == null) { return null; } return new BlobSignedIdentifier() .setId(identifier.getId()) .setAccessPolicy(Transforms.toBlobAccessPolicy(identifier.getAccessPolicy())); }
class Transforms { static com.azure.storage.blob.models.PublicAccessType toBlobPublicAccessType(PublicAccessType fileSystemPublicAccessType) { if (fileSystemPublicAccessType == null) { return null; } return com.azure.storage.blob.models.PublicAccessType.fromString(fileSystemPublicAccessType.toString()); } private stati...
class Transforms { static com.azure.storage.blob.models.PublicAccessType toBlobPublicAccessType(PublicAccessType fileSystemPublicAccessType) { if (fileSystemPublicAccessType == null) { return null; } return com.azure.storage.blob.models.PublicAccessType.fromString(fileSystemPublicAccessType.toString()); } private stati...
minor spelling: thown -> thrown
private Mono<Void> run(CancellationToken cancellationToken) { return Flux.just(this) .flatMap(value -> this.leaseContainer.getAllLeases()) .collectList() .flatMap(allLeases -> { if (cancellationToken.isCancellationRequested()) return Mono.empty(); List<Lease> leasesToTake = this.partitionLoadBalancingStrategy.selectLea...
logger.warn("Unexpected exception thown while trying to acquire available leases", throwable);
private Mono<Void> run(CancellationToken cancellationToken) { return Flux.just(this) .flatMap(value -> this.leaseContainer.getAllLeases()) .collectList() .flatMap(allLeases -> { if (cancellationToken.isCancellationRequested()) return Mono.empty(); List<Lease> leasesToTake = this.partitionLoadBalancingStrategy.selectLea...
class PartitionLoadBalancerImpl implements PartitionLoadBalancer { private final Logger logger = LoggerFactory.getLogger(PartitionLoadBalancerImpl.class); private final PartitionController partitionController; private final LeaseContainer leaseContainer; private final PartitionLoadBalancingStrategy partitionLoadBalanci...
class PartitionLoadBalancerImpl implements PartitionLoadBalancer { private final Logger logger = LoggerFactory.getLogger(PartitionLoadBalancerImpl.class); private final PartitionController partitionController; private final LeaseContainer leaseContainer; private final PartitionLoadBalancingStrategy partitionLoadBalanci...
Should this call into the `byte[]` constructor instead? ```java this(Objects.requireNonNull(body, "'body' cannot be null.").array()); ```
public EventData(ByteBuffer body) { this.body = Objects.requireNonNull(body, "'body' cannot be null.").array(); this.context = Context.NONE; this.properties = new HashMap<>(); this.systemProperties = new SystemProperties(); }
this.body = Objects.requireNonNull(body, "'body' cannot be null.").array();
public EventData(ByteBuffer body) { this(Objects.requireNonNull(body, "'body' cannot be null.").array()); }
class EventData { /* * These are properties owned by the service and set when a message is received. */ static final Set<String> RESERVED_SYSTEM_PROPERTIES; private final Map<String, Object> properties; private final byte[] body; private final SystemProperties systemProperties; private Context context; static { final S...
class EventData { /* * These are properties owned by the service and set when a message is received. */ static final Set<String> RESERVED_SYSTEM_PROPERTIES; private final Map<String, Object> properties; private final byte[] body; private final SystemProperties systemProperties; private Context context; static { final S...
good catch. Fixed
public EventData(ByteBuffer body) { this.body = Objects.requireNonNull(body, "'body' cannot be null.").array(); this.context = Context.NONE; this.properties = new HashMap<>(); this.systemProperties = new SystemProperties(); }
this.body = Objects.requireNonNull(body, "'body' cannot be null.").array();
public EventData(ByteBuffer body) { this(Objects.requireNonNull(body, "'body' cannot be null.").array()); }
class EventData { /* * These are properties owned by the service and set when a message is received. */ static final Set<String> RESERVED_SYSTEM_PROPERTIES; private final Map<String, Object> properties; private final byte[] body; private final SystemProperties systemProperties; private Context context; static { final S...
class EventData { /* * These are properties owned by the service and set when a message is received. */ static final Set<String> RESERVED_SYSTEM_PROPERTIES; private final Map<String, Object> properties; private final byte[] body; private final SystemProperties systemProperties; private Context context; static { final S...
nit: Add a comment that we wanted to simulate the customer's program doing other work until it is ready to stop.
public static void main(String[] args) throws Exception { BlobContainerAsyncClient blobContainerAsyncClient = new BlobContainerClientBuilder() .connectionString(STORAGE_CONNECTION_STRING) .containerName("<< CONTAINER NAME >>") .sasToken(SAS_TOKEN_STRING) .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLev...
TimeUnit.MINUTES.sleep(5);
public static void main(String[] args) throws Exception { BlobContainerAsyncClient blobContainerAsyncClient = new BlobContainerClientBuilder() .connectionString(STORAGE_CONNECTION_STRING) .containerName("<< CONTAINER NAME >>") .sasToken(SAS_TOKEN_STRING) .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLev...
class EventProcessorBlobCheckpointStoreSample { private static final String EH_CONNECTION_STRING = ""; private static final String SAS_TOKEN_STRING = ""; private static final String STORAGE_CONNECTION_STRING = ""; public static final Consumer<PartitionEvent> PARTITION_PROCESSOR = partitionEvent -> { System.out.printf("...
class EventProcessorBlobCheckpointStoreSample { private static final String EH_CONNECTION_STRING = ""; private static final String SAS_TOKEN_STRING = ""; private static final String STORAGE_CONNECTION_STRING = ""; public static final Consumer<PartitionEvent> PARTITION_PROCESSOR = partitionEvent -> { System.out.printf("...
Please use diamond operator, you don't have to repeat time a second time. `ArrayList<Integer> a1 = new ArrayList<>();`
public void queryDocumentsArrayValue(){ FeedOptions options = new FeedOptions(); options.setEnableCrossPartitionQuery(true); options.setMaxDegreeOfParallelism(2); List<List<Integer>> expectedValues = new ArrayList<>(); ArrayList<Integer> a1 = new ArrayList<Integer>(); ArrayList<Integer> a2 = new ArrayList<Integer>(); a...
ArrayList<Integer> a1 = new ArrayList<Integer>();
public void queryDocumentsArrayValue(){ FeedOptions options = new FeedOptions(); options.setEnableCrossPartitionQuery(true); options.setMaxDegreeOfParallelism(2); Collection<List<List<Integer>>> expectedValues = new ArrayList<>(); List<List<Integer>> lists = new ArrayList<>(); List<Integer> a1 = new ArrayList<>(); Arra...
class ParallelDocumentQueryTest extends TestSuiteBase { private CosmosAsyncDatabase createdDatabase; private CosmosAsyncContainer createdCollection; private List<CosmosItemProperties> createdDocuments; private CosmosAsyncClient client; public String getCollectionLink() { return TestUtils.getCollectionNameLink(createdDa...
class ParallelDocumentQueryTest extends TestSuiteBase { private CosmosAsyncDatabase createdDatabase; private CosmosAsyncContainer createdCollection; private List<CosmosItemProperties> createdDocuments; private CosmosAsyncClient client; public String getCollectionLink() { return TestUtils.getCollectionNameLink(createdDa...
I don't see any assertion in the test. Are we asserting elsewhere?
public void queryDocumentsArrayValue(){ FeedOptions options = new FeedOptions(); options.setEnableCrossPartitionQuery(true); options.setMaxDegreeOfParallelism(2); List<List<Integer>> expectedValues = new ArrayList<>(); ArrayList<Integer> a1 = new ArrayList<Integer>(); ArrayList<Integer> a2 = new ArrayList<Integer>(); a...
queryObservable.map(feedResponse -> fetchedResults.addAll(feedResponse.getResults())).blockLast();
public void queryDocumentsArrayValue(){ FeedOptions options = new FeedOptions(); options.setEnableCrossPartitionQuery(true); options.setMaxDegreeOfParallelism(2); Collection<List<List<Integer>>> expectedValues = new ArrayList<>(); List<List<Integer>> lists = new ArrayList<>(); List<Integer> a1 = new ArrayList<>(); Arra...
class ParallelDocumentQueryTest extends TestSuiteBase { private CosmosAsyncDatabase createdDatabase; private CosmosAsyncContainer createdCollection; private List<CosmosItemProperties> createdDocuments; private CosmosAsyncClient client; public String getCollectionLink() { return TestUtils.getCollectionNameLink(createdDa...
class ParallelDocumentQueryTest extends TestSuiteBase { private CosmosAsyncDatabase createdDatabase; private CosmosAsyncContainer createdCollection; private List<CosmosItemProperties> createdDocuments; private CosmosAsyncClient client; public String getCollectionLink() { return TestUtils.getCollectionNameLink(createdDa...
I am not seeing any assertion in the test. Does test verify that the result is correct?
public void queryDocumentsPojo(){ FeedOptions options = new FeedOptions(); options.setEnableCrossPartitionQuery(true); options.setMaxDegreeOfParallelism(2); String query = "Select * from c"; Flux<FeedResponse<TestObject>> queryObservable = createdCollection.queryItems(query, options, TestObject.class); List<TestObject>...
System.out.println("fetchedResults = " + fetchedResults);
public void queryDocumentsPojo(){ FeedOptions options = new FeedOptions(); options.setEnableCrossPartitionQuery(true); options.setMaxDegreeOfParallelism(2); String query = "Select * from c"; Flux<FeedResponse<TestObject>> queryObservable = createdCollection.queryItems(query, options, TestObject.class); List<TestObject>...
class ParallelDocumentQueryTest extends TestSuiteBase { private CosmosAsyncDatabase createdDatabase; private CosmosAsyncContainer createdCollection; private List<CosmosItemProperties> createdDocuments; private CosmosAsyncClient client; public String getCollectionLink() { return TestUtils.getCollectionNameLink(createdDa...
class ParallelDocumentQueryTest extends TestSuiteBase { private CosmosAsyncDatabase createdDatabase; private CosmosAsyncContainer createdCollection; private List<CosmosItemProperties> createdDocuments; private CosmosAsyncClient client; public String getCollectionLink() { return TestUtils.getCollectionNameLink(createdDa...
Done
public void queryDocumentsArrayValue(){ FeedOptions options = new FeedOptions(); options.setEnableCrossPartitionQuery(true); options.setMaxDegreeOfParallelism(2); List<List<Integer>> expectedValues = new ArrayList<>(); ArrayList<Integer> a1 = new ArrayList<Integer>(); ArrayList<Integer> a2 = new ArrayList<Integer>(); a...
ArrayList<Integer> a1 = new ArrayList<Integer>();
public void queryDocumentsArrayValue(){ FeedOptions options = new FeedOptions(); options.setEnableCrossPartitionQuery(true); options.setMaxDegreeOfParallelism(2); Collection<List<List<Integer>>> expectedValues = new ArrayList<>(); List<List<Integer>> lists = new ArrayList<>(); List<Integer> a1 = new ArrayList<>(); Arra...
class ParallelDocumentQueryTest extends TestSuiteBase { private CosmosAsyncDatabase createdDatabase; private CosmosAsyncContainer createdCollection; private List<CosmosItemProperties> createdDocuments; private CosmosAsyncClient client; public String getCollectionLink() { return TestUtils.getCollectionNameLink(createdDa...
class ParallelDocumentQueryTest extends TestSuiteBase { private CosmosAsyncDatabase createdDatabase; private CosmosAsyncContainer createdCollection; private List<CosmosItemProperties> createdDocuments; private CosmosAsyncClient client; public String getCollectionLink() { return TestUtils.getCollectionNameLink(createdDa...
Added assertions
public void queryDocumentsPojo(){ FeedOptions options = new FeedOptions(); options.setEnableCrossPartitionQuery(true); options.setMaxDegreeOfParallelism(2); String query = "Select * from c"; Flux<FeedResponse<TestObject>> queryObservable = createdCollection.queryItems(query, options, TestObject.class); List<TestObject>...
System.out.println("fetchedResults = " + fetchedResults);
public void queryDocumentsPojo(){ FeedOptions options = new FeedOptions(); options.setEnableCrossPartitionQuery(true); options.setMaxDegreeOfParallelism(2); String query = "Select * from c"; Flux<FeedResponse<TestObject>> queryObservable = createdCollection.queryItems(query, options, TestObject.class); List<TestObject>...
class ParallelDocumentQueryTest extends TestSuiteBase { private CosmosAsyncDatabase createdDatabase; private CosmosAsyncContainer createdCollection; private List<CosmosItemProperties> createdDocuments; private CosmosAsyncClient client; public String getCollectionLink() { return TestUtils.getCollectionNameLink(createdDa...
class ParallelDocumentQueryTest extends TestSuiteBase { private CosmosAsyncDatabase createdDatabase; private CosmosAsyncContainer createdCollection; private List<CosmosItemProperties> createdDocuments; private CosmosAsyncClient client; public String getCollectionLink() { return TestUtils.getCollectionNameLink(createdDa...
Added assertions
public void queryDocumentsArrayValue(){ FeedOptions options = new FeedOptions(); options.setEnableCrossPartitionQuery(true); options.setMaxDegreeOfParallelism(2); List<List<Integer>> expectedValues = new ArrayList<>(); ArrayList<Integer> a1 = new ArrayList<Integer>(); ArrayList<Integer> a2 = new ArrayList<Integer>(); a...
queryObservable.map(feedResponse -> fetchedResults.addAll(feedResponse.getResults())).blockLast();
public void queryDocumentsArrayValue(){ FeedOptions options = new FeedOptions(); options.setEnableCrossPartitionQuery(true); options.setMaxDegreeOfParallelism(2); Collection<List<List<Integer>>> expectedValues = new ArrayList<>(); List<List<Integer>> lists = new ArrayList<>(); List<Integer> a1 = new ArrayList<>(); Arra...
class ParallelDocumentQueryTest extends TestSuiteBase { private CosmosAsyncDatabase createdDatabase; private CosmosAsyncContainer createdCollection; private List<CosmosItemProperties> createdDocuments; private CosmosAsyncClient client; public String getCollectionLink() { return TestUtils.getCollectionNameLink(createdDa...
class ParallelDocumentQueryTest extends TestSuiteBase { private CosmosAsyncDatabase createdDatabase; private CosmosAsyncContainer createdCollection; private List<CosmosItemProperties> createdDocuments; private CosmosAsyncClient client; public String getCollectionLink() { return TestUtils.getCollectionNameLink(createdDa...
@alzimmermsft - I've been thinking a bit to see how we can achieve the correct behavior here, i.e. avoiding 2 extra network calls consumer didn't ask us to perform, the new base type `ContinuablePagedFluxCore` will take care of this. I've updated the test to validate the expected next call count (i.e. 0). Please take a...
public void streamFirstPage() { TestPagedFlux<Integer> pagedFlux = getTestPagedFlux(5); PagedIterable<Integer> pagedIterable = new PagedIterable<>(pagedFlux); assertEquals(pagedResponses.get(0), pagedIterable.streamByPage().limit(1).collect(Collectors.toList()).get(0)); assertEquals(0, pagedFlux.getNextPageRetrievals()...
assertEquals(0, pagedFlux.getNextPageRetrievals());
public void streamFirstPage() { TestPagedFlux<Integer> pagedFlux = getTestPagedFlux(5); PagedIterable<Integer> pagedIterable = new PagedIterable<>(pagedFlux); assertEquals(pagedResponses.get(0), pagedIterable.streamByPage().limit(1).collect(Collectors.toList()).get(0)); assertEquals(0, pagedFlux.getNextPageRetrievals()...
class PagedIterableTest { private List<PagedResponse<Integer>> pagedResponses; private List<PagedResponse<String>> pagedStringResponses; private HttpHeaders httpHeaders = new HttpHeaders().put("header1", "value1").put("header2", "value2"); private HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, "http: private...
class PagedIterableTest { private List<PagedResponse<Integer>> pagedResponses; private List<PagedResponse<String>> pagedStringResponses; private HttpHeaders httpHeaders = new HttpHeaders().put("header1", "value1").put("header2", "value2"); private HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, "http: private...
I have no concerns, this is a great side affect of this change!
public void streamFirstPage() { TestPagedFlux<Integer> pagedFlux = getTestPagedFlux(5); PagedIterable<Integer> pagedIterable = new PagedIterable<>(pagedFlux); assertEquals(pagedResponses.get(0), pagedIterable.streamByPage().limit(1).collect(Collectors.toList()).get(0)); assertEquals(0, pagedFlux.getNextPageRetrievals()...
assertEquals(0, pagedFlux.getNextPageRetrievals());
public void streamFirstPage() { TestPagedFlux<Integer> pagedFlux = getTestPagedFlux(5); PagedIterable<Integer> pagedIterable = new PagedIterable<>(pagedFlux); assertEquals(pagedResponses.get(0), pagedIterable.streamByPage().limit(1).collect(Collectors.toList()).get(0)); assertEquals(0, pagedFlux.getNextPageRetrievals()...
class PagedIterableTest { private List<PagedResponse<Integer>> pagedResponses; private List<PagedResponse<String>> pagedStringResponses; private HttpHeaders httpHeaders = new HttpHeaders().put("header1", "value1").put("header2", "value2"); private HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, "http: private...
class PagedIterableTest { private List<PagedResponse<Integer>> pagedResponses; private List<PagedResponse<String>> pagedStringResponses; private HttpHeaders httpHeaders = new HttpHeaders().put("header1", "value1").put("header2", "value2"); private HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, "http: private...
Cool, thanks for the review Alan.
public void streamFirstPage() { TestPagedFlux<Integer> pagedFlux = getTestPagedFlux(5); PagedIterable<Integer> pagedIterable = new PagedIterable<>(pagedFlux); assertEquals(pagedResponses.get(0), pagedIterable.streamByPage().limit(1).collect(Collectors.toList()).get(0)); assertEquals(0, pagedFlux.getNextPageRetrievals()...
assertEquals(0, pagedFlux.getNextPageRetrievals());
public void streamFirstPage() { TestPagedFlux<Integer> pagedFlux = getTestPagedFlux(5); PagedIterable<Integer> pagedIterable = new PagedIterable<>(pagedFlux); assertEquals(pagedResponses.get(0), pagedIterable.streamByPage().limit(1).collect(Collectors.toList()).get(0)); assertEquals(0, pagedFlux.getNextPageRetrievals()...
class PagedIterableTest { private List<PagedResponse<Integer>> pagedResponses; private List<PagedResponse<String>> pagedStringResponses; private HttpHeaders httpHeaders = new HttpHeaders().put("header1", "value1").put("header2", "value2"); private HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, "http: private...
class PagedIterableTest { private List<PagedResponse<Integer>> pagedResponses; private List<PagedResponse<String>> pagedStringResponses; private HttpHeaders httpHeaders = new HttpHeaders().put("header1", "value1").put("header2", "value2"); private HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, "http: private...
and let's remove this FAQ entry once the PR is in: https://github.com/Azure/azure-sdk-for-java/wiki/Frequently-Asked-Questions#-why-does-synchronous-paged-iterator-fetches-2-pages-eagerly-when-iterating-by-page
public void streamFirstPage() { TestPagedFlux<Integer> pagedFlux = getTestPagedFlux(5); PagedIterable<Integer> pagedIterable = new PagedIterable<>(pagedFlux); assertEquals(pagedResponses.get(0), pagedIterable.streamByPage().limit(1).collect(Collectors.toList()).get(0)); assertEquals(0, pagedFlux.getNextPageRetrievals()...
assertEquals(0, pagedFlux.getNextPageRetrievals());
public void streamFirstPage() { TestPagedFlux<Integer> pagedFlux = getTestPagedFlux(5); PagedIterable<Integer> pagedIterable = new PagedIterable<>(pagedFlux); assertEquals(pagedResponses.get(0), pagedIterable.streamByPage().limit(1).collect(Collectors.toList()).get(0)); assertEquals(0, pagedFlux.getNextPageRetrievals()...
class PagedIterableTest { private List<PagedResponse<Integer>> pagedResponses; private List<PagedResponse<String>> pagedStringResponses; private HttpHeaders httpHeaders = new HttpHeaders().put("header1", "value1").put("header2", "value2"); private HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, "http: private...
class PagedIterableTest { private List<PagedResponse<Integer>> pagedResponses; private List<PagedResponse<String>> pagedStringResponses; private HttpHeaders httpHeaders = new HttpHeaders().put("header1", "value1").put("header2", "value2"); private HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, "http: private...
This can be simplified to: `this.isDone = token == null;`
public void customContinuationTokenSnippet() { class ContinuationState<C> { private C lastContinuationToken; private boolean isDone; ContinuationState(C token) { this.lastContinuationToken = token; } void setLastContinuationToken(C token) { this.isDone = token == null ? true : false; this.lastContinuationToken = token;...
this.isDone = token == null ? true : false;
public void customContinuationTokenSnippet() { class ContinuationState<C> { private C lastContinuationToken; private boolean isDone; ContinuationState(C token) { this.lastContinuationToken = token; } void setLastContinuationToken(C token) { this.isDone = token == null; this.lastContinuationToken = token; } C getLastCon...
class PagedFluxCoreJavaDocCodeSnippets { /** * Code snippets for extending from {@link ContinuablePagedFluxCore} and enabling custom continuation token. */ }
class PagedFluxCoreJavaDocCodeSnippets { /** * Code snippets for extending from {@link ContinuablePagedFluxCore} and enabling custom continuation token. */ }
yes, updated the PR.
public void customContinuationTokenSnippet() { class ContinuationState<C> { private C lastContinuationToken; private boolean isDone; ContinuationState(C token) { this.lastContinuationToken = token; } void setLastContinuationToken(C token) { this.isDone = token == null ? true : false; this.lastContinuationToken = token;...
this.isDone = token == null ? true : false;
public void customContinuationTokenSnippet() { class ContinuationState<C> { private C lastContinuationToken; private boolean isDone; ContinuationState(C token) { this.lastContinuationToken = token; } void setLastContinuationToken(C token) { this.isDone = token == null; this.lastContinuationToken = token; } C getLastCon...
class PagedFluxCoreJavaDocCodeSnippets { /** * Code snippets for extending from {@link ContinuablePagedFluxCore} and enabling custom continuation token. */ }
class PagedFluxCoreJavaDocCodeSnippets { /** * Code snippets for extending from {@link ContinuablePagedFluxCore} and enabling custom continuation token. */ }
Could introduce `IterableStream.of(List)` or similar to avoid null checks in these cases.
public IterableStream<ConfigurationSetting> getElements() { return items == null ? IterableStream.empty() : new IterableStream<>(items); }
return items == null ? IterableStream.empty() : new IterableStream<>(items);
public IterableStream<ConfigurationSetting> getElements() { return IterableStream.of(items); }
class ConfigurationSettingPage implements Page<ConfigurationSetting> { @JsonProperty("@nextLink") private String continuationToken; @JsonProperty("items") private List<ConfigurationSetting> items; /** * Gets the link to the next page. * * @return The link to the next page or {@code null} if there are no more resources ...
class ConfigurationSettingPage implements Page<ConfigurationSetting> { @JsonProperty("@nextLink") private String continuationToken; @JsonProperty("items") private List<ConfigurationSetting> items; /** * Gets the link to the next page. * * @return The link to the next page or {@code null} if there are no more resources ...
added `IterableStream.of(Iterable<T>)` factory method: if parameter to this factory is `null` then it return cached static empty stream otherwise it create a new `IterableStream` from the parameter.
public IterableStream<ConfigurationSetting> getElements() { return items == null ? IterableStream.empty() : new IterableStream<>(items); }
return items == null ? IterableStream.empty() : new IterableStream<>(items);
public IterableStream<ConfigurationSetting> getElements() { return IterableStream.of(items); }
class ConfigurationSettingPage implements Page<ConfigurationSetting> { @JsonProperty("@nextLink") private String continuationToken; @JsonProperty("items") private List<ConfigurationSetting> items; /** * Gets the link to the next page. * * @return The link to the next page or {@code null} if there are no more resources ...
class ConfigurationSettingPage implements Page<ConfigurationSetting> { @JsonProperty("@nextLink") private String continuationToken; @JsonProperty("items") private List<ConfigurationSetting> items; /** * Gets the link to the next page. * * @return The link to the next page or {@code null} if there are no more resources ...
Use logger.logAndThrow. Same to other places.
public static void httpsValidation(Object objectToCheck, String objectName, String endpoint, ClientLogger logger) { if (objectToCheck != null && !parseEndpoint(endpoint, logger).getScheme().equals(Constants.HTTPS)) { throw new IllegalArgumentException("Using a(n) " + objectName + " requires https"); } }
throw new IllegalArgumentException("Using a(n) " + objectName + " requires https");
public static void httpsValidation(Object objectToCheck, String objectName, String endpoint, ClientLogger logger) { if (objectToCheck != null && !parseEndpoint(endpoint, logger).getScheme().equals(Constants.HTTPS)) { throw logger.logExceptionAsError(new IllegalArgumentException( "Using a(n) " + objectName + " requires ...
class BuilderHelper { private static final String DEFAULT_USER_AGENT_NAME = "azure-storage-queue"; private static final String DEFAULT_USER_AGENT_VERSION = "12.1.0-beta.1"; private static final Pattern IP_URL_PATTERN = Pattern .compile("(?:\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})|(?:localhost)"); /** * Parse the endp...
class BuilderHelper { private static final String DEFAULT_USER_AGENT_NAME = "azure-storage-queue"; private static final String DEFAULT_USER_AGENT_VERSION = "12.1.0-beta.1"; private static final Pattern IP_URL_PATTERN = Pattern .compile("(?:\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})|(?:localhost)"); /** * Parse the endp...
Updated to use logger
public static void httpsValidation(Object objectToCheck, String objectName, String endpoint, ClientLogger logger) { if (objectToCheck != null && !parseEndpoint(endpoint, logger).getScheme().equals(Constants.HTTPS)) { throw new IllegalArgumentException("Using a(n) " + objectName + " requires https"); } }
throw new IllegalArgumentException("Using a(n) " + objectName + " requires https");
public static void httpsValidation(Object objectToCheck, String objectName, String endpoint, ClientLogger logger) { if (objectToCheck != null && !parseEndpoint(endpoint, logger).getScheme().equals(Constants.HTTPS)) { throw logger.logExceptionAsError(new IllegalArgumentException( "Using a(n) " + objectName + " requires ...
class BuilderHelper { private static final String DEFAULT_USER_AGENT_NAME = "azure-storage-queue"; private static final String DEFAULT_USER_AGENT_VERSION = "12.1.0-beta.1"; private static final Pattern IP_URL_PATTERN = Pattern .compile("(?:\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})|(?:localhost)"); /** * Parse the endp...
class BuilderHelper { private static final String DEFAULT_USER_AGENT_NAME = "azure-storage-queue"; private static final String DEFAULT_USER_AGENT_VERSION = "12.1.0-beta.1"; private static final Pattern IP_URL_PATTERN = Pattern .compile("(?:\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})|(?:localhost)"); /** * Parse the endp...
Should this be in messages.properties?
private static int sizeof(Object obj) { if (obj instanceof String) { return obj.toString().length() << 1; } if (obj instanceof Symbol) { return ((Symbol) obj).length() << 1; } if (obj instanceof Integer) { return Integer.BYTES; } if (obj instanceof Long) { return Long.BYTES; } if (obj instanceof Short) { return Short.B...
throw new IllegalArgumentException(String.format("Encoding Type: %s is not supported",
private static int sizeof(Object obj) { if (obj instanceof String) { return obj.toString().length() << 1; } if (obj instanceof Symbol) { return ((Symbol) obj).length() << 1; } if (obj instanceof Integer) { return Integer.BYTES; } if (obj instanceof Long) { return Long.BYTES; } if (obj instanceof Short) { return Short.B...
class || clazz == EventHubProperties.class) { return deserializeManagementResponse(message, clazz); }
class || clazz == EventHubProperties.class) { return deserializeManagementResponse(message, clazz); }
Instead of having `flux` and `iterable` fields in this class, if an instance of IterableStream is created using an iterable, can this just be converted to `this.flux = Flux.fromIterable(Objects.requireNonNull(iterable, "'iterable' cannot be null."));`. Simplifies code in other methods too where you don't have to check ...
public IterableStream(Iterable<T> iterable) { this.iterable = Objects.requireNonNull(iterable, "'iterable' cannot be null."); this.flux = null; }
this.iterable = Objects.requireNonNull(iterable, "'iterable' cannot be null.");
public IterableStream(Iterable<T> iterable) { this.iterable = Objects.requireNonNull(iterable, "'iterable' cannot be null."); this.flux = null; }
class IterableStream<T> implements Iterable<T> { private final ClientLogger logger = new ClientLogger(IterableStream.class); private final Flux<T> flux; private final Iterable<T> iterable; /** * Creates an instance with the given {@link Flux}. * * @param flux Flux of items to iterate over. * @throws NullPointerExceptio...
class IterableStream<T> implements Iterable<T> { private final ClientLogger logger = new ClientLogger(IterableStream.class); private final Flux<T> flux; private final Iterable<T> iterable; /** * Creates an instance with the given {@link Flux}. * * @param flux Flux of items to iterate over. * @throws NullPointerExceptio...
Unfortunately this will result in that illegal state exception again because we are moving from sync to async world then back again. It was what the code was doing before this overload.
public IterableStream(Iterable<T> iterable) { this.iterable = Objects.requireNonNull(iterable, "'iterable' cannot be null."); this.flux = null; }
this.iterable = Objects.requireNonNull(iterable, "'iterable' cannot be null.");
public IterableStream(Iterable<T> iterable) { this.iterable = Objects.requireNonNull(iterable, "'iterable' cannot be null."); this.flux = null; }
class IterableStream<T> implements Iterable<T> { private final ClientLogger logger = new ClientLogger(IterableStream.class); private final Flux<T> flux; private final Iterable<T> iterable; /** * Creates an instance with the given {@link Flux}. * * @param flux Flux of items to iterate over. * @throws NullPointerExceptio...
class IterableStream<T> implements Iterable<T> { private final ClientLogger logger = new ClientLogger(IterableStream.class); private final Flux<T> flux; private final Iterable<T> iterable; /** * Creates an instance with the given {@link Flux}. * * @param flux Flux of items to iterate over. * @throws NullPointerExceptio...
nit: define a constant instead
public Stream<P> streamByPage() { return pagedFluxBase.byPage().toStream(1); }
return pagedFluxBase.byPage().toStream(1);
public Stream<P> streamByPage() { return pagedFluxBase.byPage().toStream(DEFAULT_BATCH_SIZE); }
class PagedIterableBase<T, P extends PagedResponse<T>> extends IterableStream<T> { private final PagedFluxBase<T, P> pagedFluxBase; /** * Creates instance given {@link PagedFluxBase}. * @param pagedFluxBase to use as iterable */ public PagedIterableBase(PagedFluxBase<T, P> pagedFluxBase) { super(pagedFluxBase); this.pa...
class PagedIterableBase<T, P extends PagedResponse<T>> extends IterableStream<T> { /* * This is the default batch size that will be requested when using stream or iterable by page, this will indicate * to Reactor how many elements should be prefetched before another batch is requested. */ private static final int DEFAU...
Should this just make a single call to CoreUtils?
public void testProperties() { assertNotNull(CoreUtils.getUserAgentPropertiesFromProperties("azure-core.properties").getVersion()); assertNotNull(CoreUtils.getUserAgentPropertiesFromProperties("azure-core.properties").getName()); assertTrue(CoreUtils.getUserAgentPropertiesFromProperties("azure-core.properties").getVers...
assertTrue(CoreUtils.getUserAgentPropertiesFromProperties("azure-core.properties").getVersion()
public void testProperties() { UserAgentProperties properties = CoreUtils.getUserAgentProperties("azure-core.properties"); assertFalse(properties.getName().matches("UnknownName")); assertTrue(CoreUtils.getUserAgentProperties("azure-core.properties").getVersion() .matches("\\d.\\d.\\d([-a-zA-Z0-9.])*")); }
class CoreUtilsTests { @Test public void findFirstOfTypeEmptyArgs() { assertNull(CoreUtils.findFirstOfType(null, Integer.class)); } @Test public void findFirstOfTypeWithOneOfType() { int expected = 1; Object[] args = { "string", expected }; int actual = CoreUtils.findFirstOfType(args, Integer.class); Assertions.assertE...
class CoreUtilsTests { @Test public void findFirstOfTypeEmptyArgs() { assertNull(CoreUtils.findFirstOfType(null, Integer.class)); } @Test public void findFirstOfTypeWithOneOfType() { int expected = 1; Object[] args = { "string", expected }; int actual = CoreUtils.findFirstOfType(args, Integer.class); Assertions.assertE...
Done. Will push in with another commit
public void testProperties() { assertNotNull(CoreUtils.getUserAgentPropertiesFromProperties("azure-core.properties").getVersion()); assertNotNull(CoreUtils.getUserAgentPropertiesFromProperties("azure-core.properties").getName()); assertTrue(CoreUtils.getUserAgentPropertiesFromProperties("azure-core.properties").getVers...
assertTrue(CoreUtils.getUserAgentPropertiesFromProperties("azure-core.properties").getVersion()
public void testProperties() { UserAgentProperties properties = CoreUtils.getUserAgentProperties("azure-core.properties"); assertFalse(properties.getName().matches("UnknownName")); assertTrue(CoreUtils.getUserAgentProperties("azure-core.properties").getVersion() .matches("\\d.\\d.\\d([-a-zA-Z0-9.])*")); }
class CoreUtilsTests { @Test public void findFirstOfTypeEmptyArgs() { assertNull(CoreUtils.findFirstOfType(null, Integer.class)); } @Test public void findFirstOfTypeWithOneOfType() { int expected = 1; Object[] args = { "string", expected }; int actual = CoreUtils.findFirstOfType(args, Integer.class); Assertions.assertE...
class CoreUtilsTests { @Test public void findFirstOfTypeEmptyArgs() { assertNull(CoreUtils.findFirstOfType(null, Integer.class)); } @Test public void findFirstOfTypeWithOneOfType() { int expected = 1; Object[] args = { "string", expected }; int actual = CoreUtils.findFirstOfType(args, Integer.class); Assertions.assertE...
`UnknownName` and `UnknownVersion` can also be made constants.
public static UserAgentProperties getUserAgentProperties(String propertiesFileName) { Map<String, String> propertyMap = getProperties(propertiesFileName); String name = propertyMap.getOrDefault(NAME, "UnknownName"); String version = propertyMap.getOrDefault(VERSION, "UnknownVersion"); return new UserAgentProperties(nam...
String name = propertyMap.getOrDefault(NAME, "UnknownName");
public static UserAgentProperties getUserAgentProperties(String propertiesFileName) { Map<String, String> propertyMap = getProperties(propertiesFileName); String name = propertyMap.getOrDefault(NAME, UNKNOWN_NAME); String version = propertyMap.getOrDefault(VERSION, UNKNOWN_VERSION); return new UserAgentProperties(name,...
class from an array of Objects. * @param args Array of objects to search through to find the first instance of the given `clazz` type. * @param clazz The type trying to be found. * @param <T> Generic type * @return The first object of the desired type, otherwise null. */ public static <T> T findFirstOfType(Object[] arg...
class from an array of Objects. * @param args Array of objects to search through to find the first instance of the given `clazz` type. * @param clazz The type trying to be found. * @param <T> Generic type * @return The first object of the desired type, otherwise null. */ public static <T> T findFirstOfType(Object[] arg...
Done.
public static UserAgentProperties getUserAgentProperties(String propertiesFileName) { Map<String, String> propertyMap = getProperties(propertiesFileName); String name = propertyMap.getOrDefault(NAME, "UnknownName"); String version = propertyMap.getOrDefault(VERSION, "UnknownVersion"); return new UserAgentProperties(nam...
String name = propertyMap.getOrDefault(NAME, "UnknownName");
public static UserAgentProperties getUserAgentProperties(String propertiesFileName) { Map<String, String> propertyMap = getProperties(propertiesFileName); String name = propertyMap.getOrDefault(NAME, UNKNOWN_NAME); String version = propertyMap.getOrDefault(VERSION, UNKNOWN_VERSION); return new UserAgentProperties(name,...
class from an array of Objects. * @param args Array of objects to search through to find the first instance of the given `clazz` type. * @param clazz The type trying to be found. * @param <T> Generic type * @return The first object of the desired type, otherwise null. */ public static <T> T findFirstOfType(Object[] arg...
class from an array of Objects. * @param args Array of objects to search through to find the first instance of the given `clazz` type. * @param clazz The type trying to be found. * @param <T> Generic type * @return The first object of the desired type, otherwise null. */ public static <T> T findFirstOfType(Object[] arg...
addressed
void run() throws Exception { successMeter = metricsRegistry.meter(" failureMeter = metricsRegistry.meter(" switch (configuration.getOperationType()) { case ReadLatency: case Mixed: latency = metricsRegistry.timer("Latency"); break; default: break; } reporter.start(configuration.getPrintingInterval(), TimeUnit.SECONDS)...
LatencyListener latencyListener = new LatencyListener(resultHandler, latency);
void run() throws Exception { successMeter = metricsRegistry.meter(" failureMeter = metricsRegistry.meter(" switch (configuration.getOperationType()) { case ReadLatency: case Mixed: latency = metricsRegistry.timer("Latency"); break; default: break; } reporter.start(configuration.getPrintingInterval(), TimeUnit.SECONDS)...
class LatencyListener<T> extends ResultHandler<T, Throwable> { private final ResultHandler<T, Throwable> baseFunction; Timer.Context context; LatencyListener(ResultHandler<T, Throwable> baseFunction, Timer latency) { this.baseFunction = baseFunction; } protected void init() { super.init(); context = latency.time(); } @...
class LatencyListener<T> extends ResultHandler<T, Throwable> { private final ResultHandler<T, Throwable> baseFunction; private final Timer latencyTimer; Timer.Context context; LatencyListener(ResultHandler<T, Throwable> baseFunction, Timer latencyTimer) { this.baseFunction = baseFunction; this.latencyTimer = latencyTim...
This is a good question that has gone unanswered for now, @rickle-msft thoughts? These could just be thrown back into the query string when the SAS token is generated, that way we are able to clean the SAS token using the SAS query parameters classes but don't lose custom query parameters unrelated to SAS tokens.
public ShareClientBuilder endpoint(String endpoint) { try { URL fullUrl = new URL(endpoint); this.endpoint = fullUrl.getProtocol() + ": this.accountName = BuilderHelper.getAccountName(fullUrl); String[] pathSegments = fullUrl.getPath().split("/"); int length = pathSegments.length; if (length > 3) { throw logger.logExce...
public ShareClientBuilder endpoint(String endpoint) { try { URL fullUrl = new URL(endpoint); this.endpoint = fullUrl.getProtocol() + ": this.accountName = BuilderHelper.getAccountName(fullUrl); String[] pathSegments = fullUrl.getPath().split("/"); int length = pathSegments.length; if (length > 3) { throw logger.logExce...
class ShareClientBuilder { private final ClientLogger logger = new ClientLogger(ShareClientBuilder.class); private String endpoint; private String accountName; private String shareName; private String snapshot; private StorageSharedKeyCredential storageSharedKeyCredential; private SasTokenCredential sasTokenCredential;...
class ShareClientBuilder { private final ClientLogger logger = new ClientLogger(ShareClientBuilder.class); private String endpoint; private String accountName; private String shareName; private String snapshot; private StorageSharedKeyCredential storageSharedKeyCredential; private SasTokenCredential sasTokenCredential;...
Created an issue here https://github.com/Azure/azure-sdk-for-java/issues/6604
public ShareClientBuilder endpoint(String endpoint) { try { URL fullUrl = new URL(endpoint); this.endpoint = fullUrl.getProtocol() + ": this.accountName = BuilderHelper.getAccountName(fullUrl); String[] pathSegments = fullUrl.getPath().split("/"); int length = pathSegments.length; if (length > 3) { throw logger.logExce...
public ShareClientBuilder endpoint(String endpoint) { try { URL fullUrl = new URL(endpoint); this.endpoint = fullUrl.getProtocol() + ": this.accountName = BuilderHelper.getAccountName(fullUrl); String[] pathSegments = fullUrl.getPath().split("/"); int length = pathSegments.length; if (length > 3) { throw logger.logExce...
class ShareClientBuilder { private final ClientLogger logger = new ClientLogger(ShareClientBuilder.class); private String endpoint; private String accountName; private String shareName; private String snapshot; private StorageSharedKeyCredential storageSharedKeyCredential; private SasTokenCredential sasTokenCredential;...
class ShareClientBuilder { private final ClientLogger logger = new ClientLogger(ShareClientBuilder.class); private String endpoint; private String accountName; private String shareName; private String snapshot; private StorageSharedKeyCredential storageSharedKeyCredential; private SasTokenCredential sasTokenCredential;...
Can you add some assertions here to test the hypothesis?
public void clientProvidedMultipleHeaderTest() throws Exception { String customRequestId = "request-id-value"; final HttpHeaders headers = new HttpHeaders(); headers.put("x-ms-client-request-id", customRequestId); headers.put("my-header1", "my-header1-value"); headers.put("my-header2", "my-header2-value"); final HttpPi...
pipeline.send(new HttpRequest(HttpMethod.GET, new URL("http:
public void clientProvidedMultipleHeaderTest() throws Exception { String customRequestId = "request-id-value"; final HttpHeaders headers = new HttpHeaders(); headers.put("x-ms-client-request-id", customRequestId); headers.put("my-header1", "my-header1-value"); headers.put("my-header2", "my-header2-value"); final HttpPi...
class AddHeadersFromContextPolicyTest { private final HttpResponse mockResponse = new HttpResponse(null) { @Override public int getStatusCode() { return 500; } @Override public String getHeaderValue(String name) { return null; } @Override public HttpHeaders getHeaders() { return new HttpHeaders(); } @Override public Mo...
class AddHeadersFromContextPolicyTest { private final HttpResponse mockResponse = new HttpResponse(null) { @Override public int getStatusCode() { return 500; } @Override public String getHeaderValue(String name) { return null; } @Override public HttpHeaders getHeaders() { return new HttpHeaders(); } @Override public Mo...
This could be replaced with ```java context.getData(AZURE_REQUEST_HTTP_HEADERS_KEY).ifPresent(headers -> { // for loop over headers }); ```
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { Optional<Object> customHttpHeadersObject = context.getData(AZURE_REQUEST_HTTP_HEADERS_KEY); if (customHttpHeadersObject.isPresent() && customHttpHeadersObject.get() instanceof HttpHeaders) { HttpHeaders customHttpHeaders =...
HttpHeaders customHttpHeaders = (HttpHeaders) customHttpHeadersObject.get();
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { context.getData(AZURE_REQUEST_HTTP_HEADERS_KEY).ifPresent(headers -> { if (headers instanceof HttpHeaders) { HttpHeaders customHttpHeaders = (HttpHeaders) headers; for (HttpHeader httpHeader : customHttpHeaders) { if (!Obj...
class AddHeadersFromContextPolicy implements HttpPipelinePolicy { @Override }
class AddHeadersFromContextPolicy implements HttpPipelinePolicy { /**Key used to override headers in HttpRequest. The Value for this key should be {@link HttpHeaders}.*/ public static final String AZURE_REQUEST_HTTP_HEADERS_KEY = "azure-http-headers-key"; @Override }
The variable is not named `messageIdHeaderName`.
public RequestIdPolicy(String requestIdHeaderName) { this.requestIdHeaderName = Objects.requireNonNull(requestIdHeaderName, "messageIdHeaderName can not be null."); }
"messageIdHeaderName can not be null.");
public RequestIdPolicy(String requestIdHeaderName) { this.requestIdHeaderName = Objects.requireNonNull(requestIdHeaderName, "requestIdHeaderName can not be null."); }
class RequestIdPolicy implements HttpPipelinePolicy { private static final String REQUEST_ID_HEADER = "x-ms-client-request-id"; private final String requestIdHeaderName; /** * Creates {@link RequestIdPolicy} with provided {@code requestIdHeaderName}. * @param requestIdHeaderName to be used to set in {@link HttpRequest...
class RequestIdPolicy implements HttpPipelinePolicy { private static final String REQUEST_ID_HEADER = "x-ms-client-request-id"; private final String requestIdHeaderName; /** * Creates {@link RequestIdPolicy} with provided {@code requestIdHeaderName}. * @param requestIdHeaderName to be used to set in {@link HttpRequest...
Removed all `String.format()`s, now using `StringBuilder.append` for all additions to the log message.
private Mono<String> logRequest(final ClientLogger logger, final HttpRequest request) { /* * Logging is either disabled or the logging level is above information (warning or error), this will result * in nothing being logged so perform a no-op. */ int numericLogLevel = LoggingUtil.getEnvironmentLoggingLevel().toNumeric...
Mono.just(requestLogMessage.append(String.format("%d-byte body:%n%s%n--> END %s%n",
private Mono<String> logRequest(final ClientLogger logger, final HttpRequest request) { int numericLogLevel = LoggingUtil.getEnvironmentLoggingLevel().toNumeric(); if (shouldLoggingBeSkipped(numericLogLevel)) { return Mono.empty(); } StringBuilder requestLogMessage = new StringBuilder(); if (httpLogDetailLevel.shouldLo...
class HttpLoggingPolicy implements HttpPipelinePolicy { private static final ObjectMapper PRETTY_PRINTER = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); private static final int MAX_BODY_LOG_SIZE = 1024 * 16; private static final String REDACTED_PLACEHOLDER = "REDACTED"; private static final String APP...
class HttpLoggingPolicy implements HttpPipelinePolicy { private static final ObjectMapper PRETTY_PRINTER = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); private static final int MAX_BODY_LOG_SIZE = 1024 * 16; private static final String REDACTED_PLACEHOLDER = "REDACTED"; private final HttpLogDetailLeve...
I am checking for `headers instanceof HttpHeaders` to make sure we do not have ClassCastException if end user did not set key as `HttpHeaders` .
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { context.getData(AZURE_REQUEST_HTTP_HEADERS_KEY).ifPresent(headers -> { if (headers instanceof HttpHeaders) { HttpHeaders customHttpHeaders = (HttpHeaders) headers; for (HttpHeader httpHeader : customHttpHeaders) { if (!Obj...
if (headers instanceof HttpHeaders) {
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { context.getData(AZURE_REQUEST_HTTP_HEADERS_KEY).ifPresent(headers -> { if (headers instanceof HttpHeaders) { HttpHeaders customHttpHeaders = (HttpHeaders) headers; for (HttpHeader httpHeader : customHttpHeaders) { if (!Obj...
class AddHeadersFromContextPolicy implements HttpPipelinePolicy { /**Key used to override headers in HttpRequest. The Value for this key should be {@link HttpHeaders}.*/ public static final String AZURE_REQUEST_HTTP_HEADERS_KEY = "azure-http-headers-key"; @Override }
class AddHeadersFromContextPolicy implements HttpPipelinePolicy { /**Key used to override headers in HttpRequest. The Value for this key should be {@link HttpHeaders}.*/ public static final String AZURE_REQUEST_HTTP_HEADERS_KEY = "azure-http-headers-key"; @Override }
Good catch, changed.
private Mono<String> logRequest(final ClientLogger logger, final HttpRequest request) { /* * Logging is either disabled or the logging level is above information (warning or error), this will result * in nothing being logged so perform a no-op. */ int numericLogLevel = LoggingUtil.getEnvironmentLoggingLevel().toNumeric...
|| numericLogLevel > LogLevel.INFORMATIONAL.toNumeric()) {
private Mono<String> logRequest(final ClientLogger logger, final HttpRequest request) { int numericLogLevel = LoggingUtil.getEnvironmentLoggingLevel().toNumeric(); if (shouldLoggingBeSkipped(numericLogLevel)) { return Mono.empty(); } StringBuilder requestLogMessage = new StringBuilder(); if (httpLogDetailLevel.shouldLo...
class HttpLoggingPolicy implements HttpPipelinePolicy { private static final ObjectMapper PRETTY_PRINTER = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); private static final int MAX_BODY_LOG_SIZE = 1024 * 16; private static final String REDACTED_PLACEHOLDER = "REDACTED"; private static final String APP...
class HttpLoggingPolicy implements HttpPipelinePolicy { private static final ObjectMapper PRETTY_PRINTER = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); private static final int MAX_BODY_LOG_SIZE = 1024 * 16; private static final String REDACTED_PLACEHOLDER = "REDACTED"; private final HttpLogDetailLeve...
Avoid using `String.format()` as this code gets executed for every request (if logging is enabled) and the performance of `String.format()` is bad. Also, the environment variable for logging might be set to a lower numeric value but the slf4j log level might be higher which means that all these strings will be created...
private Mono<String> logRequest(final ClientLogger logger, final HttpRequest request) { /* * Logging is either disabled or the logging level is above information (warning or error), this will result * in nothing being logged so perform a no-op. */ int numericLogLevel = LoggingUtil.getEnvironmentLoggingLevel().toNumeric...
Mono.just(requestLogMessage.append(String.format("%d-byte body:%n%s%n--> END %s%n",
private Mono<String> logRequest(final ClientLogger logger, final HttpRequest request) { int numericLogLevel = LoggingUtil.getEnvironmentLoggingLevel().toNumeric(); if (shouldLoggingBeSkipped(numericLogLevel)) { return Mono.empty(); } StringBuilder requestLogMessage = new StringBuilder(); if (httpLogDetailLevel.shouldLo...
class HttpLoggingPolicy implements HttpPipelinePolicy { private static final ObjectMapper PRETTY_PRINTER = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); private static final int MAX_BODY_LOG_SIZE = 1024 * 16; private static final String REDACTED_PLACEHOLDER = "REDACTED"; private static final String APP...
class HttpLoggingPolicy implements HttpPipelinePolicy { private static final ObjectMapper PRETTY_PRINTER = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); private static final int MAX_BODY_LOG_SIZE = 1024 * 16; private static final String REDACTED_PLACEHOLDER = "REDACTED"; private final HttpLogDetailLeve...
Can this condition be simplified by just using `numericLogLevel > LogLevel.INFORMATIONAL.toNumeric()` since `LogLevel.DISABLED` is 5?
private Mono<String> logRequest(final ClientLogger logger, final HttpRequest request) { /* * Logging is either disabled or the logging level is above information (warning or error), this will result * in nothing being logged so perform a no-op. */ int numericLogLevel = LoggingUtil.getEnvironmentLoggingLevel().toNumeric...
|| numericLogLevel > LogLevel.INFORMATIONAL.toNumeric()) {
private Mono<String> logRequest(final ClientLogger logger, final HttpRequest request) { int numericLogLevel = LoggingUtil.getEnvironmentLoggingLevel().toNumeric(); if (shouldLoggingBeSkipped(numericLogLevel)) { return Mono.empty(); } StringBuilder requestLogMessage = new StringBuilder(); if (httpLogDetailLevel.shouldLo...
class HttpLoggingPolicy implements HttpPipelinePolicy { private static final ObjectMapper PRETTY_PRINTER = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); private static final int MAX_BODY_LOG_SIZE = 1024 * 16; private static final String REDACTED_PLACEHOLDER = "REDACTED"; private static final String APP...
class HttpLoggingPolicy implements HttpPipelinePolicy { private static final ObjectMapper PRETTY_PRINTER = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); private static final int MAX_BODY_LOG_SIZE = 1024 * 16; private static final String REDACTED_PLACEHOLDER = "REDACTED"; private final HttpLogDetailLeve...
This is common code between logRequest() and logResponse(). This can be extracted as a method to reduce duplication.
private Mono<HttpResponse> logResponse(final ClientLogger logger, final HttpResponse response, long startNs) { /* * Logging is either disabled or the logging level is above information (warning or error), this will result * in nothing being logged so perform a no-op. */ int numericLogLevel = LoggingUtil.getEnvironmentL...
}
private Mono<HttpResponse> logResponse(final ClientLogger logger, final HttpResponse response, long startNs) { int numericLogLevel = LoggingUtil.getEnvironmentLoggingLevel().toNumeric(); if (shouldLoggingBeSkipped(numericLogLevel)) { return Mono.just(response); } long tookMs = TimeUnit.NANOSECONDS.toMillis(System.nanoT...
class HttpLoggingPolicy implements HttpPipelinePolicy { private static final ObjectMapper PRETTY_PRINTER = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); private static final int MAX_BODY_LOG_SIZE = 1024 * 16; private static final String REDACTED_PLACEHOLDER = "REDACTED"; private static final String APP...
class HttpLoggingPolicy implements HttpPipelinePolicy { private static final ObjectMapper PRETTY_PRINTER = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); private static final int MAX_BODY_LOG_SIZE = 1024 * 16; private static final String REDACTED_PLACEHOLDER = "REDACTED"; private final HttpLogDetailLeve...
Created a method for these.
private Mono<HttpResponse> logResponse(final ClientLogger logger, final HttpResponse response, long startNs) { /* * Logging is either disabled or the logging level is above information (warning or error), this will result * in nothing being logged so perform a no-op. */ int numericLogLevel = LoggingUtil.getEnvironmentL...
}
private Mono<HttpResponse> logResponse(final ClientLogger logger, final HttpResponse response, long startNs) { int numericLogLevel = LoggingUtil.getEnvironmentLoggingLevel().toNumeric(); if (shouldLoggingBeSkipped(numericLogLevel)) { return Mono.just(response); } long tookMs = TimeUnit.NANOSECONDS.toMillis(System.nanoT...
class HttpLoggingPolicy implements HttpPipelinePolicy { private static final ObjectMapper PRETTY_PRINTER = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); private static final int MAX_BODY_LOG_SIZE = 1024 * 16; private static final String REDACTED_PLACEHOLDER = "REDACTED"; private static final String APP...
class HttpLoggingPolicy implements HttpPipelinePolicy { private static final ObjectMapper PRETTY_PRINTER = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); private static final int MAX_BODY_LOG_SIZE = 1024 * 16; private static final String REDACTED_PLACEHOLDER = "REDACTED"; private final HttpLogDetailLeve...
This line can be moved inside `shouldLoggingBeSkipped()` as well and the method can be parameter-less.
private Mono<HttpResponse> logResponse(final ClientLogger logger, final HttpResponse response, long startNs) { int numericLogLevel = LoggingUtil.getEnvironmentLoggingLevel().toNumeric(); if (shouldLoggingBeSkipped(numericLogLevel)) { return Mono.just(response); } long tookMs = TimeUnit.NANOSECONDS.toMillis(System.nanoT...
int numericLogLevel = LoggingUtil.getEnvironmentLoggingLevel().toNumeric();
private Mono<HttpResponse> logResponse(final ClientLogger logger, final HttpResponse response, long startNs) { int numericLogLevel = LoggingUtil.getEnvironmentLoggingLevel().toNumeric(); if (shouldLoggingBeSkipped(numericLogLevel)) { return Mono.just(response); } long tookMs = TimeUnit.NANOSECONDS.toMillis(System.nanoT...
class HttpLoggingPolicy implements HttpPipelinePolicy { private static final ObjectMapper PRETTY_PRINTER = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); private static final int MAX_BODY_LOG_SIZE = 1024 * 16; private static final String REDACTED_PLACEHOLDER = "REDACTED"; private final HttpLogDetailLeve...
class HttpLoggingPolicy implements HttpPipelinePolicy { private static final ObjectMapper PRETTY_PRINTER = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); private static final int MAX_BODY_LOG_SIZE = 1024 * 16; private static final String REDACTED_PLACEHOLDER = "REDACTED"; private final HttpLogDetailLeve...
`numericLogLevel` is a parameter that is passed into adding headers to the log message, this is done to maintain a consistent logging state while the message is being generated. This will stay for now.
private Mono<HttpResponse> logResponse(final ClientLogger logger, final HttpResponse response, long startNs) { int numericLogLevel = LoggingUtil.getEnvironmentLoggingLevel().toNumeric(); if (shouldLoggingBeSkipped(numericLogLevel)) { return Mono.just(response); } long tookMs = TimeUnit.NANOSECONDS.toMillis(System.nanoT...
int numericLogLevel = LoggingUtil.getEnvironmentLoggingLevel().toNumeric();
private Mono<HttpResponse> logResponse(final ClientLogger logger, final HttpResponse response, long startNs) { int numericLogLevel = LoggingUtil.getEnvironmentLoggingLevel().toNumeric(); if (shouldLoggingBeSkipped(numericLogLevel)) { return Mono.just(response); } long tookMs = TimeUnit.NANOSECONDS.toMillis(System.nanoT...
class HttpLoggingPolicy implements HttpPipelinePolicy { private static final ObjectMapper PRETTY_PRINTER = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); private static final int MAX_BODY_LOG_SIZE = 1024 * 16; private static final String REDACTED_PLACEHOLDER = "REDACTED"; private final HttpLogDetailLeve...
class HttpLoggingPolicy implements HttpPipelinePolicy { private static final ObjectMapper PRETTY_PRINTER = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT); private static final int MAX_BODY_LOG_SIZE = 1024 * 16; private static final String REDACTED_PLACEHOLDER = "REDACTED"; private final HttpLogDetailLeve...
Instead of instantiating the `CloseHandlesInfo` object here should the reduce instead just begin with an integer and then map to `CloseHandlesInfo`. That way the object only needs to be created once instead of on each item emitted in the stream. ```java .stream.reduce(0, Integer::sum).map(CloseHandlesInfo::new) ```
public CloseHandlesInfo forceCloseAllHandles(Duration timeout, Context context) { return new PagedIterable<>(shareFileAsyncClient.forceCloseAllHandlesWithOptionalTimeout(timeout, context)) .stream().reduce(new CloseHandlesInfo(0), (accu, next) -> new CloseHandlesInfo(accu.getClosedHandles() + next.getClosedHandles()));...
.stream().reduce(new CloseHandlesInfo(0),
public CloseHandlesInfo forceCloseAllHandles(Duration timeout, Context context) { return new PagedIterable<>(shareFileAsyncClient.forceCloseAllHandlesWithOptionalTimeout(timeout, context)) .stream().reduce(new CloseHandlesInfo(0), (accu, next) -> new CloseHandlesInfo(accu.getClosedHandles() + next.getClosedHandles()));...
class ShareFileClient { private final ClientLogger logger = new ClientLogger(ShareFileClient.class); private final ShareFileAsyncClient shareFileAsyncClient; /** * Creates a ShareFileClient that wraps a ShareFileAsyncClient and requests. * * @param shareFileAsyncClient ShareFileAsyncClient that is used to send requests...
class ShareFileClient { private final ClientLogger logger = new ClientLogger(ShareFileClient.class); private final ShareFileAsyncClient shareFileAsyncClient; /** * Creates a ShareFileClient that wraps a ShareFileAsyncClient and requests. * * @param shareFileAsyncClient ShareFileAsyncClient that is used to send requests...
discussed offline about this
public CloseHandlesInfo forceCloseAllHandles(Duration timeout, Context context) { return new PagedIterable<>(shareFileAsyncClient.forceCloseAllHandlesWithOptionalTimeout(timeout, context)) .stream().reduce(new CloseHandlesInfo(0), (accu, next) -> new CloseHandlesInfo(accu.getClosedHandles() + next.getClosedHandles()));...
.stream().reduce(new CloseHandlesInfo(0),
public CloseHandlesInfo forceCloseAllHandles(Duration timeout, Context context) { return new PagedIterable<>(shareFileAsyncClient.forceCloseAllHandlesWithOptionalTimeout(timeout, context)) .stream().reduce(new CloseHandlesInfo(0), (accu, next) -> new CloseHandlesInfo(accu.getClosedHandles() + next.getClosedHandles()));...
class ShareFileClient { private final ClientLogger logger = new ClientLogger(ShareFileClient.class); private final ShareFileAsyncClient shareFileAsyncClient; /** * Creates a ShareFileClient that wraps a ShareFileAsyncClient and requests. * * @param shareFileAsyncClient ShareFileAsyncClient that is used to send requests...
class ShareFileClient { private final ClientLogger logger = new ClientLogger(ShareFileClient.class); private final ShareFileAsyncClient shareFileAsyncClient; /** * Creates a ShareFileClient that wraps a ShareFileAsyncClient and requests. * * @param shareFileAsyncClient ShareFileAsyncClient that is used to send requests...
If the exception is not an instance of RuntimeException, i.e. a checked exception, this statement `Exceptions.propagate(ex)` will throw ReactiveException wrapped around inner exception. We should make sure that we want that behavior, or we need to unwrap the exception wherever we depend on it. ``` public static Run...
CosmosItemResponse mapItemResponseAndBlock(Mono<CosmosAsyncItemResponse> itemMono) throws CosmosClientException { try { return itemMono .map(this::convertResponse) .block(); } catch (Exception ex) { final Throwable throwable = Exceptions.unwrap(ex); if (throwable instanceof CosmosClientException) { throw (CosmosClientE...
throw Exceptions.propagate(ex);
CosmosItemResponse mapItemResponseAndBlock(Mono<CosmosAsyncItemResponse> itemMono) throws CosmosClientException { try { return itemMono .map(this::convertResponse) .block(); } catch (Exception ex) { final Throwable throwable = Exceptions.unwrap(ex); if (throwable instanceof CosmosClientException) { throw (CosmosClientE...
class CosmosContainer { private final ClientLogger logger = new ClientLogger(CosmosContainer.class); private final CosmosAsyncContainer containerWrapper; private final CosmosDatabase database; private final String id; private CosmosScripts scripts; /** * Instantiates a new Cosmos sync container. * * @param id the id * ...
class CosmosContainer { private final CosmosAsyncContainer containerWrapper; private final CosmosDatabase database; private final String id; private CosmosScripts scripts; /** * Instantiates a new Cosmos sync container. * * @param id the id * @param database the database * @param container the container */ CosmosContai...
instead of `break`, can we return `value` here? I think it will make things more clear. We can add a `else` block at the end, and just return `value` from else condition.
static Object getValue(JsonNode value) { if (value.isValueNode()) { switch (value.getNodeType()) { case BOOLEAN: return value.asBoolean(); case NUMBER: if (value.isInt()) { return value.asInt(); } else if (value.isLong()) { return value.asLong(); } else if (value.isDouble()) { return value.asDouble(); } break; case STR...
break;
static Object getValue(JsonNode value) { if (value.isValueNode()) { switch (value.getNodeType()) { case BOOLEAN: return value.asBoolean(); case NUMBER: if (value.isInt()) { return value.asInt(); } else if (value.isLong()) { return value.asLong(); } else if (value.isDouble()) { return value.asDouble(); } else{ return va...
class JsonSerializable { private static final ObjectMapper OBJECT_MAPPER = Utils.getSimpleObjectMapper(); private final static Logger logger = LoggerFactory.getLogger(JsonSerializable.class); transient ObjectNode propertyBag = null; private ObjectMapper om; protected JsonSerializable() { this.propertyBag = OBJECT_MAPPE...
class JsonSerializable { private static final ObjectMapper OBJECT_MAPPER = Utils.getSimpleObjectMapper(); private final static Logger logger = LoggerFactory.getLogger(JsonSerializable.class); transient ObjectNode propertyBag = null; private ObjectMapper om; protected JsonSerializable() { this.propertyBag = OBJECT_MAPPE...
good point Kushagra. Thanks for catching this. Bhaskar can this be rolled back to what it used be? ie. `throw ex`? here and in other places.
CosmosItemResponse mapItemResponseAndBlock(Mono<CosmosAsyncItemResponse> itemMono) throws CosmosClientException { try { return itemMono .map(this::convertResponse) .block(); } catch (Exception ex) { final Throwable throwable = Exceptions.unwrap(ex); if (throwable instanceof CosmosClientException) { throw (CosmosClientE...
throw Exceptions.propagate(ex);
CosmosItemResponse mapItemResponseAndBlock(Mono<CosmosAsyncItemResponse> itemMono) throws CosmosClientException { try { return itemMono .map(this::convertResponse) .block(); } catch (Exception ex) { final Throwable throwable = Exceptions.unwrap(ex); if (throwable instanceof CosmosClientException) { throw (CosmosClientE...
class CosmosContainer { private final ClientLogger logger = new ClientLogger(CosmosContainer.class); private final CosmosAsyncContainer containerWrapper; private final CosmosDatabase database; private final String id; private CosmosScripts scripts; /** * Instantiates a new Cosmos sync container. * * @param id the id * ...
class CosmosContainer { private final CosmosAsyncContainer containerWrapper; private final CosmosDatabase database; private final String id; private CosmosScripts scripts; /** * Instantiates a new Cosmos sync container. * * @param id the id * @param database the database * @param container the container */ CosmosContai...
Missed rolling this back. I do a quick look and will revert all changes around these
CosmosItemResponse mapItemResponseAndBlock(Mono<CosmosAsyncItemResponse> itemMono) throws CosmosClientException { try { return itemMono .map(this::convertResponse) .block(); } catch (Exception ex) { final Throwable throwable = Exceptions.unwrap(ex); if (throwable instanceof CosmosClientException) { throw (CosmosClientE...
throw Exceptions.propagate(ex);
CosmosItemResponse mapItemResponseAndBlock(Mono<CosmosAsyncItemResponse> itemMono) throws CosmosClientException { try { return itemMono .map(this::convertResponse) .block(); } catch (Exception ex) { final Throwable throwable = Exceptions.unwrap(ex); if (throwable instanceof CosmosClientException) { throw (CosmosClientE...
class CosmosContainer { private final ClientLogger logger = new ClientLogger(CosmosContainer.class); private final CosmosAsyncContainer containerWrapper; private final CosmosDatabase database; private final String id; private CosmosScripts scripts; /** * Instantiates a new Cosmos sync container. * * @param id the id * ...
class CosmosContainer { private final CosmosAsyncContainer containerWrapper; private final CosmosDatabase database; private final String id; private CosmosScripts scripts; /** * Instantiates a new Cosmos sync container. * * @param id the id * @param database the database * @param container the container */ CosmosContai...
Done
static Object getValue(JsonNode value) { if (value.isValueNode()) { switch (value.getNodeType()) { case BOOLEAN: return value.asBoolean(); case NUMBER: if (value.isInt()) { return value.asInt(); } else if (value.isLong()) { return value.asLong(); } else if (value.isDouble()) { return value.asDouble(); } break; case STR...
break;
static Object getValue(JsonNode value) { if (value.isValueNode()) { switch (value.getNodeType()) { case BOOLEAN: return value.asBoolean(); case NUMBER: if (value.isInt()) { return value.asInt(); } else if (value.isLong()) { return value.asLong(); } else if (value.isDouble()) { return value.asDouble(); } else{ return va...
class JsonSerializable { private static final ObjectMapper OBJECT_MAPPER = Utils.getSimpleObjectMapper(); private final static Logger logger = LoggerFactory.getLogger(JsonSerializable.class); transient ObjectNode propertyBag = null; private ObjectMapper om; protected JsonSerializable() { this.propertyBag = OBJECT_MAPPE...
class JsonSerializable { private static final ObjectMapper OBJECT_MAPPER = Utils.getSimpleObjectMapper(); private final static Logger logger = LoggerFactory.getLogger(JsonSerializable.class); transient ObjectNode propertyBag = null; private ObjectMapper om; protected JsonSerializable() { this.propertyBag = OBJECT_MAPPE...
Ahh. That is correct. Thanks
public SettingSelector setKeyFilter(String keyFilter) { Objects.requireNonNull(keyFilter); this.keyFilter = keyFilter; return this; }
Objects.requireNonNull(keyFilter);
public SettingSelector setKeyFilter(String keyFilter) { this.keyFilter = keyFilter; return this; }
class SettingSelector { private String keyFilter; private String labelFilter; private SettingFields[] fields; private String acceptDatetime; /** * Creates a setting selector that will populate responses with all of the {@link ConfigurationSetting * ConfigurationSetting's} properties and select all {@link ConfigurationS...
class SettingSelector { private String keyFilter; private String labelFilter; private SettingFields[] fields; private String acceptDatetime; /** * Creates a setting selector that will populate responses with all of the {@link ConfigurationSetting * ConfigurationSetting's} properties and select all {@link ConfigurationS...
Done
CosmosItemResponse mapItemResponseAndBlock(Mono<CosmosAsyncItemResponse> itemMono) throws CosmosClientException { try { return itemMono .map(this::convertResponse) .block(); } catch (Exception ex) { final Throwable throwable = Exceptions.unwrap(ex); if (throwable instanceof CosmosClientException) { throw (CosmosClientE...
throw Exceptions.propagate(ex);
CosmosItemResponse mapItemResponseAndBlock(Mono<CosmosAsyncItemResponse> itemMono) throws CosmosClientException { try { return itemMono .map(this::convertResponse) .block(); } catch (Exception ex) { final Throwable throwable = Exceptions.unwrap(ex); if (throwable instanceof CosmosClientException) { throw (CosmosClientE...
class CosmosContainer { private final ClientLogger logger = new ClientLogger(CosmosContainer.class); private final CosmosAsyncContainer containerWrapper; private final CosmosDatabase database; private final String id; private CosmosScripts scripts; /** * Instantiates a new Cosmos sync container. * * @param id the id * ...
class CosmosContainer { private final CosmosAsyncContainer containerWrapper; private final CosmosDatabase database; private final String id; private CosmosScripts scripts; /** * Instantiates a new Cosmos sync container. * * @param id the id * @param database the database * @param container the container */ CosmosContai...
Should we deprecate this?
public CloseHandlesInfo(Integer closedHandles) { this.closedHandles = closedHandles; this.failedHandles = 0; }
this.failedHandles = 0;
public CloseHandlesInfo(Integer closedHandles) { this.closedHandles = closedHandles; this.failedHandles = 0; }
class CloseHandlesInfo { private final Integer closedHandles; private final Integer failedHandles; /** * Creates an instance of information about close handles. * * @param closedHandles The numbers of handles closed. */ /** * Creates an instance of information about close handles. * * @param closedHandles The numbers o...
class CloseHandlesInfo { private final Integer closedHandles; private final Integer failedHandles; /** * Creates an instance of information about close handles. * * @param closedHandles The numbers of handles closed. * Note : Failed handles was added as a parameter, default value for failed handles is 0 */ /** * Create...
Given that this class is generally only used by internal code but needs to be public to support it being returned I think having `failedHandles` being instantiated to 0 is a safe choice, it'll just need to be documented.
public CloseHandlesInfo(Integer closedHandles) { this.closedHandles = closedHandles; this.failedHandles = 0; }
this.failedHandles = 0;
public CloseHandlesInfo(Integer closedHandles) { this.closedHandles = closedHandles; this.failedHandles = 0; }
class CloseHandlesInfo { private final Integer closedHandles; private final Integer failedHandles; /** * Creates an instance of information about close handles. * * @param closedHandles The numbers of handles closed. */ /** * Creates an instance of information about close handles. * * @param closedHandles The numbers o...
class CloseHandlesInfo { private final Integer closedHandles; private final Integer failedHandles; /** * Creates an instance of information about close handles. * * @param closedHandles The numbers of handles closed. * Note : Failed handles was added as a parameter, default value for failed handles is 0 */ /** * Create...