void appendAddRecord(long id, byte recordType, Persister persister, Object record, boolean sync, IOCompletion completionCallback) throws Exception;
default void appendAddRecord(long id, byte recordType, EncodingSupport record, boolean sync, IOCompletion completionCallback) throws Exception { appendAddRecord(id, recordType, EncoderPersister.getInstance(), record, sync, completionCallback); }
void appendAddRecord(long id, byte recordType, Persister persister, Object record, boolean sync, IOCompletion completionCallback) throws Exception;
default void appendAddRecord(long id, byte recordType, EncodingSupport record, boolean sync, IOCompletion completionCallback) throws Exception { appendAddRecord(id, recordType, EncoderPersister.getInstance(), record, sync, completionCallback); }
/** * @param id * @param recordType * @param record * @param sync * @throws Exception * @see org.apache.activemq.artemis.core.journal.Journal#appendAddRecord(long, byte, org.apache.activemq.artemis.core.journal.EncodingSupport, boolean) */ @Override public void appendAddRecord(final long id, final byte recordType, Persister persister, final Object record, final boolean sync, final IOCompletion completionCallback) throws Exception { if (log.isTraceEnabled()) { log.trace("Append record id = " + id + " recordType = " + recordType); } replicationManager.appendUpdateRecord(journalID, ADD_OPERATION_TYPE.ADD, id, recordType, persister, record); localJournal.appendAddRecord(id, recordType, persister, record, sync, completionCallback); }
@Override public void appendAddRecord(final long id, final byte recordType, Persister persister, final Object record, final boolean sync) throws Exception { if (log.isTraceEnabled()) { log.trace("Append record id = " + id + " recordType = " + recordType); } replicationManager.appendUpdateRecord(journalID, ADD_OPERATION_TYPE.ADD, id, recordType, persister, record); localJournal.appendAddRecord(id, recordType, persister, record, sync); }
@Override public void storeID(final long journalID, final long id) throws Exception { readLock(); try { bindingsJournal.appendAddRecord(journalID, JournalRecordIds.ID_COUNTER_RECORD, BatchingIDGenerator.createIDEncodingSupport(id), true); } finally { readUnLock(); } }
@Override public synchronized void storeID(long journalID, long id) throws Exception { bindingsJournal.appendAddRecord(journalID, JournalRecordIds.ID_COUNTER_RECORD, BatchingIDGenerator.createIDEncodingSupport(id), true); } };
@Override public void storeConnectionFactory(final PersistedConnectionFactory connectionFactory) throws Exception { deleteConnectionFactory(connectionFactory.getName()); long id = idGenerator.generateID(); connectionFactory.setId(id); jmsJournal.appendAddRecord(id, CF_RECORD, connectionFactory, true); mapFactories.put(connectionFactory.getName(), connectionFactory); }
@Override public long storeQueueStatus(long queueID, QueueStatus status) throws Exception { long recordID = idGenerator.generateID(); readLock(); try { bindingsJournal.appendAddRecord(recordID, JournalRecordIds.QUEUE_STATUS_RECORD, new QueueStatusEncoding(queueID, status), true); } finally { readUnLock(); } return recordID; }
@Override public void storeDuplicateID(final SimpleString address, final byte[] duplID, final long recordID) throws Exception { readLock(); try { DuplicateIDEncoding encoding = new DuplicateIDEncoding(address, duplID); messageJournal.appendAddRecord(recordID, JournalRecordIds.DUPLICATE_ID, encoding, syncNonTransactional, getContext(syncNonTransactional)); } finally { readUnLock(); } }
@Override public long storePendingCounter(final long queueID, final long pageID) throws Exception { readLock(); try { final long recordID = idGenerator.generateID(); PageCountPendingImpl pendingInc = new PageCountPendingImpl(queueID, pageID); // We must guarantee the record sync before we actually write on the page otherwise we may get out of sync // on the counter messageJournal.appendAddRecord(recordID, JournalRecordIds.PAGE_CURSOR_PENDING_COUNTER, pendingInc, true); return recordID; } finally { readUnLock(); } }
@Override public long storeHeuristicCompletion(final Xid xid, final boolean isCommit) throws Exception { readLock(); try { long id = generateID(); messageJournal.appendAddRecord(id, JournalRecordIds.HEURISTIC_COMPLETION, new HeuristicCompletionEncoding(xid, isCommit), true, getContext(true)); return id; } finally { readUnLock(); } }
@Override public long storePageCounterInc(long queueID, int value, long persistentSize) throws Exception { readLock(); try { final long recordID = idGenerator.generateID(); messageJournal.appendAddRecord(recordID, JournalRecordIds.PAGE_CURSOR_COUNTER_INC, new PageCountRecordInc(queueID, value, persistentSize), true, getContext()); return recordID; } finally { readUnLock(); } }
@Override public void storeAddressSetting(PersistedAddressSetting addressSetting) throws Exception { deleteAddressSetting(addressSetting.getAddressMatch()); readLock(); try { long id = idGenerator.generateID(); addressSetting.setStoreId(id); bindingsJournal.appendAddRecord(id, JournalRecordIds.ADDRESS_SETTING_RECORD, addressSetting, true); mapPersistedAddressSettings.put(addressSetting.getAddressMatch(), addressSetting); } finally { readUnLock(); } }
@Override public void storeSecurityRoles(PersistedRoles persistedRoles) throws Exception { deleteSecurityRoles(persistedRoles.getAddressMatch()); readLock(); try { final long id = idGenerator.generateID(); persistedRoles.setStoreId(id); bindingsJournal.appendAddRecord(id, JournalRecordIds.SECURITY_RECORD, persistedRoles, true); mapPersistedRoles.put(persistedRoles.getAddressMatch(), persistedRoles); } finally { readUnLock(); } }
@Override public void storeDestination(final PersistedDestination destination) throws Exception { deleteDestination(destination.getType(), destination.getName()); long id = idGenerator.generateID(); destination.setId(id); jmsJournal.appendAddRecord(id, DESTINATION_RECORD, destination, true); destinations.put(new Pair<>(destination.getType(), destination.getName()), destination); }
@Override public void storeCursorAcknowledge(long queueID, PagePosition position) throws Exception { readLock(); try { long ackID = idGenerator.generateID(); position.setRecordID(ackID); messageJournal.appendAddRecord(ackID, JournalRecordIds.ACKNOWLEDGE_CURSOR, new CursorAckRecordEncoding(queueID, position), syncNonTransactional, getContext(syncNonTransactional)); } finally { readUnLock(); } }
public long storePendingLargeMessage(final long messageID, long recordID) throws Exception { readLock(); try { if (recordID == LargeServerMessage.NO_PENDING_ID) { recordID = generateID(); } else { //this means the large message doesn't //have a pendingRecordID, but one has been //generated (coming from live server) for use. recordID = -recordID; } messageJournal.appendAddRecord(recordID, JournalRecordIds.ADD_LARGE_MESSAGE_PENDING, new PendingLargeMessageEncoding(messageID), true, getContext(true)); return recordID; } finally { readUnLock(); } }
@Override public void addGrouping(final GroupBinding groupBinding) throws Exception { GroupingEncoding groupingEncoding = new GroupingEncoding(groupBinding.getId(), groupBinding.getGroupId(), groupBinding.getClusterName()); readLock(); try { bindingsJournal.appendAddRecord(groupBinding.getId(), JournalRecordIds.GROUP_RECORD, groupingEncoding, true); } finally { readUnLock(); } }