()
| 758 | } |
| 759 | |
| 760 | @GwtIncompatible // TODO |
| 761 | private static boolean isAppEngine() { |
| 762 | if (System.getProperty("com.google.appengine.runtime.environment") == null) { |
| 763 | return false; |
| 764 | } |
| 765 | try { |
| 766 | // If the current environment is null, we're not inside AppEngine. |
| 767 | return Class.forName("com.google.apphosting.api.ApiProxy").getMethod("getCurrentEnvironment").invoke(null) != null; |
| 768 | } catch (ClassNotFoundException e) { |
| 769 | // If ApiProxy doesn't exist, we're not on AppEngine at all. |
| 770 | return false; |
| 771 | } catch (InvocationTargetException e) { |
| 772 | // If ApiProxy throws an exception, we're not in a proper AppEngine environment. |
| 773 | return false; |
| 774 | } catch (IllegalAccessException e) { |
| 775 | // If the method isn't accessible, we're not on a supported version of AppEngine; |
| 776 | return false; |
| 777 | } catch (NoSuchMethodException e) { |
| 778 | // If the method doesn't exist, we're not on a supported version of AppEngine; |
| 779 | return false; |
| 780 | } |
| 781 | } |
| 782 | |
| 783 | /** |
| 784 | * Creates a thread using {@link #platformThreadFactory}, and sets its name to {@code name} unless |
no test coverage detected