public function callTimeout(TimerInterface $timer, MethodInterface $timeoutMethod = null)
    {

        try {
            // synchronize the application instance and register the class loaders
            $application = $this->getApplication();
            $application->registerClassLoaders();

            // register the applications annotation registries
            $application->registerAnnotationRegistries();

            // initialize the initial context instance
            $initialContext = new InitialContext();
            $initialContext->injectApplication($application);

            // add the application instance to the environment
            Environment::singleton()->setAttribute(EnvironmentKeys::APPLICATION, $application);

            // create s simulated request/session ID whereas session equals request ID
            Environment::singleton()->setAttribute(EnvironmentKeys::SESSION_ID, $sessionId = SessionUtils::generateRandomString());
            Environment::singleton()->setAttribute(EnvironmentKeys::REQUEST_ID, $sessionId);

            // log a message with the timed object information
            \info(sprintf('Now invoke timed object "%s" with session ID "%s"', $this->getTimedObjectId(), $sessionId));

            // lookup the enterprise bean using the initial context
            $instance = $initialContext->lookup($this->getTimedObjectId());

            // check if the timeout method has been passed
            if ($timeoutMethod != null) {
                // if yes, invoke it on the proxy
                $callback = array($instance, $timeoutMethod->getMethodName());
                call_user_func_array($callback, array($timer));
                return;
            }

            // check if we've a default timeout method
            if ($this->defaultTimeoutMethod != null) {
                // if yes, invoke it on the proxy
                $callback = array($instance, $this->defaultTimeoutMethod->getMethodName());
                call_user_func_array($callback, array($timer));
                return;
            }

        } catch (\Exception $e) {
            error_log($e->__toString());
        }
    }
public function callTimeout(TimerInterface $timer, MethodInterface $timeoutMethod = null)
    {

        try {
            // synchronize the application instance and register the class loaders
            $application = $this->getApplication();
            $application->registerClassLoaders();

            // register the applications annotation registries
            $application->registerAnnotationRegistries();

            // initialize the initial context instance
            $initialContext = new InitialContext();
            $initialContext->injectApplication($application);

            // add the application instance to the environment
            Environment::singleton()->setAttribute(EnvironmentKeys::APPLICATION, $application);

            // create s simulated request/session ID whereas session equals request ID
            Environment::singleton()->setAttribute(EnvironmentKeys::SESSION_ID, $sessionId = SessionUtils::generateRandomString());
            Environment::singleton()->setAttribute(EnvironmentKeys::REQUEST_ID, $sessionId);

            // log a message with the timed object information
            \info(sprintf('Now invoke timed object "%s" with session ID "%s"', $this->getTimedObjectId(), $sessionId));

            // lookup the enterprise bean using the initial context
            $instance = $initialContext->lookup($this->getTimedObjectId());

            // check if the timeout method has been passed
            if ($timeoutMethod != null) {
                // if yes, invoke it on the proxy
                $callback = array($instance, $timeoutMethod->getMethodName());
                call_user_func_array($callback, array($timer));
                return;
            }

            // check if we've a default timeout method
            if ($this->defaultTimeoutMethod != null) {
                // if yes, invoke it on the proxy
                $callback = array($instance, $this->defaultTimeoutMethod->getMethodName());
                call_user_func_array($callback, array($timer));
                return;
            }

        } catch (\Exception $e) {
            error_log($e->__toString());
        }
    }
public function callTimeout ( TimerInterface $ timer , MethodInterface $ timeoutMethod = null ) { try { // synchronize the application instance and register the class loaders $ application = $ this -> getApplication ( ) ; $ application -> registerClassLoaders ( ) ; // register the applications annotation registries $ application -> registerAnnotationRegistries ( ) ; // initialize the initial context instance $ initialContext = new InitialContext ( ) ; $ initialContext -> injectApplication ( $ application ) ; // add the application instance to the environment Environment :: singleton ( ) -> setAttribute ( EnvironmentKeys :: APPLICATION , $ application ) ; // create s simulated request/session ID whereas session equals request ID Environment :: singleton ( ) -> setAttribute ( EnvironmentKeys :: SESSION_ID , $ sessionId = SessionUtils :: generateRandomString ( ) ) ; Environment :: singleton ( ) -> setAttribute ( EnvironmentKeys :: REQUEST_ID , $ sessionId ) ; // log a message with the timed object information \ info ( sprintf ( 'Now invoke timed object "%s" with session ID "%s"' , $ this -> getTimedObjectId ( ) , $ sessionId ) ) ; // lookup the enterprise bean using the initial context $ instance = $ initialContext -> lookup ( $ this -> getTimedObjectId ( ) ) ; // check if the timeout method has been passed if ( $ timeoutMethod != null ) { // if yes, invoke it on the proxy $ callback = array ( $ instance , $ timeoutMethod -> getMethodName ( ) ) ; call_user_func_array ( $ callback , array ( $ timer ) ) ; return ; } // check if we've a default timeout method if ( $ this -> defaultTimeoutMethod != null ) { // if yes, invoke it on the proxy $ callback = array ( $ instance , $ this -> defaultTimeoutMethod -> getMethodName ( ) ) ; call_user_func_array ( $ callback , array ( $ timer ) ) ; return ; } } catch ( \ Exception $ e ) { error_log ( $ e -> __toString ( ) ) ; } }
Responsible for invoking the timeout method on the target object.

The timerservice implementation invokes this method as a callback when a timeout occurs for the
passed timer. The timerservice implementation will be responsible for passing the correct
timeout method corresponding to the <code>timer</code> on which the timeout has occurred.

@param \AppserverIo\Psr\EnterpriseBeans\TimerInterface $timer         The timer that is passed to timeout
@param \AppserverIo\Lang\Reflection\MethodInterface    $timeoutMethod The timeout method

@return void
Responsible for invoking the timeout method on the target object .