02-27-2023 11:54 AM
Hello,
I created a batch to get information about sites, persons and documents.
I used the alfresco-client-sdk project to call the webservices and search for information.
The project is documented in this blog.
Everything works well on my machine. But, when I deploy it on the PROD which a unix envirement (ubuntu), A java.net.SocketTimeoutException was thrown after calling the webservice more than 20 times (but with different afts queries).
The error message is the following.
Caused by: java.net.SocketTimeoutException: timeout at okio.Okio$3.newTimeoutException(Okio.java:210) at okio.AsyncTimeout.exit(AsyncTimeout.java:288) at okio.AsyncTimeout$2.read(AsyncTimeout.java:242) at okio.RealBufferedSource.indexOf(RealBufferedSource.java:325) at okio.RealBufferedSource.indexOf(RealBufferedSource.java:314) at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:210) at okhttp3.internal.http.Http1xStream.readResponse(Http1xStream.java:186) at okhttp3.internal.http.Http1xStream.readResponseHeaders(Http1xStream.java:127) at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:53) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:145) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at com.alfresco.client.AbstractClient$BasicAuthInterceptor.intercept(AbstractClient.java:254) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170) at okhttp3.RealCall.execute(RealCall.java:60) at retrofit2.OkHttpCall.execute(OkHttpCall.java:174) at com.custom.service.PeopleService.listSitePeopleByRole(PeopleService.java:84) at com.custom.batch.query.PersonQuery$PersonIterator.getPersonIterator(PersonQuery.java:91) ... 5 more Caused by: java.net.SocketException: Socket closed at java.net.SocketInputStream.read(SocketInputStream.java:183) at java.net.SocketInputStream.read(SocketInputStream.java:121) at okio.Okio$2.read(Okio.java:138) at okio.AsyncTimeout$2.read(AsyncTimeout.java:238) ... 34 more
the listSitePeopleByRole mthod is the following.
/* createQuery(siteId, role) return the query : PATH:"/sys:system/sys:authorities/cm:GROUP_site_<siteId>_<role>/*" AND TYPE:"cm:person" */ RequestQuery requestQuery = new RequestQuery().query(createQuery(siteId, role)).language(RequestQuery.LanguageEnum.AFTS); RequestPagination requestPagination = new RequestPagination().skipCount(skipCount).maxItems(maxItems); RequestSortDefinition requestSort = new RequestSortDefinition().field("id").ascending(true); QueryBody queryBody = new QueryBody().query(requestQuery).paging(requestPagination).sort(Collections.singletonList(requestSort)).include(Arrays.asList("properties")); return alfrescoClient.getSearchAPI().searchCall(queryBody).execute().body().getList().stream().map(nodeRep -> getPerson(role, nodeRep)).collect(Collectors.toList());
Explore our Alfresco products with the links below. Use labels to filter content by product module.