Source:
<code>protected int poll() throws Exception { shutdownRunningTask = null; pendingExchanges = 0; if (entityManager == null) { entityManager = entityManagerFactory.createEntityManager(); LOG.trace("Recreated EntityManager on {}", entityManager, this); } Object messagePolled = null; try { messagePolled = transactionTemplate.execute(new TransactionCallback<Object>() { public Object doInTransaction(TransactionStatus status) { if (getEndpoint().isJoinTransaction()) { entityManager.joinTransaction(); } Queue<DataHolder> answer = new LinkedList<DataHolder>(); Query query = getQueryFactory().createQuery(entityManager); configureParameters(query); LOG.trace("Created query {}", query); List<?> results = query.getResultList(); LOG.trace("Got result list from query {}", results); for (Object result : results) { DataHolder holder = new DataHolder(); holder.manager = entityManager; holder.result = result; holder.exchange = createExchange(result, entityManager); answer.add(holder); } PersistenceException cause = null; int messagePolled = 0; try { messagePolled = processBatch(CastUtils.cast(answer)); } catch (Exception e) { if (e instanceof PersistenceException) { cause = (PersistenceException) e; } else { cause = new PersistenceException(e); } } if (cause != null) { if (!isTransacted()) { LOG.warn("Error processing last message due: {}. Will commit all previous successful processed message, and ignore this last failure.", cause.getMessage(), cause); } else { throw cause; } } LOG.debug("Flushing EntityManager"); entityManager.flush(); entityManager.clear(); return messagePolled; } }); } catch (Exception e) { <START> LOG.info("Disposing EntityManager on due to coming transaction rollback", entityManager, this); <END> entityManager.close(); entityManager = null; throw new PersistenceException(e); } return getEndpoint().getCamelContext().getTypeConverter().convertTo(int.class, messagePolled); }</code><technical_language>turn this DEBUG level</technical_language>

Target:
protected int poll() throws Exception { shutdownRunningTask = null; pendingExchanges = 0; if (entityManager == null) { entityManager = entityManagerFactory.createEntityManager(); LOG.trace("Recreated EntityManager on {}", entityManager, this); } Object messagePolled = null; try { messagePolled = transactionTemplate.execute(new TransactionCallback<Object>() { public Object doInTransaction(TransactionStatus status) { if (getEndpoint().isJoinTransaction()) { entityManager.joinTransaction(); } Queue<DataHolder> answer = new LinkedList<DataHolder>(); Query query = getQueryFactory().createQuery(entityManager); configureParameters(query); LOG.trace("Created query {}", query); List<?> results = query.getResultList(); LOG.trace("Got result list from query {}", results); for (Object result : results) { DataHolder holder = new DataHolder(); holder.manager = entityManager; holder.result = result; holder.exchange = createExchange(result, entityManager); answer.add(holder); } PersistenceException cause = null; int messagePolled = 0; try { messagePolled = processBatch(CastUtils.cast(answer)); } catch (Exception e) { if (e instanceof PersistenceException) { cause = (PersistenceException) e; } else { cause = new PersistenceException(e); } } if (cause != null) { if (!isTransacted()) { LOG.warn("Error processing last message due: {}. Will commit all previous successful processed message, and ignore this last failure.", cause.getMessage(), cause); } else { throw cause; } } LOG.debug("Flushing EntityManager"); entityManager.flush(); entityManager.clear(); return messagePolled; } }); } catch (Exception e) { LOG.debug("Disposing EntityManager on due to coming transaction rollback", entityManager, this); entityManager.close(); entityManager = null; throw new PersistenceException(e); } return getEndpoint().getCamelContext().getTypeConverter().convertTo(int.class, messagePolled); }