Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public HystrixMetricsPoller(MetricsAsJsonPollerListener listener, int delay) {
this.listener = listener;

ThreadFactory threadFactory = null;
if (!PlatformSpecific.isAppEngine()) {
if (!PlatformSpecific.isAppEngineStandardEnvironment()) {
threadFactory = new MetricsPollerThreadFactory();
} else {
threadFactory = PlatformSpecific.getAppEngineThreadFactory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public abstract class HystrixConcurrencyStrategy {
*/
public ThreadPoolExecutor getThreadPool(final HystrixThreadPoolKey threadPoolKey, HystrixProperty<Integer> corePoolSize, HystrixProperty<Integer> maximumPoolSize, HystrixProperty<Integer> keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue) {
ThreadFactory threadFactory = null;
if (!PlatformSpecific.isAppEngine()) {
if (!PlatformSpecific.isAppEngineStandardEnvironment()) {
threadFactory = new ThreadFactory() {
protected final AtomicInteger threadNumber = new AtomicInteger(0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public void initialize() {
int coreSize = propertiesStrategy.getTimerThreadPoolProperties().getCorePoolSize().get();

ThreadFactory threadFactory = null;
if (!PlatformSpecific.isAppEngine()) {
if (!PlatformSpecific.isAppEngineStandardEnvironment()) {
threadFactory = new ThreadFactory() {
final AtomicInteger counter = new AtomicInteger();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,31 @@
import java.util.concurrent.ThreadFactory;

public class PlatformSpecific {
private final boolean isAppEngine;
private final boolean isAppEngineStandardEnvironment;

private static PlatformSpecific INSTANCE = new PlatformSpecific();

private PlatformSpecific() {
isAppEngine = determineAppEngineReflectively();
isAppEngineStandardEnvironment = determineAppEngineReflectively();
}

public static boolean isAppEngine() {
return INSTANCE.isAppEngine;
public static boolean isAppEngineStandardEnvironment() {
return INSTANCE.isAppEngineStandardEnvironment;
}

/*
* This detection mechanism is from Guava - specifically
* http://docs.guava-libraries.googlecode.com/git/javadoc/src-html/com/google/common/util/concurrent/MoreExecutors.html#line.766
* Added GAE_LONG_APP_ID check to detect only AppEngine Standard Environment
*/
private static boolean determineAppEngineReflectively() {
if (System.getProperty("com.google.appengine.runtime.environment") == null) {
return false;
}
// GAE_LONG_APP_ID is only set in the GAE Flexible Environment, where we want standard threading
if (System.getenv("GAE_LONG_APP_ID") != null) {
return false;
}
try {
// If the current environment is null, we're not inside AppEngine.
return Class.forName("com.google.apphosting.api.ApiProxy")
Expand Down