Java Code Examples for javax.ejb.TransactionAttributeType#REQUIRES_NEW
The following examples show how to use
javax.ejb.TransactionAttributeType#REQUIRES_NEW .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QueryExecutorBean.java From datawave with Apache License 2.0 | 6 votes |
@POST @Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf", "application/x-protostuff"}) @Path("/{logicName}/createAndNext") @GZIP @GenerateQuerySessionId(cookieBasePath = "/DataWave/Query/") @EnrichQueryMetrics(methodType = MethodType.CREATE_AND_NEXT) @Interceptors({ResponseInterceptor.class, RequiredInterceptor.class}) @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) @Timed(name = "dw.query.createAndNext", absolute = true) public BaseQueryResponse createQueryAndNext(@Required("logicName") @PathParam("logicName") String logicName, MultivaluedMap<String,String> queryParameters, @Context HttpHeaders httpHeaders) { CreateQuerySessionIDFilter.QUERY_ID.set(null); GenericResponse<String> createResponse = createQuery(logicName, queryParameters, httpHeaders); String queryId = createResponse.getResult(); CreateQuerySessionIDFilter.QUERY_ID.set(queryId); return next(queryId, false); }
Example 2
Source File: APPConfigurationServiceBean.java From development with Apache License 2.0 | 5 votes |
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void storeControllerConfigurationSettings(String controllerId, HashMap<String, Setting> settings) throws ConfigurationException { LOGGER.debug("Storing configuration settings for controller '{}'", controllerId); if (controllerId == null || settings == null) { throw new IllegalArgumentException("All parameters must be set"); } Query query = em .createNamedQuery("ConfigurationSetting.getForController"); query.setParameter("controllerId", controllerId); List<?> resultList = query.getResultList(); for (Object entry : resultList) { ConfigurationSetting setting = (ConfigurationSetting) entry; String key = setting.getSettingKey(); if (settings.containsKey(key)) { if (settings.get(key) == null || settings.get(key).getValue() == null) { em.remove(setting); } else { setting.setDecryptedValue(settings.get(key).getValue()); em.persist(setting); } settings.remove(key); } } for (String newKey : settings.keySet()) { ConfigurationSetting newSetting = new ConfigurationSetting(); newSetting.setControllerId(controllerId); newSetting.setSettingKey(newKey); newSetting.setDecryptedValue(settings.get(newKey) != null ? settings.get(newKey).getValue() : null); em.persist(newSetting); } }
Example 3
Source File: StatefulTransactionInCallbacksTest.java From tomee with Apache License 2.0 | 5 votes |
@PostConstruct @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void hasTxConstruct() { try { assertTrue(OpenEJB.getTransactionManager().getTransaction() != null); } catch (final SystemException e) { fail(e.getMessage()); } }
Example 4
Source File: TemporaryBuildsCleaner.java From pnc with Apache License 2.0 | 5 votes |
/** * Deletes a BuildConfigSetRecord and BuildRecords produced in the build * * @param buildConfigSetRecordId BuildConfigSetRecord to be deleted * @param authToken */ @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public Result deleteTemporaryBuildConfigSetRecord(Integer buildConfigSetRecordId, String authToken) throws ValidationException { BuildConfigSetRecord buildConfigSetRecord = buildConfigSetRecordRepository.queryById(buildConfigSetRecordId); if (buildConfigSetRecord == null) { throw new ValidationException( "Cannot delete temporary BuildConfigSetRecord with id " + buildConfigSetRecordId + " as no BuildConfigSetRecord with this id exists"); } if (!buildConfigSetRecord.isTemporaryBuild()) { throw new ValidationException("Only deletion of the temporary builds is allowed"); } log.info("Starting deletion of a temporary build record set " + buildConfigSetRecord); for (BuildRecord br : buildConfigSetRecord.getBuildRecords()) { Result result = deleteTemporaryBuild(br.getId(), authToken); if (!result.isSuccess()) { return result; } } buildConfigSetRecordRepository.delete(buildConfigSetRecord.getId()); log.info("Deletion of a temporary build record set {} finished successfully.", buildConfigSetRecord); return new Result(buildConfigSetRecordId.toString(), ResultStatus.SUCCESS); }
Example 5
Source File: ProductManagerBean.java From eplmp with Eclipse Public License 1.0 | 5 votes |
@RolesAllowed(UserGroupMapping.REGULAR_USER_ROLE_ID) @TransactionAttribute(value = TransactionAttributeType.REQUIRES_NEW) @Override public void endConversion(PartIterationKey partIterationKey, boolean succeed) throws UserNotFoundException, WorkspaceNotFoundException, UserNotActiveException, PartRevisionNotFoundException, AccessRightException, PartIterationNotFoundException, WorkspaceNotEnabledException { checkPartRevisionWriteAccess(partIterationKey.getPartRevision()); PartIteration partIteration = partIterationDAO.loadPartI(partIterationKey); Conversion conversion = conversionDAO.findConversion(partIteration); conversion.setPending(false); conversion.setSucceed(succeed); conversion.setEndDate(new Date()); }
Example 6
Source File: StatefulTransactionInCallbacksTest.java From tomee with Apache License 2.0 | 5 votes |
@PreDestroy @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void hasTxDestroy() { try { assertTrue(OpenEJB.getTransactionManager().getTransaction() != null); } catch (final SystemException e) { fail(e.getMessage()); } }
Example 7
Source File: APPConcurrencyServiceBean.java From development with Apache License 2.0 | 5 votes |
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public boolean lockServiceInstance(String controllerId, String instanceId) throws APPlatformException { LOGGER.debug("try to lock service instance {}", instanceId); ServiceInstance lockedService = instanceDAO .getLockedInstanceForController(controllerId); if (lockedService != null) { if (!lockedService.getInstanceId().equals(instanceId)) { LOGGER.debug("other service is already locked ({}).", lockedService.getInstanceId()); return false; } LOGGER.debug("Service is already locked"); return true; } ServiceInstance service = null; try { service = instanceDAO.getInstanceById(controllerId, instanceId); } catch (ServiceInstanceNotFoundException e) { throw new APPlatformException(e.getMessage()); } service.setLocked(true); em.flush(); LOGGER.debug("Locked successfully."); return true; }
Example 8
Source File: EJB_10_multi_base.java From testing_security_development_enterprise_systems with GNU Lesser General Public License v3.0 | 4 votes |
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void addInNewTransaction(String name){ Foo foo = new Foo(name); em.persist(foo); }
Example 9
Source File: EJB_10_multi_base.java From testing_security_development_enterprise_systems with GNU Lesser General Public License v3.0 | 4 votes |
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void addInNewTransaction(String name){ Foo foo = new Foo(name); em.persist(foo); }
Example 10
Source File: StatefulTransactionAttributesTest.java From tomee with Apache License 2.0 | 4 votes |
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public String color(final Object o) { return attribute(); }
Example 11
Source File: TimerServiceBean.java From development with Apache License 2.0 | 4 votes |
/** * Reads the configuration settings for the timer intervals to be used and * creates the timers accordingly. */ @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void initTimers() throws ValidationException { initAllTimers(); }
Example 12
Source File: RequiresNewEjbTxTestEntityDao.java From spring4-understanding with Apache License 2.0 | 4 votes |
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) @Override public int incrementCount(String name) { return super.incrementCountInternal(name); }
Example 13
Source File: RequiresNewEjbTxTestEntityDao.java From spring-analysis-note with MIT License | 4 votes |
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) @Override public int incrementCount(String name) { return super.incrementCountInternal(name); }
Example 14
Source File: EJB_10_multi_base.java From testing_security_development_enterprise_systems with GNU Lesser General Public License v3.0 | 4 votes |
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public boolean isPresentByCheckingOnNewTransaction(String name){ return em.find(Foo.class, name) != null; }
Example 15
Source File: StatefulTransactionAttributesTest.java From tomee with Apache License 2.0 | 4 votes |
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public String scarlet() { return attribute(); }
Example 16
Source File: StatefulTransactionAttributesTest.java From tomee with Apache License 2.0 | 4 votes |
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public String red() { return attribute(); }
Example 17
Source File: JMS2AMQTest.java From tomee with Apache License 2.0 | 4 votes |
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void sendInNewTx() { context.createProducer().send(destination, TEXT); }
Example 18
Source File: TransactionAttributeMetaTest.java From tomee with Apache License 2.0 | 4 votes |
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void method() { }
Example 19
Source File: QueryExecutorBean.java From datawave with Apache License 2.0 | 4 votes |
@Override @Interceptors({ResponseInterceptor.class, RequiredInterceptor.class}) @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public BaseQueryResponse createQueryAndNext(String logicName, MultivaluedMap<String,String> queryParameters) { return createQueryAndNext(logicName, queryParameters, null); }
Example 20
Source File: RequiresNewEjbTxTestEntityDao.java From java-technology-stack with MIT License | 4 votes |
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) @Override public int incrementCount(String name) { return super.incrementCountInternal(name); }