activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbert...@apache.org
Subject [2/2] activemq-artemis git commit: ARTEMIS-1009 Fixing exporter/importer
Date Mon, 06 Mar 2017 20:21:29 GMT
ARTEMIS-1009 Fixing exporter/importer


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/3882b007
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/3882b007
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/3882b007

Branch: refs/heads/master
Commit: 3882b00735fcfb1da9f5f34ed7e1e36e0b2a6968
Parents: 3566077
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Mon Mar 6 13:22:05 2017 -0500
Committer: Justin Bertram <jbertram@apache.org>
Committed: Mon Mar 6 14:20:54 2017 -0600

----------------------------------------------------------------------
 .../artemis/spi/core/protocol/MessagePersister.java  | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3882b007/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/protocol/MessagePersister.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/protocol/MessagePersister.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/protocol/MessagePersister.java
index 14891f5..adba2d7 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/protocol/MessagePersister.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/protocol/MessagePersister.java
@@ -18,11 +18,14 @@
 package org.apache.activemq.artemis.spi.core.protocol;
 
 import java.util.Map;
+import java.util.ServiceLoader;
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
 import org.apache.activemq.artemis.api.core.Message;
+import org.apache.activemq.artemis.core.message.impl.CoreMessagePersister;
 import org.apache.activemq.artemis.core.persistence.Persister;
+import org.apache.activemq.artemis.core.protocol.core.impl.CoreProtocolManagerFactory;
 import org.jboss.logging.Logger;
 
 public class MessagePersister implements Persister<Message> {
@@ -34,6 +37,14 @@ public class MessagePersister implements Persister<Message> {
    /** This will be used for reading messages */
    private static Map<Byte, Persister<Message>> protocols = new ConcurrentHashMap<>();
 
+   static {
+      MessagePersister.registerPersister(CoreProtocolManagerFactory.ID, CoreMessagePersister.getInstance());
+
+      Iterable<ProtocolManagerFactory> protocols  = ServiceLoader.load(ProtocolManagerFactory.class,
MessagePersister.class.getClassLoader());
+      for (ProtocolManagerFactory next : protocols) {
+         MessagePersister.registerPersister(next.getStoreID(), next.getPersister());
+      }
+   }
 
    public static void registerProtocol(ProtocolManagerFactory manager) {
       Persister<Message> messagePersister = manager.getPersister();
@@ -49,7 +60,9 @@ public class MessagePersister implements Persister<Message> {
    }
 
    public static void registerPersister(byte recordType, Persister<Message> persister)
{
-      protocols.put(recordType, persister);
+      if (persister != null) {
+         protocols.put(recordType, persister);
+      }
    }
 
    public static MessagePersister getInstance() {


Mime
View raw message