当前位置: 首页>>代码示例>>Java>>正文


Java JtaPlatform类代码示例

本文整理汇总了Java中org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform的典型用法代码示例。如果您正苦于以下问题:Java JtaPlatform类的具体用法?Java JtaPlatform怎么用?Java JtaPlatform使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JtaPlatform类属于org.hibernate.engine.transaction.jta.platform.spi包,在下文中一共展示了JtaPlatform类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getJtaTransactionManager

import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform; //导入依赖的package包/类
protected TransactionManager getJtaTransactionManager(Session session) {
    SessionFactoryImplementor sessionFactoryImpl = null;
    if (sessionFactory instanceof SessionFactoryImplementor) {
        sessionFactoryImpl = ((SessionFactoryImplementor) sessionFactory);
    }
    else if (session != null) {
        SessionFactory internalFactory = session.getSessionFactory();
        if (internalFactory instanceof SessionFactoryImplementor) {
            sessionFactoryImpl = (SessionFactoryImplementor) internalFactory;
        }
    }

    if (sessionFactoryImpl == null) {
        return null;
    }

    ServiceBinding<JtaPlatform> sb = sessionFactory.getServiceRegistry().locateServiceBinding(JtaPlatform.class);
    if (sb == null) {
        return null;
    }

    return sb.getService().retrieveTransactionManager();
}
 
开发者ID:grails,项目名称:gorm-hibernate5,代码行数:24,代码来源:GrailsSessionContext.java

示例2: initiateService

