You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Vivek Goel <go...@gmail.com> on 2013/09/03 09:40:00 UTC

Getting IllegalStateException in thrift server

I am using thrift C++ library.

My code look like:

  thread_manager->threadFactory(threadfactory);
  thread_manager->start();
  server = new TNonblockingServer(processor, protocolfactory,
                                   port,
                                   thread_manager);
  server->serve();


Sometimes, while starting the process. I am getting following error:

Thrift: Tue Sep 3 06:54:47 2013 IllegalStateException: Server::process()
ThreadManager::Impl::add ThreadManager not started


regards
Vivek Goel

Re: Getting IllegalStateException in thrift server

Posted by Randy Abernethy <ra...@gmail.com>.
Hello Vivek,

Once the ThreadManager::Impl is stopped you can not restart it. Is it
possible that the ThreadManager::Impl::stopImpl() method was called prior
to the code you show? If so you will need to destroy the old thread_manager
and create a new one for the next server run.

You can call the ThreadManager::state() method before and after the call to
start() to see what is happening.


  thread_manager->threadFactory(threadfactory);
  std::cout << thread_manager->state();  << std::endl; //or some such
  thread_manager->start();
  std::cout << thread_manager->state();  << std::endl;
  server = new TNonblockingServer(processor, protocolfactory,
                                   port,
                                   thread_manager);
  server->serve();


Best,
Randy



On Tue, Sep 3, 2013 at 12:40 AM, Vivek Goel <go...@gmail.com> wrote:

> I am using thrift C++ library.
>
> My code look like:
>
>   thread_manager->threadFactory(threadfactory);
>   thread_manager->start();
>   server = new TNonblockingServer(processor, protocolfactory,
>                                    port,
>                                    thread_manager);
>   server->serve();
>
>
> Sometimes, while starting the process. I am getting following error:
>
> Thrift: Tue Sep 3 06:54:47 2013 IllegalStateException: Server::process()
> ThreadManager::Impl::add ThreadManager not started
>
>
> regards
> Vivek Goel
>