cancel
Showing results for 
Search instead for 
Did you mean: 

Thread creation in service layer

Former Member
0 Kudos

Hi,

As part of business logic, I want to create a new thread and call a method inside that.When i execute ,it is throwing "No tenant active error". Any idea on how to create a thread inside a service class

 new Thread(new Runnable()
            {
                  public void run() 
                 { 
                      LOG.debug("Waiting for Replication to complete");
                      try 
                      {
                 Thread.sleep(30*1000);
                 disableFullIndexFlag();    
                     
              } 
                      catch (InterruptedException e) 
                      {
                         e.printStackTrace();
             }
                     
                 }
             }).start();

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Try this:

 de.hybris.platform.core.Registry.activateMasterTenant()

I did the same thing long time ago (4.x) and I had to create jalo session as well.