import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform; //导入依赖的package包/类
@Override
@SuppressWarnings( {"unchecked"})
public JtaPlatform initiateService(Map configurationValues, ServiceRegistryImplementor registry) {
	final Object setting = configurationValues.get( AvailableSettings.JTA_PLATFORM );
	final JtaPlatform platform = registry.getService( StrategySelector.class ).resolveStrategy( JtaPlatform.class, setting );
	if ( platform == null ) {
		LOG.debugf( "No JtaPlatform was specified, checking resolver" );
		return registry.getService( JtaPlatformResolver.class ).resolveJtaPlatform( configurationValues, registry );
	}
	return platform;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:JtaPlatformInitiator.java

示例3: TransactionEnvironmentImpl

import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform; //导入依赖的package包/类
public TransactionEnvironmentImpl(SessionFactoryImpl sessionFactory) {
    this.sessionFactory = sessionFactory;
    this.statisticsImplementor = sessionFactory.getStatisticsImplementor();
    this.serviceRegistry = sessionFactory.getServiceRegistry();
    this.jdbcServices = serviceRegistry.getService( JdbcServices.class );
    this.jtaPlatform = serviceRegistry.getService( JtaPlatform.class );
    this.transactionFactory = serviceRegistry.getService( TransactionFactory.class );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:TransactionEnvironmentImpl.java

示例4: canAccessTransactionManager

import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform; //导入依赖的package包/类
private boolean canAccessTransactionManager() {
	try {
		return serviceRegistry.getService( JtaPlatform.class ).retrieveTransactionManager() != null;
	}
	catch (Exception e) {
		return false;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:SessionFactoryImpl.java

示例5: registerSynchronization

import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform; //导入依赖的package包/类
/**
    * Registers transaction synchronization with session in order to clean up and close the session when transaction
    * finishes.
    *
    * @param session
    *            Session to register into transaction synchronization. Cannot be null.
    * @return Returns <code>true</code> if the session was register into any available synchronization strategy,
    *         <code>false</code> otherwise.
    */
   private boolean registerSynchronization(final Session session) {
// Tries Spring's transaction manager synchronization.
if (TransactionSynchronizationManager.isSynchronizationActive()) {

    // If it's allowed, registers synchronization to cleanup session.
    TransactionSynchronizationManager.registerSynchronization(createTransactionSynchronization(session));
    return true;
} else {
    // Tries JTA transaction manager synchronization.
    JtaPlatform jtaPlatform = sessionFactory.getServiceRegistry().getService(JtaPlatform.class);

    // If it's allowed, registers synchronization to cleanup session.
    if (jtaPlatform.canRegisterSynchronization()) {
	List<TransactionSynchronization> synchronizations;

	synchronizations = Arrays.asList(createTransactionSynchronization(session));

	Synchronization jtaSync;
	jtaSync = new JtaAfterCompletionSynchronization(synchronizations);
	jtaPlatform.registerSynchronization(jtaSync);

	return true;
    }
}
return false;
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:36,代码来源:TransactionAwareSessionContext.java

示例6: SpringSessionContext

import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform; //导入依赖的package包/类
/**
 * Create a new SpringSessionContext for the given Hibernate SessionFactory.
 * @param sessionFactory the SessionFactory to provide current Sessions for
 */
public SpringSessionContext(SessionFactoryImplementor sessionFactory) {
	this.sessionFactory = sessionFactory;
	try {
		JtaPlatform jtaPlatform = sessionFactory.getServiceRegistry().getService(JtaPlatform.class);
		this.transactionManager = jtaPlatform.retrieveTransactionManager();
		if (this.transactionManager != null) {
			this.jtaSessionContext = new SpringJtaSessionContext(sessionFactory);
		}
	}
	catch (Exception ex) {
		LogFactory.getLog(SpringSessionContext.class).warn(
				"Could not introspect Hibernate JtaPlatform for SpringJtaSessionContext", ex);
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:19,代码来源:SpringSessionContext.java

示例7: getJtaPlatform

import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform; //导入依赖的package包/类
public JtaPlatform getJtaPlatform() {
	return jtaPlatform;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:Settings.java

示例8: setJtaPlatform

import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform; //导入依赖的package包/类
void setJtaPlatform(JtaPlatform jtaPlatform) {
	this.jtaPlatform = jtaPlatform;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:Settings.java

示例9: getServiceInitiated

import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform; //导入依赖的package包/类
@Override
public Class<JtaPlatform> getServiceInitiated() {
	return JtaPlatform.class;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:JtaPlatformInitiator.java

示例10: attemptToRegisterJtaSync

import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform; //导入依赖的package包/类
@SuppressWarnings({"unchecked"})
private void attemptToRegisterJtaSync() {
	if ( synchronizationRegistered ) {
		return;
	}

	final JtaPlatform jtaPlatform = getTransactionEnvironment().getJtaPlatform();
	if ( jtaPlatform == null ) {
		// if no jta platform was registered we wont be able to register a jta synchronization
		return;
	}

	// Has the local transaction (Hibernate facade) taken on the responsibility of driving the transaction inflow?
	if ( currentHibernateTransaction.isInitiator() ) {
		return;
	}

	final JoinStatus joinStatus = currentHibernateTransaction.getJoinStatus();
	if ( joinStatus != JoinStatus.JOINED ) {
		// the transaction is not (yet) joined, see if we should join...
		if ( !transactionContext.shouldAutoJoinTransaction() ) {
			// we are supposed to not auto join transactions; if the transaction is not marked for join
			// we cannot go any further in attempting to join (register sync).
			if ( joinStatus != JoinStatus.MARKED_FOR_JOINED ) {
				if (isDebugging) {
					LOG.debug( "Skipping JTA sync registration due to auto join checking" );
				}
				return;
			}
		}
	}

	// IMPL NOTE : At this point the local callback is the "maybe" one.  The only time that needs to change is if
	// we are able to successfully register the transaction synchronization in which case the local callback would become
	// non driving.  To that end, the following checks are simply opt outs where we are unable to register the
	// synchronization

	// Can we resister a synchronization
	if ( !jtaPlatform.canRegisterSynchronization() ) {
		if (isTracing) {
			LOG.trace( "registered JTA platform says we cannot currently register synchronization; skipping" );
		}
		return;
	}

	// Should we resister a synchronization
	if ( !transactionFactory().isJoinableJtaTransaction( this, currentHibernateTransaction ) ) {
		if (isTracing) {
			LOG.trace( "TransactionFactory reported no JTA transaction to join; skipping Synchronization registration" );
		}
		return;
	}

	jtaPlatform.registerSynchronization( new RegisteredSynchronization( getSynchronizationCallbackCoordinator() ) );
	getSynchronizationCallbackCoordinator().synchronizationRegistered();
	synchronizationRegistered = true;
	if (isDebugging) {
		LOG.debug( "successfully registered Synchronization" );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:61,代码来源:TransactionCoordinatorImpl.java

示例11: getJtaPlatform

import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform; //导入依赖的package包/类
@Override
public JtaPlatform getJtaPlatform() {
    return jtaPlatform;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:TransactionEnvironmentImpl.java

示例12: addJtaPlatforms

import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform; //导入依赖的package包/类
private void addJtaPlatforms(StrategySelectorImpl strategySelector, Class<? extends JtaPlatform> impl, String... names) {
	for ( String name : names ) {
		strategySelector.registerStrategyImplementor( JtaPlatform.class, name, impl );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:StrategySelectorBuilder.java

示例13: IgniteTransactionManagerFactory

import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform; //导入依赖的package包/类
public IgniteTransactionManagerFactory(JtaPlatform platform) {
	this.platform = platform;
}
 
开发者ID:hibernate,项目名称:hibernate-ogm-ignite,代码行数:4,代码来源:IgniteTransactionManagerFactory.java

示例14: injectServices

import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform; //导入依赖的package包/类
@Override
public void injectServices(ServiceRegistryImplementor serviceRegistryImplementor) {
	this.jtaPlatform = serviceRegistryImplementor.getService( JtaPlatform.class );
	this.jdbcServices = serviceRegistryImplementor.getService( JdbcServices.class );
}
 
开发者ID:hibernate,项目名称:hibernate-ogm-ignite,代码行数:6,代码来源:IgniteDatastoreProvider.java

示例15: extractJBossTransactionManager

import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform; //导入依赖的package包/类
private static TransactionManager extractJBossTransactionManager(EntityManagerFactory factory) {
    SessionFactoryImplementor sessionFactory = (SessionFactoryImplementor) ( (HibernateEntityManagerFactory) factory ).getSessionFactory();
    return sessionFactory.getServiceRegistry().getService( JtaPlatform.class ).retrieveTransactionManager();
}
 
开发者ID:srecon,项目名称:ignite-jpa,代码行数:5,代码来源:TestOgm.java


注:本文中的org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。