1 46 package org.mr.kernel.services.queues; 47 48 import org.mr.MantaAgent; 49 import org.mr.api.jms.MantaConnection; 50 51 55 public class QueueServiceFactory { 56 57 public AbstractQueueService generateQueueService(String service){ 58 AbstractQueueService result; 59 60 ForeignQueueImpl foreignImpl = 61 ForeignQueueFactory.createForeignQueueImpl(service); 62 if (foreignImpl != null) { 63 result = new ForeignQueueService(service, foreignImpl); 64 } else { 65 result = new QueueService(service); 66 } 67 if (result.isTempQueue()) { 68 String tempQueueOwner = service.substring(7,service.indexOf('}')); 69 70 QueueMaster coordinator = new QueueMaster(tempQueueOwner,service); 71 coordinator.setValidUntil(Long.MAX_VALUE); 72 result.setQueueMaster(coordinator); 73 String myName = MantaAgent.getInstance().getAgentName(); 74 if(tempQueueOwner.equals(myName)){ 75 result.active(); 76 } 77 78 } 79 return result; 80 } 81 82 } 83 | Popular Tags |