framework/application/engine/api/src/main/java/org/ldp4j/application/engine/ApplicationEngine.java
public static ApplicationEngine engine() {
		ApplicationEngine result = ApplicationEngine.CACHED_DELEGATE.get();
		if (result != null) {
			return result;
		}
		synchronized(ApplicationEngine.CACHED_DELEGATE) {
			result=ApplicationEngine.CACHED_DELEGATE.get();
			if(result==null) {
				result=findDelegate();
				ApplicationEngineState state=ApplicationEngineState.AVAILABLE;
				if(result==null) {
					result=new DefaultApplicationEngine();
					state=ApplicationEngineState.UNDEFINED;
				}
				ApplicationEngine.CACHED_DELEGATE.set(result);
				result.setState(state);
			}
			return result;
		}
	}
public static ApplicationEngine engine() {
		ApplicationEngine result = ApplicationEngine.CACHED_DELEGATE.get();
		if (result != null) {
			return result;
		}
		synchronized(ApplicationEngine.CACHED_DELEGATE) {
			result=ApplicationEngine.CACHED_DELEGATE.get();
			if(result==null) {
				result=findDelegate();
				ApplicationEngineState state=ApplicationEngineState.AVAILABLE;
				if(result==null) {
					result=new DefaultApplicationEngine();
					state=ApplicationEngineState.UNDEFINED;
				}
				ApplicationEngine.CACHED_DELEGATE.set(result);
				result.setState(state);
			}
			return result;
		}
	}
public static ApplicationEngine engine ( ) { ApplicationEngine result = ApplicationEngine . CACHED_DELEGATE . get ( ) ; if ( result != null ) { return result ; } synchronized ( ApplicationEngine . CACHED_DELEGATE ) { result = ApplicationEngine . CACHED_DELEGATE . get ( ) ; if ( result == null ) { result = findDelegate ( ) ; ApplicationEngineState state = ApplicationEngineState . AVAILABLE ; if ( result == null ) { result = new DefaultApplicationEngine ( ) ; state = ApplicationEngineState . UNDEFINED ; } ApplicationEngine . CACHED_DELEGATE . set ( result ) ; result . setState ( state ) ; } return result ; } }
Obtain a {@code ApplicationEngine} instance. If an instance had not
already been created and set via {@link #setEngine(ApplicationEngine)},
the first invocation will create an instance which will then be cached
for future use.

<p>
The algorithm used to locate the {@code ApplicationEngine} subclass to
use consists of the following steps:
</p>
<ul>
<li>
If a resource with the name of
{@code META-INF/services/org.ldp4j.application.engine.ApplicationEngine}
exists, then its first line, if present, is used as the UTF-8 encoded
name of the implementation class.</li>
<li>
If a file named {@value #LDP4J_APPLICATION_ENGINE_CFG} in the
<code>lib</code> directory of current JAVA_HOME exists and it is readable
by the {@code java.util.Properties.load(InputStream)} method and it
contains an entry whose key is
{@value #LDP4J_APPLICATION_ENGINE_PROPERTY}, then the value of that entry
is used as the name of the implementation class.</li>
<li>
If a system property named {@value #LDP4J_APPLICATION_ENGINE_PROPERTY} is
defined, then its value is used as the name of the implementation class.</li>
<li>
Finally, a default implementation class name is used.</li>
</ul>

@return an instance of {@code ApplicationEngine}.
Obtain a { @code ApplicationEngine } instance . If an instance had not already been created and set via { @link #setEngine ( ApplicationEngine ) } the first invocation will create an instance which will then be cached for future use .