AppserverIo\Appserver\PersistenceContainer\TimerServiceRegistry::register PHP Method

register() public method

Attaches the passed service, to the context.
public register ( AppserverIo\Psr\EnterpriseBeans\ServiceProviderInterface $instance ) : void
$instance AppserverIo\Psr\EnterpriseBeans\ServiceProviderInterface The service instance to attach
return void
    public function register(ServiceProviderInterface $instance)
    {
        // check if the service has already been registered
        if ($this->getServices()->has($pk = $instance->getPrimaryKey())) {
            throw new ServiceAlreadyRegisteredException(sprintf('It is not allowed to register service %s with primary key %s more than on times', $instance->getServiceName(), $pk));
        }
        // register the service using the primary key
        $this->getServices()->set($pk, $instance);
    }