Package java.util.concurrent

Examples of java.util.concurrent.TimeUnit.convert()


                            intr = true;
                        }
                    } else {
                        final TimeUnit timeUnit = keepAliveTimeUnit;
                        final long time = keepAliveTime;
                        final long remaining = time - timeUnit.convert(elapsed, TimeUnit.MILLISECONDS);
                        if (remaining <= 0L && (allowCoreThreadTimeout || threadCount > coreThreadLimit)) {
                            // the timeout has expired
                            return pollTask();
                        }
                        try {
View Full Code Here


        double resourceUtilization = pool.getResourceUtilization();
        // ensure that duration will include wait time
        duration += waitTime;
       
        TimeUnit timeUnit = SimulationUtils.getTimeUnit(properties);
        long durationInUnit = timeUnit.convert(duration, TimeUnit.MILLISECONDS);
        double resourceCost = pool.getResourceCost() * durationInUnit;
       
        context.getClock().advanceTime((duration), TimeUnit.MILLISECONDS);
       
        // set end time for processinstance end time
View Full Code Here

    TimeUnit milliSecondsUnit = TimeUnit.MILLISECONDS;
   
    synchronized(_completed) {
      if(!_done)
        _completed.wait(milliSecondsUnit.convert(timeout, timeUnit));
    }
   
    return _resultObject;
  }
View Full Code Here

    @Override
    public boolean equals(Object object) {
        if ((object == null) || !(object instanceof Time)) return false;
        Time time = (Time) object;
        TimeUnit compareUnit = TimeUnit.MILLISECONDS;
        return compareUnit.convert(this.value, this.unit) == compareUnit.convert(time.value, time.unit);
    }

    @Override
    public int hashCode() {
        return Long.valueOf(TimeUnit.MILLISECONDS.convert(this.value, this.unit)).hashCode();
View Full Code Here

    @Override
    public boolean equals(Object object) {
        if ((object == null) || !(object instanceof Time)) return false;
        Time time = (Time) object;
        TimeUnit compareUnit = TimeUnit.MILLISECONDS;
        return compareUnit.convert(this.value, this.unit) == compareUnit.convert(time.value, time.unit);
    }

    @Override
    public int hashCode() {
        return Long.valueOf(TimeUnit.MILLISECONDS.convert(this.value, this.unit)).hashCode();
View Full Code Here

    @Override
    public boolean equals(Object object) {
        if ((object == null) || !(object instanceof Time)) return false;
        Time time = (Time) object;
        TimeUnit compareUnit = TimeUnit.MILLISECONDS;
        return compareUnit.convert(this.value, this.unit) == compareUnit.convert(time.value, time.unit);
    }

    @Override
    public int hashCode() {
        return Long.valueOf(TimeUnit.MILLISECONDS.convert(this.value, this.unit)).hashCode();
View Full Code Here

    @Override
    public boolean equals(Object object) {
        if ((object == null) || !(object instanceof Time)) return false;
        Time time = (Time) object;
        TimeUnit compareUnit = TimeUnit.MILLISECONDS;
        return compareUnit.convert(this.value, this.unit) == compareUnit.convert(time.value, time.unit);
    }

    @Override
    public int hashCode() {
        return Long.valueOf(TimeUnit.MILLISECONDS.convert(this.value, this.unit)).hashCode();
View Full Code Here

        TimeUnit milliSecondsUnit = TimeUnit.MILLISECONDS;

        synchronized (_completed) {
            if (!_done)
                _completed.wait(milliSecondsUnit.convert(timeout, timeUnit));
        }

        return _resultObject;
    }
View Full Code Here

  public RunningStatisticsPerTime(TimeUnit timeUnit) {
    int timeUnitOrdinal = timeUnit.ordinal();
    Preconditions.checkArgument(timeUnitOrdinal >= TimeUnit.MINUTES.ordinal(), "Unsupported time unit: %s", timeUnit);
    TimeUnit subTimeUnit = TimeUnit.values()[timeUnitOrdinal - 1];
    int numBuckets = (int) subTimeUnit.convert(1, timeUnit);

    mean = new IntWeightedMean();
    min = Double.NaN;
    max = Double.NaN;
    bucketTimeMS = TimeUnit.MILLISECONDS.convert(1, subTimeUnit);
View Full Code Here

    public DateTieredCompactionStrategyOptions(Map<String, String> options)
    {
        String optionValue = options.get(TIMESTAMP_RESOLUTION_KEY);
        TimeUnit timestampResolution = optionValue == null ? DEFAULT_TIMESTAMP_RESOLUTION : TimeUnit.valueOf(optionValue);
        optionValue = options.get(MAX_SSTABLE_AGE_KEY);
        maxSSTableAge = timestampResolution.convert(optionValue == null ? DEFAULT_MAX_SSTABLE_AGE_DAYS : Long.parseLong(optionValue), TimeUnit.DAYS);
        optionValue = options.get(BASE_TIME_KEY);
        baseTime = timestampResolution.convert(optionValue == null ? DEFAULT_BASE_TIME_SECONDS : Long.parseLong(optionValue), TimeUnit.SECONDS);
    }

    public DateTieredCompactionStrategyOptions()
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.