code: private CloseConnectionSynchronization getCloseConnectionSynchronization(boolean createIfNotFound)
     {
        try
        {
           Transaction tx = null;
           if (transactionIntegration != null)
              tx = transactionIntegration.getTransactionManager().getTransaction();
  
           if (tx != null && TxUtils.isActive(tx))
           {
              CloseConnectionSynchronization ccs = (CloseConnectionSynchronization)
                 transactionIntegration.getTransactionSynchronizationRegistry().
                 getResource(CLOSE_CONNECTION_SYNCHRONIZATION);
              
              if (ccs == null && createIfNotFound)
              {
                 ccs = new CloseConnectionSynchronization();
  
                 transactionIntegration.getTransactionSynchronizationRegistry().
                    putResource(CLOSE_CONNECTION_SYNCHRONIZATION, ccs);
  
                 transactionIntegration.getTransactionSynchronizationRegistry().registerInterposedSynchronization(ccs);
              }
  
              return ccs;
           }
        }
        catch (Throwable t)
        {
           log.debug("Unable to synchronize with transaction", t);
        }
  
        return null;
     }
docs: Get the CloseConnectionSynchronization instance
  @param createIfNotFound Create if not found
  @return The value