---
# System prepended metadata

title: Untitled

---

A. 
```
2023-05-25 17:00:00,842 ERROR [org.qua.cor.JobRunShell] (QuarkusQuartzScheduler_Worker-24) Job DEFAULT.CloudSyncJob threw an unhandled Exception: : java.lang.IllegalStateException: Duplicate key fdf68577-eb25-47c2-81a8-050c5c0ca9f5 (attempted merging values LanePointServiceTimeDao{arrivedAt=2023-05-25T11:29:11Z, carId=fdf68577-eb25-47c2-81a8-050c5c0ca9f5, lanePoint=LanePoint{uuid=dc2d0bb0-b836-41e3-a6a2-d998a4f1c107, name='?????', type=ORDER, lane=Lane{uuid=6b8458c7-b926-4537-b039-6fab0c65f958, name='???????? ?????', type=STRAIGHT, status=ENABLED, updatedAt=2022-07-05T13:18:35.150Z, cloudSynced=true}, index=1, sensor=Sensor{uuid=fc58ff8e-7c6d-42d0-8b00-82674c30c182, deviceNumber='i_1', type=INDUCTIVE, status=ENABLED, cloudSynced=true}, position=NONE, status=ENABLED, pointKind=MAIN, updatedAt=2022-07-05T13:19:16.980Z}, serviceTime=5, queueSize=0, tier=FIRST} and LanePointServiceTimeDao{arrivedAt=2023-05-25T11:29:22Z, carId=fdf68577-eb25-47c2-81a8-050c5c0ca9f5, lanePoint=LanePoint{uuid=f044ac55-66a1-4d11-a018-0f03cf237513, name='?????', type=CHECKOUT, lane=Lane{uuid=6b8458c7-b926-4537-b039-6fab0c65f958, name='???????? ?????', type=STRAIGHT, status=ENABLED, updatedAt=2022-07-05T13:18:35.150Z, cloudSynced=true}, index=2, sensor=Sensor{uuid=b0b1267e-52d5-4253-bd9d-eea4e2a0f416, deviceNumber='i_2', type=INDUCTIVE, status=ENABLED, cloudSynced=true}, position=NONE, status=ENABLED, pointKind=MAIN, updatedAt=2022-07-08T13:16:07.443Z}, serviceTime=5, queueSize=0, tier=SECOND})
	at java.base/java.util.stream.Collectors.duplicateKeyException(Collectors.java:135)
	at java.base/java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:182)
	at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
	at com.icl_services.queue.cloud_sync.service.ServiceTimeService.elementReplication(ServiceTimeService.java:105)
	at com.icl_services.queue.cloud_sync.service.ServiceTimeService.lambda$replication$0(ServiceTimeService.java:79)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at com.icl_services.queue.cloud_sync.service.ServiceTimeService.replication(ServiceTimeService.java:79)
	at com.icl_services.queue.cloud_sync.job.CloudSyncJob.execute(CloudSyncJob.java:44)
	at com.icl_services.queue.cloud_sync.job.CloudSyncJob_Subclass.execute$$superforward1(Unknown Source)
	at com.icl_services.queue.cloud_sync.job.CloudSyncJob_Subclass$$function$$1.apply(Unknown Source)
	at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
	at com.icl_services.queue.common_shared_objects.interceptor.LicenseInterceptor.licenseInvocation(LicenseInterceptor.java:18)
	at com.icl_services.queue.common_shared_objects.interceptor.LicenseInterceptor_Bean.intercept(Unknown Source)
	at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
	at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
	at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:33)
	at com.icl_services.queue.cloud_sync.job.CloudSyncJob_Subclass.execute(Unknown Source)
	at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
```

```java=91
    private void elementReplication(UUID laneId, OffsetDateTime lastSyncedDate, int settingBatchSizeValue) {
        List<LaneServiceTime> laneServiceTimes =
              laneServiceTimeDao.findByLaneIdAndArrivedAtAfterGivenDate(laneId, lastSyncedDate);
        if (ObjectUtils.isEmpty(laneServiceTimes)) {
            checkAndUpdateLaneStatus(laneId);
            LOG.debug("Not data for lane {} to replication lane service time", laneId);
            return;
        }
        Set<UUID> replicationCars = laneServiceTimes.stream()
              .map(LaneServiceTime::getCarId)
              .collect(Collectors.toSet());
        List<LanePointServiceTime> lanePointServiceTimes =
              lanePointServiceTimeDao.findByArrivedAtAfterGivenDateAndCarIdIn(lastSyncedDate, replicationCars);
        Map<UUID, LanePointServiceTime> lanePointServiceTimesByCar = lanePointServiceTimes.stream()
              .collect(Collectors.toMap(LanePointServiceTime::getCarId, Function.identity()));

        int laneBatchSize = calculateLaneBatchSizeValue(settingBatchSizeValue, lanePointServiceTimes);
        List<List<LaneServiceTime>> laneServiceTimesDividedByBatchSize =
              ListUtils.partition(laneServiceTimes, laneBatchSize);

        laneServiceTimesDividedByBatchSize.forEach(partLaneServiceTime -> {
            Set<UUID> partCars = partLaneServiceTime.stream()
                  .map(LaneServiceTime::getCarId)
                  .collect(Collectors.toSet());
            List<LanePointServiceTime> partLanePoint = lanePointServiceTimesByCar.entrySet().stream()
                  .filter(e -> partCars.contains(e.getKey()))
                  .map(Map.Entry::getValue)
                  .collect(Collectors.toList());
            send(new ServiceTimeWrapperRequest(laneServiceTimeMapper.toRequests(partLaneServiceTime), lanePointServiceTimeMapper.toRequests(partLanePoint)));
            cloudSyncInfoDao.update(laneId, OffsetDateTime.now(),
                  partLaneServiceTime.stream()
                        .max(Comparator.comparing(LaneServiceTime::getArrivedAt)).get().getArrivedAt());
        });
        checkAndUpdateLaneStatus(laneId);
        LOG.debug("Lane service times for lane {} successfully send to the cloud", laneId);
    }
```

