2e2147df70a09ee86e653356aadfd61030225af7.svn-base 1021 B

123456789101112131415161718192021222324252627282930313233343536
  1. package xin.glue.ui.common.component;
  2. import java.util.concurrent.Executors;
  3. import com.posdata.glue.biz.constants.PosBizControlConstants;
  4. import com.posdata.glue.biz.control.PosBizProvider;
  5. import com.posdata.glue.context.PosContext;
  6. public class PosThreadManager {
  7. public PosThreadManager(String ServiceName) {
  8. if (ServiceName != null && !"".equals(ServiceName) && !"null".equals(ServiceName))
  9. Executors.newCachedThreadPool().execute(new Handler(ServiceName));
  10. }
  11. private static class Handler implements Runnable {
  12. private static final Object object_lock = new Object();
  13. String serviceName;
  14. public Handler(String ServiceName) {
  15. this.serviceName = ServiceName;
  16. }
  17. public void run() {
  18. try {
  19. Thread.sleep(5000);
  20. } catch (InterruptedException e) {
  21. e.printStackTrace();
  22. }
  23. synchronized (object_lock) {
  24. PosContext context = new PosContext();
  25. context.put(PosBizControlConstants.SERVICE_NAME, serviceName);
  26. PosBizProvider.getController().doAction(context);
  27. }
  28. }
  29. }
  30. }