@Override public ListenableFuture<Object> asyncAddTopicMessage(final ConnectionContext context, final Message message) throws IOException { if (isConcurrentStoreAndDispatchTopics()) { message.beforeMarshall(wireFormat); StoreTopicTask result = new StoreTopicTask(this, context, message, subscriptionCount.get()); result.aquireLocks(); addTopicTask(this, result); return result.getFuture(); } else { return super.asyncAddTopicMessage(context, message); } }
/** * @param context * @throws IOException * @see org.apache.activemq.store.PersistenceAdapter#beginTransaction(org.apache.activemq.broker.ConnectionContext) */ @Override public void beginTransaction(ConnectionContext context) throws IOException { this.letter.beginTransaction(context); }
/** * @param cleanup * @throws IOException * @see org.apache.activemq.store.PersistenceAdapter#checkpoint(boolean) */ @Override public void checkpoint(boolean cleanup) throws IOException { this.letter.checkpoint(cleanup); }
public KahaDBMessageStore(ActiveMQDestination destination) { super(destination); this.dest = convert(destination); this.maxAsyncJobs = getMaxAsyncJobs(); this.localDestinationSemaphore = new Semaphore(this.maxAsyncJobs); }
@Override public MessageStore createQueueMessageStore(ActiveMQQueue destination) throws IOException { String key = key(convert(destination)); MessageStore store = storeCache.get(key(convert(destination))); if (store == null) { final MessageStore queueStore = this.transactionStore.proxy(new KahaDBMessageStore(destination)); store = storeCache.putIfAbsent(key, queueStore); if (store == null) { store = queueStore; } } return store; }
private KahaDBMessageStore findMatchingStore(ActiveMQDestination activeMQDestination) throws IOException { ProxyMessageStore store = (ProxyMessageStore) storeCache.get(convert(activeMQDestination)); if (store == null) { if (activeMQDestination.isQueue()) { store = (ProxyMessageStore) createQueueMessageStore((ActiveMQQueue) activeMQDestination); } else { store = (ProxyMessageStore) createTopicMessageStore((ActiveMQTopic) activeMQDestination); } } return (KahaDBMessageStore) store.getDelegate(); }
@Override public ListenableFuture<Object> asyncAddQueueMessage(final ConnectionContext context, final Message message) throws IOException { if (isConcurrentStoreAndDispatchQueues()) { message.beforeMarshall(wireFormat); StoreQueueTask result = new StoreQueueTask(this, context, message); ListenableFuture<Object> future = result.getFuture(); message.getMessageId().setFutureOrSequenceLong(future); message.setRecievedByDFBridge(true); // flag message as concurrentStoreAndDispatch result.aquireLocks(); synchronized (asyncTaskMap) { addQueueTask(this, result); if (indexListener != null) { indexListener.onAdd(new IndexListener.MessageContext(context, message, null)); } } return future; } else { return super.asyncAddQueueMessage(context, message); } }
ActiveMQDestination convert(String dest) { int p = dest.indexOf(":"); if (p < 0) { throw new IllegalArgumentException("Not in the valid destination format"); } int type = Integer.parseInt(dest.substring(0, p)); String name = dest.substring(p + 1); return convert(type, name); }
/** * @param context * @throws IOException * @see org.apache.activemq.store.PersistenceAdapter#commitTransaction(org.apache.activemq.broker.ConnectionContext) */ @Override public void commitTransaction(ConnectionContext context) throws IOException { this.letter.commitTransaction(context); }
/** * @throws IOException * @see org.apache.activemq.store.PersistenceAdapter#deleteAllMessages() */ @Override public void deleteAllMessages() throws IOException { this.letter.deleteAllMessages(); }
/** * @return TransactionStore * @throws IOException * @see org.apache.activemq.store.PersistenceAdapter#createTransactionStore() */ @Override public TransactionStore createTransactionStore() throws IOException { return this.letter.createTransactionStore(); }
/** * @param destination * @return TopicMessageStore * @throws IOException * @see org.apache.activemq.store.PersistenceAdapter#createTopicMessageStore(org.apache.activemq.command.ActiveMQTopic) */ @Override public TopicMessageStore createTopicMessageStore(ActiveMQTopic destination) throws IOException { return this.letter.createTopicMessageStore(destination); }
/** * @param destination * @return MessageStore * @throws IOException * @see org.apache.activemq.store.PersistenceAdapter#createQueueMessageStore(org.apache.activemq.command.ActiveMQQueue) */ @Override public MessageStore createQueueMessageStore(ActiveMQQueue destination) throws IOException { return this.letter.createQueueMessageStore(destination); }
@Override public TopicMessageStore createTopicMessageStore(ActiveMQTopic destination) throws IOException { String key = key(convert(destination)); MessageStore store = storeCache.get(key(convert(destination))); if (store == null) { final TopicMessageStore topicStore = this.transactionStore.proxy(new KahaDBTopicMessageStore(destination)); store = storeCache.putIfAbsent(key, topicStore); if (store == null) { store = topicStore; } } return (TopicMessageStore) store; }
public KahaDBMessageStore(ActiveMQDestination destination) { super(destination); this.dest = convert(destination); this.maxAsyncJobs = getMaxAsyncJobs(); this.localDestinationSemaphore = new Semaphore(this.maxAsyncJobs); }
@Override public Future<Object> asyncAddQueueMessage(final ConnectionContext context, final Message message) throws IOException { if (isConcurrentStoreAndDispatchQueues()) { StoreQueueTask result = new StoreQueueTask(this, context, message); result.aquireLocks(); addQueueTask(this, result); return result.getFuture(); } else { return super.asyncAddQueueMessage(context, message); } }
private ActiveMQDestination convert(KahaDestination commandDestination) { return convert(commandDestination.getType().getNumber(), commandDestination.getName()); }
/** * @param context * @throws IOException * @see org.apache.activemq.store.PersistenceAdapter#commitTransaction(org.apache.activemq.broker.ConnectionContext) */ @Override public void commitTransaction(ConnectionContext context) throws IOException { this.letter.commitTransaction(context); }
/** * @throws IOException * @see org.apache.activemq.store.PersistenceAdapter#deleteAllMessages() */ @Override public void deleteAllMessages() throws IOException { this.letter.deleteAllMessages(); }
/** * @return TransactionStore * @throws IOException * @see org.apache.activemq.store.PersistenceAdapter#createTransactionStore() */ @Override public TransactionStore createTransactionStore() throws IOException { return this.letter.createTransactionStore(); }