简体   繁体   中英

MVC and Multi-Thread

I have a (Model) class classModel which implements Runnable .

My controller Manager (which is a Singleton) will create 2 threads for 2 objects 'classModel'.

First question : Is this the work of the controller to do this ? Or should I create another class which will create threads and start them ?

Then, in my classModel.run() I'll send Strings (every loop) to my Manager which share it (with a List<String> ) to show it in the view.

How am I supposed to do that ? My view needs to implement Runnable and check every loop if something is shared in the controller ? Or another way ?

First of all, Model just holds data. Controller always delegates its works.

Yes, you need to create in between class that take command from controller and call it Service.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM