@Override public boolean equals(Object obj) { if (!(obj instanceof Priority)) { return false; } Priority other = (Priority) obj; return Objects.equal(value, other.getValue()) && Objects.equal(creationTime, other.getCreationTime()); }
@Override protected RemoteConversionContext startConversion(InputStream fetchedSource) { return new RemoteConversionContext(webTarget .path(ConverterNetworkProtocol.RESOURCE_PATH) .request(targetFormat.toString()) .header(ConverterNetworkProtocol.HEADER_JOB_PRIORITY, getPriority().getValue()) .async() .post(Entity.entity(new ConsumeOnCloseInputStream(this, fetchedSource), sourceFormat.toString()))); }
protected AbstractFutureWrappingPriorityFuture(int priority) { this.logger = LoggerFactory.getLogger(getClass()); this.priority = new Priority(priority); this.futureExchangeLock = new Object(); this.pendingCondition = new CountDownLatch(1); this.underlyingFuture = new InitialConversionFuture(); }
@Override public int compareTo(Runnable other) { // Note: The PriorityBlockingQueue expects an implementation of Comparable<Runnable>. // Therefore we cast the compared instance explicitly, relying on no other types // are inserted into the PriorityBlockingQueue. This exception is wanted since this // scenario should never occur. return priority.compareTo(((AbstractFutureWrappingPriorityFuture) other).getPriority()); }
@Override public int compareTo(Priority other) { return ComparisonChain.start() .compare(value, other.getValue()) .compare(creationTime, other.getCreationTime()) .result(); }