txn.delistResource(xar, XAResource.TMSUCCESS); } catch (SystemException se) { se.printStackTrace();
public List getAllEmployeesByEmpStatus (String status) { try { return employeePersistence.findByEmpStatus(status); } catch (SystemException e) { e.printStackTrace(); return Collections.emptyList(); } }
Calendar c = Calendar.getInstance(); c.add(Calendar.MONTH, -6); Date halfYearAgo = c.getTime(); ClassLoader portalClassLoader = PortalClassLoaderUtil.getClassLoader(); DynamicQuery query = DynamicQueryFactoryUtil.forClass(MBThread.class, portalClassLoader) .add(PropertyFactoryUtil.forName("lastPostDate").le(halfYearAgo)).addOrder(OrderFactoryUtil.asc("lastPostDate")); try { List dynamicQuery = MBThreadLocalServiceUtil.dynamicQuery(query); for (Object object : dynamicQuery) { MBThread thread = (MBThread) object; MBThreadLocalServiceUtil.deleteMBThread(thread); } } catch (SystemException e) { e.printStackTrace(); }
} catch (SystemException e) { e.printStackTrace(); } catch (IllegalStateException e) {
public static void saveFileToCMS(ActionRequest aReq, long groupId, String fileName, File filenameWithPath) { try { ServiceContext serviceContext = ServiceContextFactory.getInstance( Group.class.getName(), aReq); // prevents duplicate entries based on unique title name Random rand = new Random(); Integer suffix = new Integer(rand.nextInt(10000)); DLAppServiceUtil.addFileEntry(groupId, 0, fileName, "application/vnd.ms-excel", fileName + suffix.toString(), "description goes here", "changelogname", filenameWithPath, serviceContext); //log.info("Successfully added the new file"); } catch (PortalException pe) { log.error("Portal Exception occurred while saving file to CMS"); pe.printStackTrace(); } catch (SystemException e) { log.error("System Exception occurred while saving file to CMS"); e.printStackTrace(); } }
Assert.fail(); } catch (SystemException e) { e.printStackTrace(); Assert.fail(); } catch (IllegalStateException e) {
Assert.fail(); } catch (SystemException e) { e.printStackTrace(); Assert.fail(); } catch (IllegalStateException e) {
/** * 重载父类方法,设置事务的状态标识为回滚状态 */ public void rollback() throws SQLException { JDBCTransaction tx = TransactionManager.getTransaction(); try { if(tx != null) tx.setRollbackOnly(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SystemException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch(Exception e) { e.printStackTrace(); } }
private void enlist(Transaction transaction, XAResource xaResource, Object key) throws SQLException { try { transaction.enlistResource(xaResource); transaction.registerSynchronization(new TransactionListener(key)); } catch (Exception e) { try { tm.setRollbackOnly(); } catch (IllegalStateException e1) { e1.printStackTrace(); } catch (SystemException e1) { e1.printStackTrace(); } } }
public Object[] retrieveActivityContextIDBySbbID(String sbbID) { logger.info("Retrieving ACs by sbb id [" + sbbID + "]"); // prepareBean(); boolean createdTx = false; Object[] ret = null; try { if (!txMgr.isInTx()) { txMgr.begin(); createdTx = true; } ret = listWithCriteria(true, true, LIST_BY_SBBID, sbbID); } catch (SystemException e) { e.printStackTrace(); } finally { if (createdTx) { try { txMgr.commit(); } catch (SystemException e) { e.printStackTrace(); } } } return ret; }
public Object[] retrieveActivityContextIDByActivityType( String fullQualifiedActivityClassName) { logger.info("Retrieving AC by activity class name[" + fullQualifiedActivityClassName + "]"); // prepareBean(); boolean createdTx = false; Object[] ret = null; try { if (!txMgr.isInTx()) { txMgr.begin(); createdTx = true; } ret = listWithCriteria(true, true, LIST_BY_ACTIVITY_CLASS, fullQualifiedActivityClassName); } catch (SystemException e) { e.printStackTrace(); } finally { if (createdTx) { try { txMgr.commit(); } catch (SystemException e) { e.printStackTrace(); } } } return ret; }
public Object[] listActivityContexts(boolean inDetails) { // prepareBean(); logger.info("Listing ACs with details[" + inDetails + "]"); boolean createdTx = false; Object[] ret = null; try { if (!txMgr.isInTx()) { txMgr.begin(); createdTx = true; } ret = listWithCriteria(false, inDetails, LIST_BY_NO_CRITERIA, null); } catch (SystemException e) { e.printStackTrace(); } finally { if (createdTx) { try { txMgr.commit(); } catch (SystemException e) { e.printStackTrace(); } } } return ret; }
public Object[] retrieveActivityContextIDBySbbEntityID(String sbbEID) { logger.info("Retrieving ACs by sbb entity id [" + sbbEID + "]"); // prepareBean(); boolean createdTx = false; Object[] ret = null; try { if (!txMgr.isInTx()) { txMgr.begin(); createdTx = true; } ret = listWithCriteria(true, true, LIST_BY_SBBENTITY, sbbEID); } catch (SystemException e) { e.printStackTrace(); } finally { if (createdTx) { try { txMgr.commit(); } catch (SystemException e) { e.printStackTrace(); } } } return ret; }
public Object[] retrieveActivityContextIDByResourceAdaptorEntityName( String entityName) { logger.info("Retrieving AC by entity name[" + entityName + "]"); // prepareBean(); boolean createdTx = false; Object[] ret = null; try { if (!txMgr.isInTx()) { txMgr.begin(); createdTx = true; } ret = listWithCriteria(true, true, LIST_BY_RAENTITY, entityName); } catch (SystemException e) { e.printStackTrace(); } finally { if (createdTx) { try { txMgr.commit(); } catch (SystemException e) { e.printStackTrace(); } } } return ret; }
/** * Performs initialization and transaction recovery. This is done after transactional resources (potentially in other extensions) have registered with the * transaction manager. */ public void onEvent(RuntimeRecover event) { synchronized (TransactionManagerImp.class) { ClassLoader old = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); tm = (TransactionManagerImp) TransactionManagerImp.getTransactionManager(); if (tm == null) { uts = new UserTransactionServiceImp(properties); uts.init(properties); tm = (TransactionManagerImp) TransactionManagerImp.getTransactionManager(); } if (timeout != -1) { try { tm.setTransactionTimeout(timeout); } catch (SystemException e) { e.printStackTrace(); } } } finally { Thread.currentThread().setContextClassLoader(old); } } }
/** * Performs initialization and transaction recovery. This is done after transactional resources (potentially in other extensions) have registered with the * transaction manager. */ public void onEvent(RuntimeRecover event) { synchronized (TransactionManagerImp.class) { ClassLoader old = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); tm = (TransactionManagerImp) TransactionManagerImp.getTransactionManager(); if (tm == null) { uts = new UserTransactionServiceImp(properties); uts.init(properties); tm = (TransactionManagerImp) TransactionManagerImp.getTransactionManager(); } if (timeout != -1) { try { tm.setTransactionTimeout(timeout); } catch (SystemException e) { e.printStackTrace(); } } } finally { Thread.currentThread().setContextClassLoader(old); } } }
public Map retrieveNamesToActivityContextIDMappings() { ActivityContextNamingFacilityImpl naming = (ActivityContextNamingFacilityImpl) container .getActivityContextNamingFacility(); boolean createdTx = false; Map ret = null; try { if (!txMgr.isInTx()) { txMgr.begin(); createdTx = true; } ret = naming.getBindings(); } catch (SystemException e) { e.printStackTrace(); } finally { if (createdTx) { try { txMgr.commit(); } catch (SystemException e) { e.printStackTrace(); } } } return ret; }
} catch (SystemException se) { se.printStackTrace();
public void oneItemSold(Item06 item) { try { ut.begin(); em.persist(item); // Get rid of this line in the book item.decreaseAvailableStock(); sendShippingMessage(); if (inventoryLevel(item) == 0) ut.rollback(); else ut.commit(); } catch (Exception e) { try { ut.rollback(); } catch (SystemException e1) { e1.printStackTrace(); } } }
public static FailureScopeController getFailureScopeController() { try { if (_failureScopeController == null) { final RecoveryDirector recoveryDirector = RecoveryDirectorImpl.instance(); if (recoveryDirector != null) { final FailureScope currentFailureScope = recoveryDirector.currentFailureScope(); final FailureScopeController fsc = new FailureScopeController(currentFailureScope); setFailureScopeController(fsc); } } } catch (SystemException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (tc.isDebugEnabled()) Tr.debug(tc, "getFailureScopeController", _failureScopeController); return _failureScopeController; } }