org.hibernate.exception.LockAcquisitionException#org.apache.commons.lang.mutable.MutableInt源码实例Demo

下面列出了org.hibernate.exception.LockAcquisitionException#org.apache.commons.lang.mutable.MutableInt 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: datawave   文件: FlagMaker.java
/**
 * Determine the number of unprocessed flag files in the flag directory
 * 
 * @param fc
 * @return the flag found for this ingest pool
 */
private int countFlagFileBacklog(final FlagDataTypeConfig fc) {
    final MutableInt fileCounter = new MutableInt(0);
    final FileFilter fileFilter = new WildcardFileFilter("*_" + fc.getIngestPool() + "_" + fc.getDataName() + "_*.flag");
    final FileVisitor<java.nio.file.Path> visitor = new SimpleFileVisitor<java.nio.file.Path>() {
        
        @Override
        public FileVisitResult visitFile(java.nio.file.Path path, BasicFileAttributes attrs) throws IOException {
            if (fileFilter.accept(path.toFile())) {
                fileCounter.increment();
            }
            return super.visitFile(path, attrs);
        }
    };
    try {
        Files.walkFileTree(Paths.get(fmc.getFlagFileDirectory()), visitor);
    } catch (IOException e) {
        // unable to get a flag count....
        log.error("Unable to get flag file count", e);
        return -1;
    }
    return fileCounter.intValue();
}
 
/**
 * Given a Key to consume, update any necessary counters etc.
 *
 * @param key
 */
private void consume(Key key) {
    
    if (log.isTraceEnabled()) {
        log.trace("consume, key: " + key);
    }
    
    // update the visibility set
    MutableInt counter = this.currentVisibilityCounts.get(key.getColumnVisibility());
    if (counter == null) {
        this.currentVisibilityCounts.put(key.getColumnVisibility(), new MutableInt(1));
    } else {
        counter.increment();
    }
    
    // update current count
    this.count += 1;
    
    // set most recent timestamp
    this.maxTimeStamp = (this.maxTimeStamp > key.getTimestamp()) ? maxTimeStamp : key.getTimestamp();
}
 
源代码3 项目: datawave   文件: AccumuloConnectionFactoryBean.java
@PermitAll
@JmxManaged
public int getConnectionUsagePercent() {
    double maxPercentage = 0.0;
    for (Entry<String,Map<Priority,AccumuloConnectionPool>> entry : pools.entrySet()) {
        for (Entry<Priority,AccumuloConnectionPool> poolEntry : entry.getValue().entrySet()) {
            // Don't include ADMIN priority connections when computing a usage percentage
            if (Priority.ADMIN.equals(poolEntry.getKey()))
                continue;
            
            MutableInt maxActive = new MutableInt();
            MutableInt numActive = new MutableInt();
            MutableInt numWaiting = new MutableInt();
            MutableInt unused = new MutableInt();
            poolEntry.getValue().getConnectionPoolStats(maxActive, numActive, unused, unused, numWaiting);
            
            double percentage = (numActive.doubleValue() + numWaiting.doubleValue()) / maxActive.doubleValue();
            if (percentage > maxPercentage) {
                maxPercentage = percentage;
            }
        }
    }
    return (int) (maxPercentage * 100);
}
 
源代码4 项目: datawave   文件: AccumuloConnectionPool.java
public List<Map<String,String>> getConnectionPoolStats(MutableInt maxTotal, MutableInt numActive, MutableInt maxIdle, MutableInt numIdle,
                MutableInt numWaiting) {
    
    ArrayList<Map<String,String>> t = new ArrayList<>();
    // no changes to underlying values while collecting metrics
    synchronized (connectorToTrackingMapMap) {
        // no changes to underlying values while collecting metrics
        synchronized (threadToTrackingMapMap) {
            // synchronize this last to prevent race condition for this lock underlying super type
            synchronized (this) {
                if (!threadToTrackingMapMap.isEmpty()) {
                    t.addAll(Collections.unmodifiableCollection(threadToTrackingMapMap.values()));
                }
                if (!connectorToTrackingMapMap.isEmpty()) {
                    t.addAll(Collections.unmodifiableCollection(connectorToTrackingMapMap.values()));
                }
                maxTotal.setValue(getMaxTotal());
                numActive.setValue(getNumActive());
                maxIdle.setValue(getMaxIdle());
                numIdle.setValue(getNumIdle());
                numWaiting.setValue(getNumWaiters());
            }
        }
    }
    return Collections.unmodifiableList(t);
}
 
