Search in sources :

Example 1 with MessageStoreLogSubject

use of org.apache.qpid.server.logging.subjects.MessageStoreLogSubject in project qpid-broker-j by apache.

the class AbstractVirtualHost method onOpen.

@Override
protected void onOpen() {
    super.onOpen();
    registerSystemNodes();
    _messageStore = createMessageStore();
    _messageStoreLogSubject = new MessageStoreLogSubject(getName(), _messageStore.getClass().getSimpleName());
    _messageStore.addEventListener(this, Event.PERSISTENT_MESSAGE_SIZE_OVERFULL);
    _messageStore.addEventListener(this, Event.PERSISTENT_MESSAGE_SIZE_UNDERFULL);
    _fileSystemMaxUsagePercent = getContextValue(Integer.class, Broker.STORE_FILESYSTEM_MAX_USAGE_PERCENT);
    _flowToDiskCheckPeriod = getContextValue(Long.class, FLOW_TO_DISK_CHECK_PERIOD);
    _isDiscardGlobalSharedSubscriptionLinksOnDetach = getContextValue(Boolean.class, DISCARD_GLOBAL_SHARED_SUBSCRIPTION_LINKS_ON_DETACH);
    QpidServiceLoader serviceLoader = new QpidServiceLoader();
    for (ConnectionValidator validator : serviceLoader.instancesOf(ConnectionValidator.class)) {
        if ((_enabledConnectionValidators.isEmpty() && (_disabledConnectionValidators.isEmpty()) || !_disabledConnectionValidators.contains(validator.getType())) || _enabledConnectionValidators.contains(validator.getType())) {
            _connectionValidators.add(validator);
        }
    }
    PreferencesRoot preferencesRoot = (VirtualHostNode) getParent();
    _preferenceStore = preferencesRoot.createPreferenceStore();
    _linkRegistry = createLinkRegistry();
    createHousekeepingExecutor();
}
Also used : QpidServiceLoader(org.apache.qpid.server.plugin.QpidServiceLoader) PreferencesRoot(org.apache.qpid.server.store.preferences.PreferencesRoot) AtomicLong(java.util.concurrent.atomic.AtomicLong) MessageStoreLogSubject(org.apache.qpid.server.logging.subjects.MessageStoreLogSubject) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) ConnectionValidator(org.apache.qpid.server.plugin.ConnectionValidator)

Example 2 with MessageStoreLogSubject

use of org.apache.qpid.server.logging.subjects.MessageStoreLogSubject in project qpid-broker-j by apache.

the class SynchronousMessageStoreRecoverer method recover.

