Returns the shared grape engine instance. @return the shared engine, or null if grapes are unavailable
()
| 146 | * @return the shared engine, or {@code null} if grapes are unavailable |
| 147 | */ |
| 148 | public static synchronized GrapeEngine getInstance() { |
| 149 | if (instance == null) { |
| 150 | String configuredImpl = System.getProperty(GRAPE_IMPL_SYSTEM_PROPERTY); |
| 151 | ServiceLoader.Provider<GrapeEngine> provider = findProvider(configuredImpl); |
| 152 | if (provider != null) { |
| 153 | instance = createEngineFromProvider(provider); |
| 154 | } |
| 155 | if (instance == null) { |
| 156 | LOGGER.log(WARNING, "Grapes disabled"); |
| 157 | } |
| 158 | } |
| 159 | return instance; |
| 160 | } |
| 161 | |
| 162 | private static ServiceLoader.Provider<GrapeEngine> findProvider(final String configuredImpl) { |
| 163 | List<ServiceLoader.Provider<GrapeEngine>> providers; |
no test coverage detected