protected void processLiveAppCountMetrics(Map<TimelineClusterMetric, MetricClusterAggregate> aggregateClusterMetrics,
                                          Map<String, MutableInt> appHostsCount, long timestamp) {

  for (Map.Entry<String, MutableInt> appHostsEntry : appHostsCount.entrySet()) {
    TimelineClusterMetric timelineClusterMetric = new TimelineClusterMetric(
      liveHostsMetricName, appHostsEntry.getKey(), null, timestamp);

    Integer numOfHosts = appHostsEntry.getValue().intValue();

    MetricClusterAggregate metricClusterAggregate = new MetricClusterAggregate(
      (double) numOfHosts, 1, null, (double) numOfHosts, (double) numOfHosts);

    metadataManagerInstance.getUuid(timelineClusterMetric, true);
    aggregateClusterMetrics.put(timelineClusterMetric, metricClusterAggregate);
  }
}
 
源代码6 项目: zeno   文件: DiffHistoryDataState.java
private <T> Map<Object, List<T>> groupObjectsByKey(FastBlobTypeDeserializationState<T> deserializationState, TypeDiffInstruction<T> instruction, Map<Object, MutableInt> countsByKey) {
    Map<Object, List<T>> groupsByKey = new HashMap<Object, List<T>>(countsByKey.size());

    for (T obj : deserializationState) {
        Object key = instruction.getKeyFromObject(obj);
        List<T> groupList = groupsByKey.get(key);
        if (groupList == null) {
            int count = countsByKey.get(key).intValue();
            groupList = new ArrayList<T>(count);
            groupsByKey.put(key, groupList);
        }

        groupList.add(obj);
    }
    return groupsByKey;
}
 
源代码7 项目: systemds   文件: ReaderTextCSV.java
@Override
public MatrixBlock readMatrixFromInputStream(InputStream is, long rlen, long clen, int blen, long estnnz) 
	throws IOException, DMLRuntimeException 
{
	//allocate output matrix block
	MatrixBlock ret = createOutputMatrixBlock(rlen, clen, (int)rlen, estnnz, true, false);
	
	//core read 
	long lnnz = readCSVMatrixFromInputStream(is, "external inputstream", ret, new MutableInt(0), rlen, clen, 
		blen, _props.hasHeader(), _props.getDelim(), _props.isFill(), _props.getFillValue(), true);
			
	//finally check if change of sparse/dense block representation required
	ret.setNonZeros( lnnz );
	ret.examSparsity();
	
	return ret;
}
 
源代码8 项目: systemds   文件: ReaderTextLIBSVM.java
@Override
public MatrixBlock readMatrixFromInputStream(InputStream is, long rlen, long clen, int blen, long estnnz) 
	throws IOException, DMLRuntimeException 
{
	//allocate output matrix block
	MatrixBlock ret = createOutputMatrixBlock(rlen, clen, (int)rlen, estnnz, true, false);
	
	//core read 
	long lnnz = readLIBSVMMatrixFromInputStream(is, "external inputstream", ret,
		new MutableInt(0), rlen, clen, blen);
	
	//finally check if change of sparse/dense block representation required
	ret.setNonZeros( lnnz );
	ret.examSparsity();
	
	return ret;
}
 
源代码9 项目: systemds   文件: ReaderTextLIBSVM.java
private static long readLIBSVMMatrixFromInputStream( InputStream is, String srcInfo, MatrixBlock dest, MutableInt rowPos, 
		long rlen, long clen, int blen )
	throws IOException
{
	SparseRowVector vect = new SparseRowVector(1024);
	String value = null;
	int row = rowPos.intValue();
	long lnnz = 0;
	
	// Read the data
	try( BufferedReader br = new BufferedReader(new InputStreamReader(is)) ) {
		while( (value=br.readLine())!=null ) { //for each line
			String rowStr = value.toString().trim();
			lnnz += ReaderTextLIBSVM.parseLibsvmRow(rowStr, vect, (int)clen);
			dest.appendRow(row, vect);
			row++;
		}
	}
	
	rowPos.setValue(row);
	return lnnz;
}
 
