1 24 25 package org.mr.kernel.services.queues; 26 27 import org.mr.MantaException; 28 import org.mr.kernel.services.MantaService; 29 import org.mr.kernel.services.ServiceConsumer; 30 import org.mr.core.protocol.MantaBusMessage; 31 32 33 42 43 public abstract class AbstractQueueService extends MantaService { 44 public static final int THROW_EXCEPTION_STRATERGY =0; 45 public static final int RETURN_WITHOUT_ENQUEUE_STRATERGY =1; 46 public static final int THROTTLE_STRATERGY =2; 47 48 protected int overflowStrategy; 49 50 public AbstractQueueService(String serviceName) { 51 super(serviceName); 52 } 54 public abstract void active(); 55 public abstract boolean isActive(); 56 protected abstract void registerReceiverToQueue(ServiceConsumer consumer, 57 long numberOfReceive); 58 public abstract void unregisterReceiverToQueue(ServiceConsumer consumer); 59 public abstract void close() throws MantaException; 60 protected abstract void sendQueueCopy(ServiceConsumer consumer); 61 public abstract void waitForQueueMaster(long timeToWait) 62 throws InterruptedException ; 63 public abstract void setQueueMaster(QueueMaster master); 64 public abstract QueueMaster getQueueMaster(); 65 public abstract boolean amIQueueMaster(); 66 public abstract boolean isOverflow(); 67 public abstract boolean isTempQueue(); 68 protected abstract void enqueue(MantaBusMessage msg, boolean persistent); 69 public abstract int getUnsentCount(); 70 77 public int getOverflowStrategy() { return this.overflowStrategy; } 78 public void setOverflowStrategy(int overflowStrategy) { 79 this.overflowStrategy = overflowStrategy; 80 } 81 public abstract QueueSubscriberManager getSubscriberManager(); 82 public abstract void doDequeue() throws InterruptedException ; 83 84 } | Popular Tags |