-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce listenablefuture and failureaccess artifacts, plus Internal…
…FutureFailureAccess. (taken over from CL 210155310 to add Maven setup) It provides a direct access to the cause of any failures, so we can avoid unnecessary allocation of an exception. Design discussion: https://docs.google.com/document/d/1_RVTtztq5pqrhs0srvJWHMI7PT1tA71--iaauV2l5UA/edit RELNOTES=Created separate `listenablefuture` and `failureaccess` artifacts, the latter containing the new `InternalFutureFailureAccess`. For more details about `listenablefuture`, see [this announcement](https://groups.google.com/d/topic/guava-announce/Km82fZG68Sw). ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=212516713
- Loading branch information
Showing
19 changed files
with
808 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
The modules under this directory will be released exactly once each. Once that | ||
happens, there will be no need to ever update any files here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava-parent</artifactId> | ||
<version>26.0-android</version> | ||
</parent> | ||
<artifactId>failureaccess</artifactId> | ||
<version>1.0</version> | ||
<name>Guava InternalFutureFailureAccess and InternalFutures</name> | ||
<description> | ||
Contains | ||
com.google.common.util.concurrent.internal.InternalFutureFailureAccess and | ||
InternalFutures. Most users will never need to use this artifact. Its | ||
classes is conceptually a part of Guava, but they're in this separate | ||
artifact so that Android libraries can use them without pulling in all of | ||
Guava (just as they can use ListenableFuture by depending on the | ||
listenablefuture artifact). | ||
</description> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-source-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>animal-sniffer-maven-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-javadoc-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>attach-docs</id> | ||
</execution> | ||
<execution> | ||
<id>generate-javadoc-site-report</id> | ||
<phase>site</phase> | ||
<goals><goal>javadoc</goal></goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
52 changes: 52 additions & 0 deletions
52
...ureaccess/src/com/google/common/util/concurrent/internal/InternalFutureFailureAccess.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright (C) 2018 The Guava Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
package com.google.common.util.concurrent.internal; | ||
|
||
/** | ||
* A future that, if it fails, may <i>optionally</i> provide access to the cause of the failure. | ||
* | ||
* <p>This class is used only for micro-optimization. Standard {@code Future} utilities benefit from | ||
* this optimization, so there is no need to specialize methods to return or accept this type | ||
* instead of {@code ListenableFuture}. | ||
* | ||
* <p>This class is GWT-compatible. | ||
* | ||
* @since {@code com.google.guava:failureaccess:1.0}, which was added as a dependency of Guava in | ||
* Guava 27.0 | ||
*/ | ||
public abstract class InternalFutureFailureAccess { | ||
/** Constructor for use by subclasses. */ | ||
protected InternalFutureFailureAccess() {} | ||
|
||
/** | ||
* Usually returns {@code null} but, if this {@code Future} has failed, may <i>optionally</i> | ||
* return the cause of the failure. "Failure" means specifically "completed with an exception"; it | ||
* does not include "was cancelled." To be explicit: If this method returns a non-null value, | ||
* then: | ||
* | ||
* <ul> | ||
* <li>{@code isDone()} must return {@code true} | ||
* <li>{@code isCancelled()} must return {@code false} | ||
* <li>{@code get()} must not block, and it must throw an {@code ExecutionException} with the | ||
* return value of this method as its cause | ||
* </ul> | ||
* | ||
* <p>This method is {@code protected} so that classes like {@code | ||
* com.google.common.util.concurrent.SettableFuture} do not expose it to their users as an | ||
* instance method. In the unlikely event that you need to call this method, call {@link | ||
* InternalFutures#tryInternalFastPathGetFailure(InternalFutureFailureAccess)}. | ||
*/ | ||
protected abstract Throwable tryInternalFastPathGetFailure(); | ||
} |
Oops, something went wrong.