源代码10 项目: incubator-pinot   文件: RequestUtils.java
private static FilterQuery traverseFilterQueryAndPopulateMap(FilterQueryTree tree,
    Map<Integer, FilterQuery> filterQueryMap, MutableInt currentId) {
  int currentNodeId = currentId.intValue();
  currentId.increment();

  final List<Integer> f = new ArrayList<>();
  if (null != tree.getChildren()) {
    for (final FilterQueryTree c : tree.getChildren()) {
      final FilterQuery q = traverseFilterQueryAndPopulateMap(c, filterQueryMap, currentId);
      int childNodeId = q.getId();
      f.add(childNodeId);
      filterQueryMap.put(childNodeId, q);
    }
  }

  FilterQuery query = new FilterQuery();
  query.setColumn(tree.getColumn());
  query.setId(currentNodeId);
  query.setNestedFilterQueryIds(f);
  query.setOperator(tree.getOperator());
  query.setValue(tree.getValue());
  return query;
}
 
源代码11 项目: gatk   文件: OrientationBiasReadCounts.java
/**
 *  If the allele is not in the count mappings, then it is not counted.  No exception will be thrown
 *  Modifies count variables in place.
 *
 * @param pileupElement pileup overlapping the alleles
 * @param f1r2Counts a mapping of allele to f1r2 counts
 * @param f2r1Counts a mapping of allele to f2r1 counts
 */
private static void incrementCounts(final PileupElement pileupElement, final Map<Allele, MutableInt> f1r2Counts,
                                final Map<Allele, MutableInt> f2r1Counts, final Allele referenceAllele,
                                    final List<Allele> altAlleles, int minBaseQualityCutoff) {

    final Map<Allele, MutableInt> countMap = ReadUtils.isF2R1(pileupElement.getRead()) ? f2r1Counts : f1r2Counts;

    final Allele pileupAllele = GATKVariantContextUtils.chooseAlleleForRead(pileupElement, referenceAllele, altAlleles, minBaseQualityCutoff);

    if (pileupAllele == null) {
        return;
    }

    if (countMap.containsKey(pileupAllele)) {
        countMap.get(pileupAllele).increment();
    }
}
 
源代码12 项目: gatk   文件: MutectDownsampler.java
/**
 * @param maxReadsPerAlignmentStart Maximum number of reads per alignment start position. Must be > 0
 * @param stride Length in bases constituting a single pool of reads to downsample
 */
public MutectDownsampler(final int maxReadsPerAlignmentStart,
                         final int maxSuspiciousReadsPerAlignmentStart,
                         final int stride) {
    // convert coverage per base to coverage per stride
    maxCoverage = maxReadsPerAlignmentStart <= 0 ? Integer.MAX_VALUE : (maxReadsPerAlignmentStart * stride);
    this.stride = ParamUtils.isPositive(stride, "stride must be > 0");
    maxSuspiciousReadsPerStride = maxSuspiciousReadsPerAlignmentStart <= 0 ? Integer.MAX_VALUE : stride * ParamUtils.isPositive(maxSuspiciousReadsPerAlignmentStart, "maxSuspiciousReadsPerAlignmentStart must be > 0");

    pendingReads = new ArrayList<>();
    finalizedReads = new ArrayList<>();
    rejectAllReadsInStride = false;
    suspiciousReadCount = new MutableInt(0);

    clearItems();
    resetStats();
}
 
源代码13 项目: termsuite-core   文件: CasStatCounter.java
@Override
public void process(JCas aJCas) throws AnalysisEngineProcessException {
	this.docIt++;
	Optional<SourceDocumentInformation> sourceDocumentAnnotation = JCasUtils.getSourceDocumentAnnotation(aJCas);
	if(sourceDocumentAnnotation.isPresent())
		this.cumulatedFileSize += sourceDocumentAnnotation.get().getDocumentSize();
	FSIterator<Annotation> it =  aJCas.getAnnotationIndex().iterator();
	Annotation a;
	MutableInt i;
	while(it.hasNext()) {
		a = it.next();
		i = counters.get(a.getType().getShortName());
		if(i == null) 
			counters.put(a.getType().getShortName(), new MutableInt(1));
		else
			i.increment();
	}
	if(periodicStatEnabled && this.docIt % this.docPeriod == 0)
		try {
			traceToFile();
		} catch (IOException e) {
			throw new AnalysisEngineProcessException(e);
		}
}
 
