Skip to content

Commit

Permalink
Merge pull request #117 from basil/guava
Browse files Browse the repository at this point in the history
Vendored Guava should not use reflection
  • Loading branch information
car-roll authored Dec 15, 2021
2 parents 1a3cd6a + e295dc5 commit 20f48f1
Show file tree
Hide file tree
Showing 5 changed files with 303 additions and 168 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.google.common.util.concurrent.AbstractFuture;
import com.google.common.util.concurrent.AsyncFunction;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;

import javax.annotation.Nullable;
import java.lang.reflect.UndeclaredThrowableException;
Expand All @@ -30,6 +29,7 @@
* in a {@code UndeclaredThrowableException} so that this class can get
* access to the cause.
*/
@Deprecated
class ChainingListenableFuture<I, O>
extends AbstractFuture<O> implements Runnable {

Expand Down Expand Up @@ -208,7 +208,7 @@ public void run() {
ChainingListenableFuture.this.outputFuture = null;
}
}
}, Futures.newExecutorService());
}, MoreExecutors.directExecutor());
} catch (UndeclaredThrowableException e) {
// Set the cause of the exception as this future's exception
setException(e.getCause());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (C) 2007 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 org.jenkinsci.plugins.workflow.support.concurrent;

import com.google.common.annotations.GwtCompatible;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import java.util.concurrent.Executor;

/**
* An {@link Executor} that runs each task in the thread that invokes {@link Executor#execute
* execute}.
*/
@GwtCompatible
@Restricted(NoExternalUse.class)
enum DirectExecutor implements Executor {
INSTANCE;

@Override
public void execute(Runnable command) {
command.run();
}

@Override
public String toString() {
return "MoreExecutors.directExecutor()";
}
}
Loading

0 comments on commit 20f48f1

Please sign in to comment.