public int getItemViewType (int position) { Entry e = getItem(position); if (e.getType().equals(Entry.Type.IMAGE_ENTRY)) { return 0; } return 1; }
public boolean iterate() { doCheckpoint(); return false; } }, "ActiveMQ Journal Checkpoint Worker");
public boolean iterate() { asyncWrite(); return false; } }, "Checkpoint: " + destination);
public void recoverNextMessages(int maxReturned, MessageRecoveryListener listener) throws Exception { RecoveryListenerAdapter recoveryListener = new RecoveryListenerAdapter(this, listener); referenceStore.recoverNextMessages(maxReturned, recoveryListener); if (recoveryListener.size() == 0 && recoveryListener.hasSpace()) { flush(); referenceStore.recoverNextMessages(maxReturned, recoveryListener); } }
public boolean replay(AMQPersistenceAdapter adapter, ConnectionContext context) throws IOException { boolean result = false; AMQMessageStore store = (AMQMessageStore)adapter.createMessageStore(destination); if (operationType == ADD_OPERATION_TYPE) { result = store.replayAddMessage(context, (Message)data, location); } else if (operationType == REMOVE_OPERATION_TYPE) { result = store.replayRemoveMessage(context, (MessageAck)data); } else { JournalTopicAck ack = (JournalTopicAck)data; result = ((AMQTopicMessageStore)store).replayAcknowledge(context, ack.getClientId(), ack .getSubscritionName(), ack.getMessageId()); } return result; }
public void recoverNextMessages(String clientId, String subscriptionName, int maxReturned, final MessageRecoveryListener listener) throws Exception { RecoveryListenerAdapter recoveryListener = new RecoveryListenerAdapter(this, listener); topicReferenceStore.recoverNextMessages(clientId, subscriptionName,maxReturned, recoveryListener); if (recoveryListener.size() == 0) { flush(); topicReferenceStore.recoverNextMessages(clientId,subscriptionName, maxReturned, recoveryListener); } }
public int getMessageCount(String clientId, String subscriberName) throws IOException { flush(); SubscriptionInfo info = lookupSubscription(clientId, subscriberName); try { MessageCounter counter = new MessageCounter(info, this); topicReferenceStore.recoverSubscription(clientId, subscriberName, counter); return counter.count; } catch (Exception e) { throw IOExceptionSupport.create(e); } }
public void add(AMQMessageStore store, MessageAck ack) { operations.add(new AMQTxOperation(AMQTxOperation.REMOVE_OPERATION_TYPE, store.getDestination(), ack, null)); }
public void add(AMQTopicMessageStore store, JournalTopicAck ack) { operations.add(new AMQTxOperation(AMQTxOperation.ACK_OPERATION_TYPE, store.getDestination(), ack, null)); }
/** * Replays the referenceStore first as those messages are the oldest ones, then messages are replayed from the * transaction log and then the cache is updated. * * @param listener * @throws Exception */ public void recover(final MessageRecoveryListener listener) throws Exception { flush(); referenceStore.recover(new RecoveryListenerAdapter(this, listener)); }
public void recoverSubscription(String clientId, String subscriptionName, MessageRecoveryListener listener) throws Exception { flush(); topicReferenceStore.recoverSubscription(clientId, subscriptionName, new RecoveryListenerAdapter(this, listener)); }
public void onUsageChanged(Usage usage, int oldPercentUsage, int newPercentUsage) { newPercentUsage = (newPercentUsage / 10) * 10; oldPercentUsage = (oldPercentUsage / 10) * 10; if (newPercentUsage >= 70 && oldPercentUsage < newPercentUsage) { checkpoint(false); } }
/** * @param command * @param syncHint * @return * @throws IOException */ public Location writeCommand(DataStructure command, boolean syncHint) throws IOException { return writeCommand(command, syncHint,false); }
public void run() { cleanup(); } };
public AMQTx getTx(TransactionId txid, Location location) { AMQTx tx = null; synchronized (inflightTransactions) { tx = inflightTransactions.get(txid); if (tx == null) { tx = new AMQTx(location); inflightTransactions.put(txid, tx); } } return tx; }
public void add(AMQMessageStore store, Message msg, Location location) { operations.add(new AMQTxOperation(AMQTxOperation.ADD_OPERATION_TYPE, store.getDestination(), msg, location)); }
public void run() { checkpoint(false); } };