Removed unused persistence classes

This commit is contained in:
andsel
2018-11-14 22:13:42 +01:00
parent a36d926460
commit cfa478067e
15 changed files with 61 additions and 1384 deletions
@@ -16,10 +16,68 @@
package io.moquette.interception.messages;
import static io.moquette.spi.IMessagesStore.StoredMessage;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.handler.codec.mqtt.MqttQoS;
import java.io.Serializable;
public class InterceptAcknowledgedMessage implements InterceptMessage {
class StoredMessage implements Serializable {
private static final long serialVersionUID = 1755296138639817304L;
private MqttQoS m_qos;
final byte[] m_payload;
final String m_topic;
private boolean m_retained;
private String m_clientID;
public StoredMessage(byte[] message, MqttQoS qos, String topic) {
m_qos = qos;
m_payload = message;
m_topic = topic;
}
public void setQos(MqttQoS qos) {
this.m_qos = qos;
}
public MqttQoS getQos() {
return m_qos;
}
public String getTopic() {
return m_topic;
}
public String getClientID() {
return m_clientID;
}
public void setClientID(String m_clientID) {
this.m_clientID = m_clientID;
}
public ByteBuf getPayload() {
return Unpooled.copiedBuffer(m_payload);
}
public void setRetained(boolean retained) {
this.m_retained = retained;
}
public boolean isRetained() {
return m_retained;
}
@Override
public String toString() {
return "PublishEvent{clientID='" + m_clientID + '\'' + ", m_retain="
+ m_retained + ", m_qos=" + m_qos + ", m_topic='" + m_topic + '\'' + '}';
}
}
private final StoredMessage msg;
private final String username;
private final String topic;
@@ -42,7 +42,7 @@ public class H2SubscriptionsRepository implements ISubscriptionsRepository {
}
@Override
public void removeSubscription(String topic, String clientID) {
public void removeSubscription(String topicFilter, String clientID) {
subscriptions.remove(topicFilter + "-" + clientID);
}
}
@@ -1,69 +0,0 @@
/*
* Copyright (c) 2012-2018 The original author or authors
* ------------------------------------------------------
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* The Apache License v2.0 is available at
* http://www.opensource.org/licenses/apache2.0.php
*
* You may elect to redistribute this code under either of these licenses.
*/
package io.moquette.persistence;
import io.moquette.spi.IMatchingCondition;
import io.moquette.spi.IMessagesStore;
import io.moquette.broker.subscriptions.Topic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*;
public class MemoryMessagesStore implements IMessagesStore {
private static final Logger LOG = LoggerFactory.getLogger(MemoryMessagesStore.class);
private Map<Topic, StoredMessage> m_retainedStore = new HashMap<>();
MemoryMessagesStore() {
}
@Override
public void initStore() {
}
@Override
public void storeRetained(Topic topic, StoredMessage storedMessage) {
LOG.debug("Store retained message for topic={}, CId={}", topic, storedMessage.getClientID());
if (storedMessage.getClientID() == null) {
throw new IllegalArgumentException("Message to be persisted must have a not null client ID");
}
m_retainedStore.put(topic, storedMessage);
}
@Override
public Collection<StoredMessage> searchMatching(IMatchingCondition condition) {
LOG.debug("searchMatching scanning all retained messages, presents are {}", m_retainedStore.size());
List<StoredMessage> results = new ArrayList<>();
for (Map.Entry<Topic, StoredMessage> entry : m_retainedStore.entrySet()) {
StoredMessage storedMsg = entry.getValue();
if (condition.match(entry.getKey())) {
results.add(storedMsg);
}
}
return results;
}
@Override
public void cleanRetained(Topic topic) {
m_retainedStore.remove(topic);
}
}
@@ -1,303 +0,0 @@
/*
* Copyright (c) 2012-2018 The original author or authors
* ------------------------------------------------------
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* The Apache License v2.0 is available at
* http://www.opensource.org/licenses/apache2.0.php
*
* You may elect to redistribute this code under either of these licenses.
*/
package io.moquette.persistence;
import io.moquette.spi.IMessagesStore.StoredMessage;
import io.moquette.spi.ISessionsStore;
import io.moquette.spi.ISubscriptionsStore;
import io.moquette.broker.subscriptions.Subscription;
import io.moquette.broker.subscriptions.Topic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.*;
public class MemorySessionStore implements ISessionsStore, ISubscriptionsStore {
private static final Logger LOG = LoggerFactory.getLogger(MemorySessionStore.class);
static final int MAX_MESSAGE_QUEUE = 1024; // number of messages
static class Session {
final String clientID;
final Map<Topic, Subscription> subscriptions = new ConcurrentHashMap<>();
boolean cleanSession;
final BlockingQueue<StoredMessage> queue = new ArrayBlockingQueue<>(MAX_MESSAGE_QUEUE);
final Map<Integer, StoredMessage> secondPhaseStore = new ConcurrentHashMap<>();
final Map<Integer, StoredMessage> outboundFlightMessages =
Collections.synchronizedMap(new HashMap<Integer, StoredMessage>());
final Map<Integer, StoredMessage> inboundFlightMessages = new ConcurrentHashMap<>();
Session(String clientID, boolean cleanSession) {
this.clientID = clientID;
this.cleanSession = cleanSession;
}
}
private final Map<String, Session> sessions = new ConcurrentHashMap<>();
private ConcurrentNavigableMap<LocalDateTime, Set<String>> sessionsClosingTimes = new ConcurrentSkipListMap<>();
MemorySessionStore() {
}
private Session getSession(String clientID) {
Session session = sessions.get(clientID);
if (session == null) {
LOG.error("Can't find the session for client <{}>", clientID);
throw new RuntimeException("Can't find the session for client <" + clientID + ">");
}
return session;
}
@Override
public void removeSubscription(Topic topic, String clientID) {
LOG.debug("removeSubscription topic filter: {} for clientID: {}", topic, clientID);
getSession(clientID).subscriptions.remove(topic);
}
@Override
public void initStore() {
}
@Override
public ISubscriptionsStore subscriptionStore() {
return this;
}
@Override
public void addNewSubscription(Subscription newSubscription) {
final String clientID = newSubscription.getClientId();
Session session = sessions.get(clientID);
if (session == null) {
LOG.error("Can't find the session for client <{}>", clientID);
return;
}
session.subscriptions.put(newSubscription.getTopicFilter(), newSubscription);
}
@Override
public void wipeSubscriptions(String clientID) {
if (!sessions.containsKey(clientID)) {
LOG.error("Can't find the session for client <{}>", clientID);
return;
}
sessions.get(clientID).subscriptions.clear();
}
@Override
public boolean contains(String clientID) {
return sessions.containsKey(clientID);
}
@Override
public void createNewDurableSession(String clientID) {
Session innerSession = new Session(clientID, false);
sessions.put(clientID, innerSession);
}
@Override
public void removeDurableSession(String clientId) {
this.sessions.remove(clientId);
this.wipeSubscriptions(clientId);
}
@Override
public void updateCleanStatus(String clientId, boolean newCleanStatus) {
sessions.get(clientId).cleanSession = newCleanStatus;
}
@Override
public PersistentSession loadSessionByKey(String clientID) {
return new PersistentSession(clientID, sessions.get(clientID).cleanSession);
}
@Override
public Collection<PersistentSession> listAllSessions() {
Collection<PersistentSession> result = new ArrayList<>();
for (Session entry : sessions.values()) {
result.add(new PersistentSession(entry.clientID, entry.cleanSession));
}
return result;
}
@Override
public List<Subscription> listAllSubscriptions() {
List<Subscription> allSubscriptions = new ArrayList<>();
for (Session entry : sessions.values()) {
allSubscriptions.addAll(entry.subscriptions.values());
}
return allSubscriptions;
}
@Override
public Collection<Subscription> listClientSubscriptions(String clientID) {
final Session session = sessions.get(clientID);
if (session == null) {
throw new IllegalStateException("Asking for subscriptions of not persisted client: " + clientID);
}
return session.subscriptions.values();
}
@Override
public Subscription reload(Subscription subcription) {
String clientID = subcription.getClientId();
if (!sessions.containsKey(clientID)) {
LOG.error("Can't find the session for client <{}>", clientID);
return null;
}
Map<Topic, Subscription> subscriptions = sessions.get(clientID).subscriptions;
if (subscriptions == null || subscriptions.isEmpty()) {
return null;
}
return subscriptions.get(subcription.getTopicFilter());
}
@Override
public StoredMessage inFlightAck(String clientID, int messageID) {
return getSession(clientID).outboundFlightMessages.remove(messageID);
}
@Override
public void inFlight(String clientID, int messageID, StoredMessage msg) {
Session session = sessions.get(clientID);
if (session == null) {
LOG.error("Can't find the session for client <{}>", clientID);
return;
}
session.outboundFlightMessages.put(messageID, msg);
}
/**
* Return the next valid packetIdentifier for the given client session.
*/
@Override
public int nextPacketID(String clientID) {
if (!sessions.containsKey(clientID)) {
LOG.error("Can't find the session for client <{}>", clientID);
return -1;
}
Map<Integer, StoredMessage> m = sessions.get(clientID).outboundFlightMessages;
int maxId = m.keySet().isEmpty() ? 0 : Collections.max(m.keySet());
int nextPacketId = (maxId + 1) % 0xFFFF;
m.put(nextPacketId, null);
return nextPacketId;
}
@Override
public BlockingQueue<StoredMessage> queue(String clientID) {
if (!sessions.containsKey(clientID)) {
LOG.error("Can't find the session for client <{}>", clientID);
return null;
}
return sessions.get(clientID).queue;
}
@Override
public void dropQueue(String clientID) {
final Session session = sessions.get(clientID);
session.queue.clear();
session.outboundFlightMessages.clear();
session.inboundFlightMessages.clear();
}
@Override
public void moveInFlightToSecondPhaseAckWaiting(String clientID, int messageID, StoredMessage msg) {
LOG.info("Moving msg inflight second phase store, clientID <{}> messageID {}", clientID, messageID);
Session session = sessions.get(clientID);
if (session == null) {
LOG.error("Can't find the session for client <{}>", clientID);
return;
}
session.secondPhaseStore.put(messageID, msg);
session.outboundFlightMessages.put(messageID, msg);
}
@Override
public StoredMessage completeReleasedPublish(String clientID, int messageID) {
LOG.info("Acknowledged message in second phase, clientID <{}> messageID {}", clientID, messageID);
return getSession(clientID).secondPhaseStore.remove(messageID);
}
@Override
public int getInflightMessagesNo(String clientID) {
Session session = sessions.get(clientID);
if (session == null) {
LOG.error("Can't find the session for client <{}>", clientID);
return 0;
}
return session.inboundFlightMessages.size() +
// countPubReleaseWaitingPubComplete(clientID) +
session.outboundFlightMessages.size();
}
@Override
public int countPubReleaseWaitingPubComplete(String clientID) {
if (!sessions.containsKey(clientID)) {
LOG.error("Can't find the session for client <{}>", clientID);
return 0;
}
return sessions.get(clientID).secondPhaseStore.size();
}
@Override
public void removeTemporaryQoS2(String clientID) {
LOG.debug("Session cleanup for client <{}>", clientID);
Session session = sessions.get(clientID);
if (session == null) {
LOG.error("Can't find the session for client <{}>", clientID);
return;
}
LOG.info("Removing stored messages with QoS 2. ClientId={}", clientID);
session.secondPhaseStore.clear();
// TODO this missing last step breaks the junit test
//sessions.remove(clientID);
}
@Override
public synchronized void trackSessionClose(LocalDateTime when, String clientID) {
this.sessionsClosingTimes.putIfAbsent(when, new HashSet<>());
this.sessionsClosingTimes.computeIfPresent(when, (key, oldSet) -> {
oldSet.add(clientID);
return oldSet;
});
}
@Override
public Set<String> sessionOlderThan(LocalDateTime queryPin) {
final Set<String> results = new HashSet<>();
LocalDateTime keyBefore = this.sessionsClosingTimes.lowerKey(queryPin);
while (keyBefore != null) {
results.addAll(this.sessionsClosingTimes.get(keyBefore));
keyBefore = this.sessionsClosingTimes.lowerKey(keyBefore);
}
return results;
}
}
@@ -1,58 +0,0 @@
/*
* Copyright (c) 2012-2018 The original author or authors
* ------------------------------------------------------
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* The Apache License v2.0 is available at
* http://www.opensource.org/licenses/apache2.0.php
*
* You may elect to redistribute this code under either of these licenses.
*/
package io.moquette.persistence;
import io.moquette.broker.config.IConfig;
import io.moquette.spi.IMessagesStore;
import io.moquette.spi.ISessionsStore;
import io.moquette.spi.IStore;
import java.util.concurrent.ScheduledExecutorService;
@Deprecated
public class MemoryStorageService implements IStore {
private MemorySessionStore m_sessionsStore;
private MemoryMessagesStore m_messagesStore;
// NB these params must be here "by contract" used in introspection instantiation used in
// ProtocolProcessorBootstrapper.instantiateConfiguredStore
public MemoryStorageService(IConfig props, ScheduledExecutorService scheduler) {
m_messagesStore = new MemoryMessagesStore();
m_sessionsStore = new MemorySessionStore();
m_messagesStore.initStore();
m_sessionsStore.initStore();
}
@Override
public IMessagesStore messagesStore() {
return m_messagesStore;
}
@Override
public ISessionsStore sessionsStore() {
return m_sessionsStore;
}
@Override
public void initStore() {
}
@Override
public void close() {
}
}
@@ -1,34 +0,0 @@
/*
* Copyright (c) 2012-2018 The original author or authors
* ------------------------------------------------------
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* The Apache License v2.0 is available at
* http://www.opensource.org/licenses/apache2.0.php
*
* You may elect to redistribute this code under either of these licenses.
*/
package io.moquette.persistence;
import java.io.Serializable;
/**
* This is a DTO used to persist minimal status (clean session and activation status) of a
* session.
*/
public class PersistentSession implements Serializable {
private static final long serialVersionUID = 5052054783220481854L;
public final boolean cleanSession;
public final String clientID;
public PersistentSession(String clientID, boolean cleanSession) {
this.clientID = clientID;
this.cleanSession = cleanSession;
}
}
@@ -1,24 +0,0 @@
/*
* Copyright (c) 2012-2018 The original author or authors
* ------------------------------------------------------
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* The Apache License v2.0 is available at
* http://www.opensource.org/licenses/apache2.0.php
*
* You may elect to redistribute this code under either of these licenses.
*/
package io.moquette.spi;
import io.moquette.broker.subscriptions.Topic;
public interface IMatchingCondition {
boolean match(Topic key);
}
@@ -1,111 +0,0 @@
/*
* Copyright (c) 2012-2018 The original author or authors
* ------------------------------------------------------
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* The Apache License v2.0 is available at
* http://www.opensource.org/licenses/apache2.0.php
*
* You may elect to redistribute this code under either of these licenses.
*/
package io.moquette.spi;
import io.moquette.broker.subscriptions.Topic;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.handler.codec.mqtt.MqttQoS;
import java.io.Serializable;
import java.util.Collection;
/**
* Defines the SPI to be implemented by a StorageService that handle persistence of messages
*/
public interface IMessagesStore {
class StoredMessage implements Serializable {
private static final long serialVersionUID = 1755296138639817304L;
private MqttQoS m_qos;
final byte[] m_payload;
final String m_topic;
private boolean m_retained;
private String m_clientID;
private MessageGUID m_guid;
public StoredMessage(byte[] message, MqttQoS qos, String topic) {
m_qos = qos;
m_payload = message;
m_topic = topic;
}
public void setQos(MqttQoS qos) {
this.m_qos = qos;
}
public MqttQoS getQos() {
return m_qos;
}
public String getTopic() {
return m_topic;
}
public void setGuid(MessageGUID guid) {
this.m_guid = guid;
}
public MessageGUID getGuid() {
return m_guid;
}
public String getClientID() {
return m_clientID;
}
public void setClientID(String m_clientID) {
this.m_clientID = m_clientID;
}
public ByteBuf getPayload() {
return Unpooled.copiedBuffer(m_payload);
}
public void setRetained(boolean retained) {
this.m_retained = retained;
}
public boolean isRetained() {
return m_retained;
}
@Override
public String toString() {
return "PublishEvent{clientID='" + m_clientID + '\'' + ", m_retain="
+ m_retained + ", m_qos=" + m_qos + ", m_topic='" + m_topic + '\'' + '}';
}
}
/**
* Used to initialize all persistent store structures
*/
void initStore();
/**
* Return a list of retained messages that satisfy the condition.
*
* @param condition
* the condition to match during the search.
* @return the collection of matching messages.
*/
Collection<StoredMessage> searchMatching(IMatchingCondition condition);
void cleanRetained(Topic topic);
void storeRetained(Topic topic, StoredMessage storedMessage);
}
@@ -1,131 +0,0 @@
/*
* Copyright (c) 2012-2018 The original author or authors
* ------------------------------------------------------
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* The Apache License v2.0 is available at
* http://www.opensource.org/licenses/apache2.0.php
*
* You may elect to redistribute this code under either of these licenses.
*/
package io.moquette.spi;
import io.moquette.persistence.PersistentSession;
import io.moquette.spi.IMessagesStore.StoredMessage;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.Queue;
import java.util.Set;
/**
* Store used to handle the persistence of the subscriptions tree.
*/
@Deprecated
public interface ISessionsStore {
void initStore();
ISubscriptionsStore subscriptionStore();
/**
* @param clientID
* the session client ID.
* @return true iff there is a session stored for the client
*/
boolean contains(String clientID);
void createNewDurableSession(String clientID);
void removeDurableSession(String clientId);
void updateCleanStatus(String clientID, boolean cleanSession);
PersistentSession loadSessionByKey(String clientID);
/**
* Returns all the sessions
*
* @return the collection of all stored client sessions.
*/
Collection<PersistentSession> listAllSessions();
StoredMessage inFlightAck(String clientID, int messageID);
/**
* Save the message msg with messageID, clientID as in flight
*
* @param clientID
* the client ID
* @param messageID
* the message ID
* @param msg
* the message to put in flight zone
*/
void inFlight(String clientID, int messageID, StoredMessage msg);
/**
* Return the next valid packetIdentifier for the given client session.
*
* @param clientID
* the clientID requesting next packet id.
* @return the next valid id.
*/
int nextPacketID(String clientID);
/**
* List the published retained messages for the session
*
* @param clientID
* the client ID owning the queue.
* @return the queue of messages.
*/
Queue<StoredMessage> queue(String clientID);
void dropQueue(String clientID);
void moveInFlightToSecondPhaseAckWaiting(String clientID, int messageID, StoredMessage msg);
/**
* @param clientID
* the client ID accessing the second phase.
* @param messageID
* the message ID that reached the second phase.
* @return the guid of message just acked.
*/
StoredMessage completeReleasedPublish(String clientID, int messageID);
/**
* Returns the number of inflight messages for the given client ID
*
* @param clientID target client.
* @return count of pending in flight publish messages.
*/
int getInflightMessagesNo(String clientID);
/**
* Returns the number of second-phase ACK pending messages for the given client ID
*
* @param clientID target client.
* @return count of pending in flight publish messages.
*/
int countPubReleaseWaitingPubComplete(String clientID);
void removeTemporaryQoS2(String clientID);
/**
* Tracks the closing time of a persistent session
* */
void trackSessionClose(LocalDateTime when, String clientID);
/**
* List the sessions ids closed before the pin date.
* */
Set<String> sessionOlderThan(LocalDateTime queryPin);
}
@@ -1,39 +0,0 @@
/*
* Copyright (c) 2012-2018 The original author or authors
* ------------------------------------------------------
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* The Apache License v2.0 is available at
* http://www.opensource.org/licenses/apache2.0.php
*
* You may elect to redistribute this code under either of these licenses.
*/
package io.moquette.spi;
@Deprecated
public interface IStore {
void initStore();
void close();
/**
* Factory method to instantiate the messages store.
*
* @return the create instance of IMessagesStore.
* */
IMessagesStore messagesStore();
/**
* Factory method to instantiate the session store.
*
* @return the create instance of ISessionsStore.
* */
ISessionsStore sessionsStore();
}
@@ -1,69 +0,0 @@
/*
* Copyright (c) 2012-2018 The original author or authors
* ------------------------------------------------------
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* The Apache License v2.0 is available at
* http://www.opensource.org/licenses/apache2.0.php
*
* You may elect to redistribute this code under either of these licenses.
*/
package io.moquette.spi;
import io.moquette.broker.subscriptions.Subscription;
import io.moquette.broker.subscriptions.Topic;
import java.util.Collection;
import java.util.List;
/**
* @deprecated look at ISubscriptionsRepository
*/
@Deprecated
public interface ISubscriptionsStore {
/**
* Add a new subscription to the session
*
* @param newSubscription the subscription to add.
*/
void addNewSubscription(Subscription newSubscription);
/**
* Removed a specific subscription
*
* @param topic the topic of the subscription.
* @param clientID the session client.
*/
void removeSubscription(Topic topic, String clientID);
/**
* Remove all the subscriptions of the session
*
* @param clientID the client ID
*/
void wipeSubscriptions(String clientID);
/**
* Return all topic filters to recreate the subscription tree.
*/
List<Subscription> listAllSubscriptions();
/**
* Load from storage all the subscriptions of the specified client.
*/
Collection<Subscription> listClientSubscriptions(String clientID);
/**
* @param subcription the subscription to reaload from storage.
* @return the subscription stored by clientID and topicFilter, if any else null;
*/
Subscription reload(Subscription subcription);
}
@@ -1,54 +0,0 @@
/*
* Copyright (c) 2012-2018 The original author or authors
* ------------------------------------------------------
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* The Apache License v2.0 is available at
* http://www.opensource.org/licenses/apache2.0.php
*
* You may elect to redistribute this code under either of these licenses.
*/
package io.moquette.spi;
import java.io.Serializable;
/**
* Value object for GUIDs of messages.
*/
public class MessageGUID implements Serializable {
private static final long serialVersionUID = 4315161987111542406L;
private final String guid;
public MessageGUID(String guid) {
this.guid = guid;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
MessageGUID that = (MessageGUID) o;
return guid != null ? guid.equals(that.guid) : that.guid == null;
}
@Override
public int hashCode() {
return guid != null ? guid.hashCode() : 0;
}
@Override
public String toString() {
return "MessageGUID{" + "guid='" + guid + '\'' + '}';
}
}