/// <summary>
        /// Create and put new token in cache.
        /// </summary>
        /// <param name="name"> token name </param>
        /// <returns> newly created token id </returns>
        /// <exception cref="KernelException"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected synchronized int createToken(String name) throws org.neo4j.internal.kernel.api.exceptions.KernelException
        protected internal override int CreateToken(string name)
        {
            lock (this)
            {
                int?id = TokenRegistry.getId(name);
                if (id != null)
                {
                    return(id.Value);
                }

                id = _tokenCreator.createToken(name);
                try
                {
                    TokenRegistry.put(new NamedToken(name, id.Value));
                }
                catch (NonUniqueTokenException e)
                {
                    throw new System.InvalidOperationException("Newly created token should be unique.", e);
                }
                return(id.Value);
            }
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void addToken(org.neo4j.internal.kernel.api.NamedToken token) throws NonUniqueTokenException
        public override void AddToken(NamedToken token)
        {
            TokenRegistry.put(token);
        }