| 123456789101112131415161718192021222324252627282930313233343536 |
- package xin.glue.ui.common.component;
- import java.util.concurrent.Executors;
- import com.posdata.glue.biz.constants.PosBizControlConstants;
- import com.posdata.glue.biz.control.PosBizProvider;
- import com.posdata.glue.context.PosContext;
- public class PosThreadManager {
- public PosThreadManager(String ServiceName) {
- if (ServiceName != null && !"".equals(ServiceName) && !"null".equals(ServiceName))
- Executors.newCachedThreadPool().execute(new Handler(ServiceName));
- }
- private static class Handler implements Runnable {
- private static final Object object_lock = new Object();
- String serviceName;
- public Handler(String ServiceName) {
- this.serviceName = ServiceName;
- }
- public void run() {
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- synchronized (object_lock) {
- PosContext context = new PosContext();
- context.put(PosBizControlConstants.SERVICE_NAME, serviceName);
- PosBizProvider.getController().doAction(context);
- }
- }
- }
- }
|