源代码14 项目: systemds   文件: ReaderTextCSV.java
@Override
public MatrixBlock readMatrixFromInputStream(InputStream is, long rlen, long clen, int blen, long estnnz) 
	throws IOException, DMLRuntimeException 
{
	//allocate output matrix block
	MatrixBlock ret = createOutputMatrixBlock(rlen, clen, (int)rlen, estnnz, true, false);
	
	//core read 
	long lnnz = readCSVMatrixFromInputStream(is, "external inputstream", ret, new MutableInt(0), rlen, clen, 
		blen, _props.hasHeader(), _props.getDelim(), _props.isFill(), _props.getFillValue(), true);
			
	//finally check if change of sparse/dense block representation required
	ret.setNonZeros( lnnz );
	ret.examSparsity();
	
	return ret;
}
 
源代码15 项目: systemds   文件: ReaderTextLIBSVM.java
private static long readLIBSVMMatrixFromInputStream( InputStream is, String srcInfo, MatrixBlock dest, MutableInt rowPos, 
		long rlen, long clen, int blen )
	throws IOException
{
	SparseRowVector vect = new SparseRowVector(1024);
	String value = null;
	int row = rowPos.intValue();
	long lnnz = 0;
	
	// Read the data
	try( BufferedReader br = new BufferedReader(new InputStreamReader(is)) ) {
		while( (value=br.readLine())!=null ) { //for each line
			String rowStr = value.toString().trim();
			lnnz += ReaderTextLIBSVM.parseLibsvmRow(rowStr, vect, (int)clen);
			dest.appendRow(row, vect);
			row++;
		}
	}
	
	rowPos.setValue(row);
	return lnnz;
}
 
源代码16 项目: datawave   文件: TermCountingVisitor.java
@Override
public Object visit(ASTAndNode node, Object data) {
    List<JexlNode> otherNodes = new ArrayList<>();
    Map<LiteralRange<?>,List<JexlNode>> ranges = JexlASTHelper.getBoundedRangesIndexAgnostic(node, otherNodes, true);
    
    // count each bounded range as 1
    ((MutableInt) data).add(ranges.size());
    
    // and recurse on the other nodes
    for (JexlNode otherNode : otherNodes) {
        otherNode.jjtAccept(this, data);
    }
    
    return data;
}
 
源代码17 项目: systemds   文件: ReaderTextCSV.java
@SuppressWarnings("unchecked")
private static MatrixBlock readCSVMatrixFromHDFS( Path path, JobConf job, FileSystem fs, MatrixBlock dest, 
		long rlen, long clen, int blen, boolean hasHeader, String delim, boolean fill, double fillValue )
	throws IOException, DMLRuntimeException
{
	//prepare file paths in alphanumeric order
	ArrayList<Path> files=new ArrayList<>();
	if(fs.isDirectory(path)) {
		for(FileStatus stat: fs.listStatus(path, IOUtilFunctions.hiddenFileFilter))
			files.add(stat.getPath());
		Collections.sort(files);
	}
	else
		files.add(path);
	
	//determine matrix size via additional pass if required
	if ( dest == null ) {
		dest = computeCSVSize(files, job, fs, hasHeader, delim, fill, fillValue);
		clen = dest.getNumColumns();
	}
	
	//actual read of individual files
	long lnnz = 0;
	MutableInt row = new MutableInt(0);
	for(int fileNo=0; fileNo<files.size(); fileNo++) {
		lnnz += readCSVMatrixFromInputStream(fs.open(files.get(fileNo)), path.toString(), dest, 
			row, rlen, clen, blen, hasHeader, delim, fill, fillValue, fileNo==0);
	}
	
	//post processing
	dest.setNonZeros( lnnz );
	
	return dest;
}
 
源代码18 项目: systemds   文件: ReaderTextLIBSVM.java
@SuppressWarnings("unchecked")
private static MatrixBlock readLIBSVMMatrixFromHDFS( Path path, JobConf job, FileSystem fs, MatrixBlock dest, 
		long rlen, long clen, int blen)
	throws IOException, DMLRuntimeException
{
	//prepare file paths in alphanumeric order
	ArrayList<Path> files=new ArrayList<>();
	if(fs.isDirectory(path)) {
		for(FileStatus stat: fs.listStatus(path, IOUtilFunctions.hiddenFileFilter))
			files.add(stat.getPath());
		Collections.sort(files);
	}
	else
		files.add(path);
	
	//determine matrix size via additional pass if required
	if ( dest == null ) {
		dest = computeLIBSVMSize(files, clen, job, fs);
		clen = dest.getNumColumns();
	}
	
	//actual read of individual files
	long lnnz = 0;
	MutableInt row = new MutableInt(0);
	for(int fileNo=0; fileNo<files.size(); fileNo++) {
		lnnz += readLIBSVMMatrixFromInputStream(fs.open(files.get(fileNo)),
			path.toString(), dest, row, rlen, clen, blen);
	}
	
	//post processing
	dest.setNonZeros( lnnz );
	
	return dest;
}
 