B. 

:::spoiler Logs
```=
2023-05-26 09:12:25,843 ERROR [org.qua.cor.JobRunShell] (QuarkusQuartzScheduler_Worker-12) Job DEFAULT.CloudSyncJob threw an unhandled Exception: : java.lang.RuntimeException: java.sql.SQLException: Acquisition timeout while waiting for new connection
	at com.icl_services.queue.jpa_shared_objects.config.NativeToolsConnectionManager.onBeginTransaction(NativeToolsConnectionManager.java:29)
	at com.icl_services.queue.jpa_shared_objects.config.NativeToolsConnectionManager_Bean.create(Unknown Source)
	at com.icl_services.queue.jpa_shared_objects.config.NativeToolsConnectionManager_Bean.create(Unknown Source)
	at io.quarkus.narayana.jta.runtime.context.TransactionContext.get(TransactionContext.java:145)
	at io.quarkus.arc.InjectableContext.getIfActive(InjectableContext.java:60)
	at io.quarkus.arc.impl.ClientProxies.getDelegate(ClientProxies.java:30)
	at com.icl_services.queue.jpa_shared_objects.config.NativeToolsConnectionManager_ClientProxy.arc$delegate(Unknown Source)
	at com.icl_services.queue.jpa_shared_objects.config.NativeToolsConnectionManager_ClientProxy.getConnection(Unknown Source)
	at com.icl_services.queue.jpa_shared_objects.jpa.dao.postgresql.SensorDaoImpl.getAllBySyncStatus(SensorDaoImpl.java:248)
	at com.icl_services.queue.jpa_shared_objects.jpa.dao.postgresql.SensorDaoImpl_Subclass.getAllBySyncStatus$$superforward1(Unknown Source)
	at com.icl_services.queue.jpa_shared_objects.jpa.dao.postgresql.SensorDaoImpl_Subclass$$function$$2.apply(Unknown Source)
	at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
	at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:133)
	at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:104)
	at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired.doIntercept(TransactionalInterceptorRequired.java:38)
	at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.intercept(TransactionalInterceptorBase.java:58)
	at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired.intercept(TransactionalInterceptorRequired.java:32)
	at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired_Bean.intercept(Unknown Source)
	at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
	at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
	at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:33)
	at com.icl_services.queue.jpa_shared_objects.jpa.dao.postgresql.SensorDaoImpl_Subclass.getAllBySyncStatus(Unknown Source)
	at com.icl_services.queue.jpa_shared_objects.jpa.dao.postgresql.SensorDaoImpl_ClientProxy.getAllBySyncStatus(Unknown Source)
	at com.icl_services.queue.cloud_sync.service.ReplicationCloudService.sensorReplication(ReplicationCloudService.java:47)
	at com.icl_services.queue.cloud_sync.job.CloudSyncJob.execute(CloudSyncJob.java:41)
	at com.icl_services.queue.cloud_sync.job.CloudSyncJob_Subclass.execute$$superforward1(Unknown Source)
	at com.icl_services.queue.cloud_sync.job.CloudSyncJob_Subclass$$function$$1.apply(Unknown Source)
	at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
	at com.icl_services.queue.common_shared_objects.interceptor.LicenseInterceptor.licenseInvocation(LicenseInterceptor.java:18)
	at com.icl_services.queue.common_shared_objects.interceptor.LicenseInterceptor_Bean.intercept(Unknown Source)
	at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
	at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
	at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:33)
	at com.icl_services.queue.cloud_sync.job.CloudSyncJob_Subclass.execute(Unknown Source)
	at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Caused by: java.sql.SQLException: Acquisition timeout while waiting for new connection
	at io.agroal.pool.ConnectionPool.handlerFromSharedCache(ConnectionPool.java:320)
	at io.agroal.pool.ConnectionPool.getConnection(ConnectionPool.java:248)
	at io.agroal.pool.DataSource.getConnection(DataSource.java:86)
	at com.icl_services.queue.jpa_shared_objects.config.NativeToolsConnectionManager.onBeginTransaction(NativeToolsConnectionManager.java:27)
	... 35 more
Caused by: java.util.concurrent.TimeoutException
	at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:204)
	at io.agroal.pool.ConnectionPool.handlerFromSharedCache(ConnectionPool.java:296)
	... 38 more

2023-05-26 09:12:25,862 ERROR [org.qua.cor.ErrorLogger] (QuarkusQuartzScheduler_Worker-12) Job (DEFAULT.CloudSyncJob threw an exception.: org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: java.lang.RuntimeException: java.sql.SQLException: Acquisition timeout while waiting for new connection]
	at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Caused by: java.lang.RuntimeException: java.sql.SQLException: Acquisition timeout while waiting for new connection
	at com.icl_services.queue.jpa_shared_objects.config.NativeToolsConnectionManager.onBeginTransaction(NativeToolsConnectionManager.java:29)
	at com.icl_services.queue.jpa_shared_objects.config.NativeToolsConnectionManager_Bean.create(Unknown Source)
	at com.icl_services.queue.jpa_shared_objects.config.NativeToolsConnectionManager_Bean.create(Unknown Source)
	at io.quarkus.narayana.jta.runtime.context.TransactionContext.get(TransactionContext.java:145)
	at io.quarkus.arc.InjectableContext.getIfActive(InjectableContext.java:60)
	at io.quarkus.arc.impl.ClientProxies.getDelegate(ClientProxies.java:30)
	at com.icl_services.queue.jpa_shared_objects.config.NativeToolsConnectionManager_ClientProxy.arc$delegate(Unknown Source)
	at com.icl_services.queue.jpa_shared_objects.config.NativeToolsConnectionManager_ClientProxy.getConnection(Unknown Source)
	at com.icl_services.queue.jpa_shared_objects.jpa.dao.postgresql.SensorDaoImpl.getAllBySyncStatus(SensorDaoImpl.java:248)
	at com.icl_services.queue.jpa_shared_objects.jpa.dao.postgresql.SensorDaoImpl_Subclass.getAllBySyncStatus$$superforward1(Unknown Source)
	at com.icl_services.queue.jpa_shared_objects.jpa.dao.postgresql.SensorDaoImpl_Subclass$$function$$2.apply(Unknown Source)
	at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
	at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:133)
	at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:104)
	at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired.doIntercept(TransactionalInterceptorRequired.java:38)
	at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.intercept(TransactionalInterceptorBase.java:58)
	at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired.intercept(TransactionalInterceptorRequired.java:32)
	at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired_Bean.intercept(Unknown Source)
	at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
	at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
	at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:33)
	at com.icl_services.queue.jpa_shared_objects.jpa.dao.postgresql.SensorDaoImpl_Subclass.getAllBySyncStatus(Unknown Source)
	at com.icl_services.queue.jpa_shared_objects.jpa.dao.postgresql.SensorDaoImpl_ClientProxy.getAllBySyncStatus(Unknown Source)
	at com.icl_services.queue.cloud_sync.service.ReplicationCloudService.sensorReplication(ReplicationCloudService.java:47)
	at com.icl_services.queue.cloud_sync.job.CloudSyncJob.execute(CloudSyncJob.java:41)
	at com.icl_services.queue.cloud_sync.job.CloudSyncJob_Subclass.execute$$superforward1(Unknown Source)
	at com.icl_services.queue.cloud_sync.job.CloudSyncJob_Subclass$$function$$1.apply(Unknown Source)
	at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
	at com.icl_services.queue.common_shared_objects.interceptor.LicenseInterceptor.licenseInvocation(LicenseInterceptor.java:18)
	at com.icl_services.queue.common_shared_objects.interceptor.LicenseInterceptor_Bean.intercept(Unknown Source)
	at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
	at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
	at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:33)
	at com.icl_services.queue.cloud_sync.job.CloudSyncJob_Subclass.execute(Unknown Source)
	at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
	... 1 more
Caused by: java.sql.SQLException: Acquisition timeout while waiting for new connection
	at io.agroal.pool.ConnectionPool.handlerFromSharedCache(ConnectionPool.java:320)
	at io.agroal.pool.ConnectionPool.getConnection(ConnectionPool.java:248)
	at io.agroal.pool.DataSource.getConnection(DataSource.java:86)
	at com.icl_services.queue.jpa_shared_objects.config.NativeToolsConnectionManager.onBeginTransaction(NativeToolsConnectionManager.java:27)
	... 35 more
Caused by: java.util.concurrent.TimeoutException
	at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:204)
	at io.agroal.pool.ConnectionPool.handlerFromSharedCache(ConnectionPool.java:296)
	... 38 more


Process finished with exit code 130

```
