List of usage examples for javax.ejb TransactionAttributeType NOT_SUPPORTED
TransactionAttributeType NOT_SUPPORTED
To view the source code for javax.ejb TransactionAttributeType NOT_SUPPORTED.
Click Source Link
NOT_SUPPORTED
with an unspecified transaction context. From source file:com.hiperium.bo.control.impl.TaskBOImpl.java
/** * /* w w w.j a va 2 s. c o m*/ * @param taskId * @return */ @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) private Timer findTimer(Long taskId) { this.log.debug("findTimer - START"); Timer timer = null; Collection<Timer> timers = this.timerService.getTimers(); if (timers != null) { for (Iterator<Timer> iterator = timers.iterator(); iterator.hasNext();) { Timer t = iterator.next(); try { if (taskId.equals((Long) t.getInfo())) { timer = t; } } catch (Exception e) { this.log.debug("ERROR: " + e.getMessage()); } } } this.log.debug("findTimer - END"); return timer; }
From source file:io.hops.hopsworks.common.dao.tensorflow.config.TensorBoardProcessMgr.java
/** * Kill the TensorBoard process/* w w w .ja va 2s.com*/ * @param pid * @return */ @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public int killTensorBoard(BigInteger pid) { String prog = settings.getHopsworksDomainDir() + "/bin/tensorboard.sh"; int exitValue; String[] command = { "/usr/bin/sudo", prog, "kill", pid.toString() }; LOGGER.log(Level.INFO, Arrays.toString(command)); ProcessBuilder pb = new ProcessBuilder(command); try { Process process = pb.start(); process.waitFor(20l, TimeUnit.SECONDS); exitValue = process.exitValue(); } catch (IOException | InterruptedException ex) { exitValue = 2; LOGGER.log(Level.SEVERE, "Failed to kill TensorBoard", ex); } return exitValue; }
From source file:io.hops.hopsworks.common.dao.tensorflow.config.TensorBoardProcessMgr.java
/** * Kill the TensorBoard process/*w w w . j av a 2 s . c om*/ * @param tb * @return */ @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public int killTensorBoard(TensorBoard tb) throws ServiceException { String prog = settings.getHopsworksDomainDir() + "/bin/tensorboard.sh"; int exitValue; String[] command = { "/usr/bin/sudo", prog, "kill", tb.getPid().toString() }; LOGGER.log(Level.INFO, Arrays.toString(command)); ProcessBuilder pb = new ProcessBuilder(command); try { Process process = pb.start(); process.waitFor(20l, TimeUnit.SECONDS); exitValue = process.exitValue(); cleanupLocalTBDir(tb); } catch (IOException | InterruptedException ex) { exitValue = 2; LOGGER.log(Level.SEVERE, "Failed to kill TensorBoard", ex); } return exitValue; }
From source file:io.hops.hopsworks.common.security.CertificatesMgmService.java
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public void deleteServiceCertificate(Hosts host, Integer commandId) throws IOException, CAException { String suffix = serviceCertificateRotationTimer.getToBeRevokedSuffix(Integer.toString(commandId)); try {//from www . jav a 2 s. c o m opensslOperations.revokeCertificate(host.getHostname(), suffix, CertificateType.HOST, true, true); } catch (IllegalArgumentException e) { // Do nothing } }
From source file:edu.harvard.iq.dataverse.harvest.client.HarvesterServiceBean.java
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public Long processRecord(DataverseRequest dataverseRequest, Logger hdLogger, PrintWriter importCleanupLog, OaiHandler oaiHandler, String identifier, MutableBoolean recordErrorOccurred, MutableLong processedSizeThisBatch, List<String> deletedIdentifiers) { String errMessage = null;//w ww.j av a 2s. c om Dataset harvestedDataset = null; logGetRecord(hdLogger, oaiHandler, identifier); File tempFile = null; try { FastGetRecord record = oaiHandler.runGetRecord(identifier); errMessage = record.getErrorMessage(); if (errMessage != null) { hdLogger.log(Level.SEVERE, "Error calling GetRecord - " + errMessage); } else if (record.isDeleted()) { hdLogger.info( "Deleting harvesting dataset for " + identifier + ", per the OAI server's instructions."); Dataset dataset = datasetService .getDatasetByHarvestInfo(oaiHandler.getHarvestingClient().getDataverse(), identifier); if (dataset != null) { hdLogger.info("Deleting dataset " + dataset.getGlobalId()); deleteHarvestedDataset(dataset, dataverseRequest, hdLogger); // TODO: // check the status of that Delete - see if it actually succeeded deletedIdentifiers.add(identifier); } else { hdLogger.info("No dataset found for " + identifier + ", skipping delete. "); } } else { hdLogger.info("Successfully retrieved GetRecord response."); tempFile = record.getMetadataFile(); PrintWriter cleanupLog; harvestedDataset = importService.doImportHarvestedDataset(dataverseRequest, oaiHandler.getHarvestingClient(), identifier, oaiHandler.getMetadataPrefix(), record.getMetadataFile(), importCleanupLog); hdLogger.fine("Harvest Successful for identifier " + identifier); hdLogger.fine("Size of this record: " + record.getMetadataFile().length()); processedSizeThisBatch.add(record.getMetadataFile().length()); } } catch (Throwable e) { logGetRecordException(hdLogger, oaiHandler, identifier, e); errMessage = "Caught exception while executing GetRecord on " + identifier; //logException(e, hdLogger); } finally { if (tempFile != null) { // temporary - let's not delete the temp metadata file if anything went wrong, for now: if (errMessage == null) { try { tempFile.delete(); } catch (Throwable t) { } ; } } } // TODO: the message below is taken from DVN3; - figure out what it means... // // If we got an Error from the OAI server or an exception happened during import, then // set recordErrorOccurred to true (if recordErrorOccurred is being used) // otherwise throw an exception (if recordErrorOccurred is not used, i.e null) if (errMessage != null) { if (recordErrorOccurred != null) { recordErrorOccurred.setValue(true); } else { throw new EJBException(errMessage); } } return harvestedDataset != null ? harvestedDataset.getId() : null; }
From source file:io.hops.hopsworks.common.dao.tensorflow.config.TensorBoardProcessMgr.java
/** * Check to see if the process is running and is a TensorBoard started by tensorboard.sh * @param pid//www. ja va 2s . c o m * @return */ @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public int ping(BigInteger pid) { String prog = settings.getHopsworksDomainDir() + "/bin/tensorboard.sh"; int exitValue = 1; String[] command = { "/usr/bin/sudo", prog, "ping", pid.toString() }; LOGGER.log(Level.INFO, Arrays.toString(command)); ProcessBuilder pb = new ProcessBuilder(command); try { Process process = pb.start(); process.waitFor(20l, TimeUnit.SECONDS); exitValue = process.exitValue(); } catch (IOException | InterruptedException ex) { LOGGER.log(Level.SEVERE, "Problem pinging: {0}", ex.toString()); } return exitValue; }
From source file:edu.harvard.iq.dvn.core.harvest.HarvesterServiceBean.java
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public ResumptionTokenType harvestFromIdentifiers(Logger hdLogger, ResumptionTokenType resumptionToken, HarvestingDataverse dataverse, String from, String until, List<Long> harvestedStudyIds, List<String> failedIdentifiers, MutableBoolean harvestErrorOccurred) throws java.io.IOException, ParserConfigurationException, SAXException, TransformerException, JAXBException { String encodedSet = dataverse.getHarvestingSet() == null ? null : URLEncoder.encode(dataverse.getHarvestingSet(), "UTF-8"); ListIdentifiers listIdentifiers = null; if (resumptionToken == null) { listIdentifiers = new ListIdentifiers(dataverse.getServerUrl(), from, until, encodedSet, URLEncoder.encode(dataverse.getHarvestFormatType().getMetadataPrefix(), "UTF-8")); } else {/* ww w .j a va 2s. c o m*/ hdLogger.log(Level.INFO, "harvestFromIdentifiers(), resumptionToken=" + resumptionToken.getValue()); listIdentifiers = new ListIdentifiers(dataverse.getServerUrl(), resumptionToken.getValue()); } Document doc = listIdentifiers.getDocument(); // JAXBContext jc = JAXBContext.newInstance("edu.harvard.hmdc.vdcnet.jaxb.oai"); // Unmarshaller unmarshaller = jc.createUnmarshaller(); JAXBElement unmarshalObj = (JAXBElement) unmarshaller.unmarshal(doc); OAIPMHtype oaiObj = (OAIPMHtype) unmarshalObj.getValue(); if (oaiObj.getError() != null && oaiObj.getError().size() > 0) { if (oaiObj.getError().get(0).getCode().equals(OAIPMHerrorcodeType.NO_RECORDS_MATCH)) { hdLogger.info("ListIdentifiers returned NO_RECORDS_MATCH - no studies found to be harvested."); } else { handleOAIError(hdLogger, oaiObj, "calling listIdentifiers, oaiServer= " + dataverse.getServerUrl() + ",from=" + from + ",until=" + until + ",encodedSet=" + encodedSet + ",format=" + dataverse.getHarvestFormatType().getMetadataPrefix()); throw new EJBException("Received OAI Error response calling ListIdentifiers"); } } else { ListIdentifiersType listIdentifiersType = oaiObj.getListIdentifiers(); if (listIdentifiersType != null) { resumptionToken = listIdentifiersType.getResumptionToken(); for (Iterator it = listIdentifiersType.getHeader().iterator(); it.hasNext();) { HeaderType header = (HeaderType) it.next(); MutableBoolean getRecordErrorOccurred = new MutableBoolean(false); Long studyId = getRecord(hdLogger, dataverse, header.getIdentifier(), dataverse.getHarvestFormatType().getMetadataPrefix(), getRecordErrorOccurred); if (studyId != null) { harvestedStudyIds.add(studyId); } if (getRecordErrorOccurred.booleanValue() == true) { failedIdentifiers.add(header.getIdentifier()); } } } } String logMsg = "Returning from harvestFromIdentifiers"; if (resumptionToken == null) { logMsg += " resumptionToken is null"; } else if (!StringUtil.isEmpty(resumptionToken.getValue())) { logMsg += " resumptionToken is " + resumptionToken.getValue(); } else { // Some OAIServers return an empty resumptionToken element when all // the identifiers have been sent, so need to check for this, and // treat it as if resumptiontoken is null. logMsg += " resumptionToken is empty, setting return value to null."; resumptionToken = null; } hdLogger.info(logMsg); return resumptionToken; }
From source file:edu.harvard.iq.dvn.core.harvest.HarvesterServiceBean.java
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public Long getRecord(HarvestingDataverse dataverse, String identifier, String metadataPrefix) { return getRecord(logger, dataverse, identifier, metadataPrefix, null); }
From source file:edu.harvard.iq.dvn.core.harvest.HarvesterServiceBean.java
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public Long getRecord(Logger hdLogger, HarvestingDataverse dataverse, String identifier, String metadataPrefix, MutableBoolean recordErrorOccurred) { String errMessage = null;/* w ww .ja va2 s . c om*/ Study harvestedStudy = null; String oaiUrl = dataverse.getServerUrl(); try { hdLogger.log(Level.INFO, "Calling GetRecord: oaiUrl =" + oaiUrl + "?verb=GetRecord&identifier=" + identifier + "&metadataPrefix=" + metadataPrefix); DvnFastGetRecord record = new DvnFastGetRecord(oaiUrl, identifier, metadataPrefix); errMessage = record.getErrorMessage(); //errMessage=null; if (errMessage != null) { hdLogger.log(Level.SEVERE, "Error calling GetRecord - " + errMessage); } else if (record.isDeleted()) { hdLogger.log(Level.INFO, "Received 'deleted' status from OAI Server."); Study study = studyService.getStudyByHarvestInfo(dataverse.getVdc(), identifier); if (study != null) { hdLogger.log(Level.INFO, "Deleting study " + study.getGlobalId()); studyService.deleteStudy(study.getId()); } else { hdLogger.log(Level.INFO, "No study found for this record, skipping delete. "); } } else { hdLogger.log(Level.INFO, "Successfully retreived GetRecord response."); VDCUser networkAdmin = vdcNetworkService.find().getDefaultNetworkAdmin(); harvestedStudy = studyService.importHarvestStudy(record.getMetadataFile(), dataverse.getVdc().getId(), networkAdmin.getId(), identifier); //hdLogger.log(Level.INFO, "imported study (step 1., no data); proceeding with step 2."); //studyService.importHarvestStudyExperimental(harvestedStudyFile, harvestedStudy); hdLogger.log(Level.INFO, "Harvest Successful for identifier " + identifier); this.processedSizeThisBatch += record.getMetadataFile().length(); if (this.harvestedStudyIdsThisBatch == null) { this.harvestedStudyIdsThisBatch = new ArrayList<Long>(); } this.harvestedStudyIdsThisBatch.add(harvestedStudy.getId()); if (this.processedSizeThisBatch > 10000000) { hdLogger.log(Level.INFO, "REACHED CONTENT BATCH SIZE LIMIT; calling index (" + this.harvestedStudyIdsThisBatch.size() + " studies in the batch)."); indexService.updateIndexList(this.harvestedStudyIdsThisBatch); hdLogger.log(Level.INFO, "REINDEX DONE."); this.processedSizeThisBatch = 0; this.harvestedStudyIdsThisBatch = null; } } } catch (Throwable e) { errMessage = "Exception processing getRecord(), oaiUrl=" + oaiUrl + ",identifier=" + identifier + " " + e.getClass().getName() + " " + e.getMessage(); hdLogger.log(Level.SEVERE, errMessage); logException(e, hdLogger); } // If we got an Error from the OAI server or an exception happened during import, then // set recordErrorOccurred to true (if recordErrorOccurred is being used) // otherwise throw an exception (if recordErrorOccurred is not used, i.e null) if (errMessage != null) { if (recordErrorOccurred != null) { recordErrorOccurred.setValue(true); } else { throw new EJBException(errMessage); } } return harvestedStudy != null ? harvestedStudy.getId() : null; }
From source file:com.webbfontaine.valuewebb.action.rimm.RefSelect.java
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) List<SelectItem> selectRefData(String refName, boolean retrieveDsc, boolean storeDsc, boolean showCodWithDsc, String sortColumn, boolean isCacheEnabled) { List refs = selectRefData(refName, retrieveDsc, sortColumn, isCacheEnabled); List<SelectItem> items = new ArrayList(); items.add(new SelectItem("")); for (Object ref : refs) { SelectItem item;/*www .j av a 2 s. co m*/ if (retrieveDsc) { String cod = (String) ((Object[]) ref)[0]; String dsc = (String) ((Object[]) ref)[1]; String dscLocale; if (FR.equals(Utils.getLanguage())) { dscLocale = (String) ((Object[]) ref)[2]; if (dscLocale == null) { LOGGER.warn( "French translation is not set for ref {0}, value {1}. Will try to translate then english value would be used.", refName, ((Object[]) ref)[0]); dscLocale = Utils.translate(dsc); } } else { dscLocale = enToEnTranslationRequired(refName) ? Utils.translate(dsc) : dsc; } String itemLabel = showCodWithDsc ? cod + " - " + dscLocale : dscLocale; String itemValue = storeDsc ? dsc : cod; item = new SelectItem(itemValue, itemLabel); } else { item = new SelectItem(ref, Utils.translate(ref.toString())); } items.add(item); } return items; }