Commit 6a8d75d4 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Made it clusterable.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@8145 b35dd754-fafc-0310-a699-88a17e54d16e
parent 7cc9914e
......@@ -10,8 +10,9 @@ package org.xmpp.packet;
import org.jivesoftware.stringprep.IDNA;
import org.jivesoftware.stringprep.Stringprep;
import org.jivesoftware.stringprep.StringprepException;
import org.jivesoftware.util.cache.ExternalizableUtil;
import java.io.Serializable;
import java.io.*;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
......@@ -36,7 +37,7 @@ import java.util.Map;
*
* @author Matt Tucker
*/
public class JID implements Comparable, Serializable {
public class JID implements Comparable, Serializable, Externalizable {
// Stringprep operations are very expensive. Therefore, we cache node, domain and
// resource values that have already had stringprep applied so that we can check
......@@ -204,6 +205,12 @@ public class JID implements Comparable, Serializable {
return answer;
}
/**
* Constructor added for Externalizable. Do not use this constructor.
*/
public JID() {
}
/**
* Constructs a JID from it's String representation.
*
......@@ -543,4 +550,19 @@ public class JID implements Comparable, Serializable {
return size() > maxSize;
}
}
public void writeExternal(ObjectOutput out) throws IOException {
ExternalizableUtil.getInstance().writeSafeUTF(out, toString());
}
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
String jid = ExternalizableUtil.getInstance().readSafeUTF(in);
String[] parts = getParts(jid);
this.node = parts[0];
this.domain = parts[1];
this.resource = parts[2];
// Cache the bare and full JID String representation
updateCache();
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment