Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 73760

AX2009: Create and run thread on server tier

$
0
0

Hi there

I'm trying to create and to run a separated thread inside a method running server side. However, there's no error at all, but the thread itself seems never called. If I try the same on client side, all is running fine. Can anybody assist me?

Here's what I've done:

static server void threadController()

{

   ExecutePermission executePermission = new ExecutePermission();

   str               result;

   Thread            thread;

   ;

   executePermission.assert();

   thread = new Thread();

   thread.run(classnum(WorkToDo), staticmethodstr(WorkToDo, threadEntry));

   while (! thread.endDate())

   {

       sleep(1000);

   }

   result = conpeek(thread.getOutputParm(), 1);

   info("Message from thread: " + result);

}

static server void threadEntry(Thread _t)

{

   ;

   // do something (not implemented yet)

   _t.setOutputParm(["All done"]);

}

When I switch all on client tier, the infolog in threadController will raise "All done", when I switch to server thread, the outParm has length of zero elements.

How to solve?

Thank you for your help.


Viewing all articles
Browse latest Browse all 73760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>