@Override
public ListenableFuture<Void> recover(QueueManagingVirtualHost<?> virtualHost) {
    EventLogger eventLogger = virtualHost.getEventLogger();
    MessageStore store = virtualHost.getMessageStore();
    MessageStore.MessageStoreReader storeReader = store.newMessageStoreReader();
    MessageStoreLogSubject logSubject = new MessageStoreLogSubject(virtualHost.getName(), store.getClass().getSimpleName());
    Map<Queue<?>, Integer> queueRecoveries = new TreeMap<>();
    Map<Long, ServerMessage<?>> recoveredMessages = new HashMap<>();
    Map<Long, StoredMessage<?>> unusedMessages = new TreeMap<>();
    Map<UUID, Integer> unknownQueuesWithMessages = new HashMap<>();
    Map<Queue<?>, Integer> queuesWithUnknownMessages = new HashMap<>();
    eventLogger.message(logSubject, MessageStoreMessages.RECOVERY_START());
    storeReader.visitMessages(new MessageVisitor(recoveredMessages, unusedMessages));
    eventLogger.message(logSubject, TransactionLogMessages.RECOVERY_START(null, false));
    try {
        storeReader.visitMessageInstances(new MessageInstanceVisitor(virtualHost, store, queueRecoveries, recoveredMessages, unusedMessages, unknownQueuesWithMessages, queuesWithUnknownMessages));
    } finally {
        if (!unknownQueuesWithMessages.isEmpty()) {
            unknownQueuesWithMessages.forEach((queueId, count) -> {
                LOGGER.info("Discarded {} entry(s) associated with queue id '{}' as a queue with this " + "id does not appear in the configuration.", count, queueId);
            });
        }
        if (!queuesWithUnknownMessages.isEmpty()) {
            queuesWithUnknownMessages.forEach((queue, count) -> {
                LOGGER.info("Discarded {} entry(s) associated with queue '{}' as the referenced message " + "does not exist.", count, queue.getName());
            });
        }
    }
    for (Map.Entry<Queue<?>, Integer> entry : queueRecoveries.entrySet()) {
        Queue<?> queue = entry.getKey();
        Integer deliveredCount = entry.getValue();
        eventLogger.message(logSubject, TransactionLogMessages.RECOVERED(deliveredCount, queue.getName()));
        eventLogger.message(logSubject, TransactionLogMessages.RECOVERY_COMPLETE(queue.getName(), true));
        queue.completeRecovery();
    }
    for (Queue<?> q : virtualHost.getChildren(Queue.class)) {
        if (!queueRecoveries.containsKey(q)) {
            q.completeRecovery();
        }
    }
    storeReader.visitDistributedTransactions(new DistributedTransactionVisitor(virtualHost, eventLogger, logSubject, recoveredMessages, unusedMessages));
    for (StoredMessage<?> m : unusedMessages.values()) {
        LOGGER.debug("Message id '{}' is orphaned, removing", m.getMessageNumber());
        m.remove();
    }
    if (unusedMessages.size() > 0) {
        LOGGER.info("Discarded {} orphaned message(s).", unusedMessages.size());
    }
    eventLogger.message(logSubject, TransactionLogMessages.RECOVERY_COMPLETE(null, false));
    eventLogger.message(logSubject, MessageStoreMessages.RECOVERED(recoveredMessages.size() - unusedMessages.size()));
    eventLogger.message(logSubject, MessageStoreMessages.RECOVERY_COMPLETE());
    return Futures.immediateFuture(null);
}
Also used : MessageStore(org.apache.qpid.server.store.MessageStore) EventLogger(org.apache.qpid.server.logging.EventLogger) HashMap(java.util.HashMap) ServerMessage(org.apache.qpid.server.message.ServerMessage) TreeMap(java.util.TreeMap) StoredMessage(org.apache.qpid.server.store.StoredMessage) MessageStoreLogSubject(org.apache.qpid.server.logging.subjects.MessageStoreLogSubject) UUID(java.util.UUID) Queue(org.apache.qpid.server.model.Queue) HashMap(java.util.HashMap) Map(java.util.Map) TreeMap(java.util.TreeMap)

Example 3 with MessageStoreLogSubject

use of org.apache.qpid.server.logging.subjects.MessageStoreLogSubject in project qpid-broker-j by apache.

the class AbstractVirtualHostNode method postResolve.

@Override
protected void postResolve() {
    super.postResolve();
    DurableConfigurationStore store = getConfigurationStore();
    if (store == null) {
        store = createConfigurationStore();
    }
    _configurationStoreLogSubject = new MessageStoreLogSubject(getName(), store.getClass().getSimpleName());
}
Also used : DurableConfigurationStore(org.apache.qpid.server.store.DurableConfigurationStore) MessageStoreLogSubject(org.apache.qpid.server.logging.subjects.MessageStoreLogSubject)

Aggregations

MessageStoreLogSubject (org.apache.qpid.server.logging.subjects.MessageStoreLogSubject)3 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 UUID (java.util.UUID)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 EventLogger (org.apache.qpid.server.logging.EventLogger)1 ServerMessage (org.apache.qpid.server.message.ServerMessage)1 Queue (org.apache.qpid.server.model.Queue)1 ConnectionValidator (org.apache.qpid.server.plugin.ConnectionValidator)1 QpidServiceLoader (org.apache.qpid.server.plugin.QpidServiceLoader)1 DurableConfigurationStore (org.apache.qpid.server.store.DurableConfigurationStore)1 MessageStore (org.apache.qpid.server.store.MessageStore)1 StoredMessage (org.apache.qpid.server.store.StoredMessage)1 PreferencesRoot (org.apache.qpid.server.store.preferences.PreferencesRoot)1