Facing a weird issue while fetching data from inventory using java sdk using the code :
final var collection = inventoryApi.getManagedObjectsByFilter(filter);
collection.get(2000).allPages().forEach(managedObject → {
// some code
});
Please let me know if anyone else ever faced such issue and the way to fix this.
Error logs:
java.lang.IllegalStateException: Client instance has been closed. at org.glassfish.jersey.internal.guava.Preconditions.checkState(Preconditions.java:169) at org.glassfish.jersey.client.JerseyClient.checkNotClosed(JerseyClient.java:257) at org.glassfish.jersey.client.JerseyClient.target(JerseyClient.java:272) at com.cumulocity.sdk.client.CumulocityHttpClient.target(CumulocityHttpClient.java:33) at com.cumulocity.sdk.client.CumulocityHttpClient.target(CumulocityHttpClient.java:19) at com.cumulocity.sdk.client.RestConnector.getClientResponse(RestConnector.java:130) at com.cumulocity.sdk.client.RestConnector.get(RestConnector.java:109) at com.cumulocity.sdk.client.PagedCollectionResourceImpl.getCollection(PagedCollectionResourceImpl.java:87) at com.cumulocity.sdk.client.PagedCollectionResourceImpl.getNextPage(PagedCollectionResourceImpl.java:100) at com.cumulocity.sdk.client.PagedCollectionIterable.hasNext(PagedCollectionIterable.java:46) at java.base/java.lang.Iterable.forEach(Iterable.java:74)