Implemented global gen_counter based on gen_server.