}
private Views getViews()
{
Transaction tx = txLocal.getTransaction();
GlobalTxSynchronization globalSync;
try
{
globalSync = txLocal.getGlobalSynchronization(tx);
}
catch(RollbackException e)
{
throw new EJBException("Transaction already marked to roll back: " + e.getMessage(), e);
}
catch(SystemException e)
{
throw new IllegalStateException("Failed to register transaction synchronization: " + e.getMessage());
}
if(globalSync == null)
throw new IllegalStateException("Global transaction synchronization is not available for transaction " + tx);
Views views = (Views) globalSync.getTxLocal(viewsTxLocalKey);
if(views == null)
{
views = new Views(tx);
globalSync.putTxLocal(viewsTxLocalKey, views);
globalSync.addSynchronization(new SchemaSynchronization(views));
}
return views;
}