源代码19 项目: aion-germany   文件: NeviwindCanyonReward.java
public void addPointsByRace(Race race, int points) {
    MutableInt pointsByRace = getPointsByRace(race);
    pointsByRace.add(points);
    if (pointsByRace.intValue() < 0) {
        pointsByRace.setValue(0);
    }
}
 
源代码20 项目: aion-germany   文件: NeviwindCanyonReward.java
public void addPvpKillsByRace(Race race, int points) {
    MutableInt pvpKillsByRace = getPvpKillsByRace(race);
    pvpKillsByRace.add(points);
    if (pvpKillsByRace.intValue() < 0) {
        pvpKillsByRace.setValue(0);
    }
}
 
源代码21 项目: aion-germany   文件: JormungandReward.java
public void addPvpKillsByRace(Race race, int points) {
	MutableInt racePoints = getPvpKillsByRace(race);
	racePoints.add(points);
	if (racePoints.intValue() < 0) {
		racePoints.setValue(0);
	}
}
 
源代码22 项目: aion-germany   文件: JormungandReward.java
public void addPointsByRace(Race race, int points) {
	MutableInt racePoints = getPointsByRace(race);
	racePoints.add(points);
	if (racePoints.intValue() < 0) {
		racePoints.setValue(0);
	}
}
 
源代码23 项目: aion-germany   文件: DredgionReward.java
public MutableInt getPointsByRace(Race race) {
	switch (race) {
		case ELYOS:
			return elyosPoins;
		case ASMODIANS:
			return asmodiansPoints;
		default:
			break;
	}
	return null;
}
 
源代码24 项目: aion-germany   文件: DredgionReward.java
public void addPointsByRace(Race race, int points) {
	MutableInt racePoints = getPointsByRace(race);
	racePoints.add(points);
	if (racePoints.intValue() < 0) {
		racePoints.setValue(0);
	}
}
 
源代码25 项目: aion-germany   文件: KamarBattlefieldReward.java
public MutableInt getPointsByRace(Race race) {
	switch (race) {
		case ELYOS:
			return elyosPoins;
		case ASMODIANS:
			return asmodiansPoints;
		default:
			break;
	}
	return null;
}
 
源代码26 项目: aion-germany   文件: KamarBattlefieldReward.java
public void addPointsByRace(Race race, int points) {
	MutableInt racePoints = getPointsByRace(race);
	racePoints.add(points);
	if (racePoints.intValue() < 0) {
		racePoints.setValue(0);
	}
}
 
源代码27 项目: aion-germany   文件: KamarBattlefieldReward.java
public MutableInt getPvpKillsByRace(Race race) {
	switch (race) {
		case ELYOS:
			return elyosPvpKills;
		case ASMODIANS:
			return asmodiansPvpKills;
		default:
			break;
	}
	return null;
}
 
源代码28 项目: aion-germany   文件: KamarBattlefieldReward.java
public void addPvpKillsByRace(Race race, int points) {
	MutableInt racePoints = getPvpKillsByRace(race);
	racePoints.add(points);
	if (racePoints.intValue() < 0) {
		racePoints.setValue(0);
	}
}
 
源代码29 项目: aion-germany   文件: BalaurMarchingRouteReward.java
public void addPvpKillsByRace(Race race, int points) {
	MutableInt racePoints = getPvpKillsByRace(race);
	racePoints.add(points);
	if (racePoints.intValue() < 0) {
		racePoints.setValue(0);
	}
}
 
源代码30 项目: aion-germany   文件: BalaurMarchingRouteReward.java
public void addPointsByRace(Race race, int points) {
	MutableInt racePoints = getPointsByRace(race);
	racePoints.add(points);
	if (racePoints.intValue() < 0) {
		racePoints.setValue(0);
	}
}