1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 17:49:38 +02:00

SMACK-129 - Added a property in smack-config file for the default packet collector size and set it much lower than the previous default. Also made the max size for packet collectors configurable from the constructor.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/branches/smack_3_2_0@12509 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
rcollier 2011-06-18 18:18:03 +00:00
parent 0c88e19d3b
commit da5434505b
5 changed files with 97 additions and 15 deletions

View file

@ -51,7 +51,8 @@ public final class SmackConfiguration {
private static Vector<String> defaultMechs = new Vector<String>();
private static boolean localSocks5ProxyEnabled = true;
private static int localSocks5ProxyPort = 7777;
private static int localSocks5ProxyPort = 7778;
private static int packetCollectorSize = 5000;
private SmackConfiguration() {
}
@ -85,20 +86,22 @@ public final class SmackConfiguration {
parseClassToLoad(parser);
}
else if (parser.getName().equals("packetReplyTimeout")) {
packetReplyTimeout =
parseIntProperty(parser, packetReplyTimeout);
packetReplyTimeout = parseIntProperty(parser, packetReplyTimeout);
}
else if (parser.getName().equals("keepAliveInterval")) {
keepAliveInterval = parseIntProperty(parser, keepAliveInterval);
}
else if (parser.getName().equals("mechName")) {
defaultMechs.add(parser.nextText());
} else if (parser.getName().equals("localSocks5ProxyEnabled")) {
localSocks5ProxyEnabled = Boolean.parseBoolean(parser
.nextText());
} else if (parser.getName().equals("localSocks5ProxyPort")) {
localSocks5ProxyPort = parseIntProperty(parser,
localSocks5ProxyPort);
}
else if (parser.getName().equals("localSocks5ProxyEnabled")) {
localSocks5ProxyEnabled = Boolean.parseBoolean(parser.nextText());
}
else if (parser.getName().equals("localSocks5ProxyPort")) {
localSocks5ProxyPort = parseIntProperty(parser, localSocks5ProxyPort);
}
else if (parser.getName().equals("packetCollectorSize")) {
packetCollectorSize = parseIntProperty(parser, packetCollectorSize);
}
}
eventType = parser.next();
@ -184,6 +187,26 @@ public final class SmackConfiguration {
keepAliveInterval = interval;
}
/**
* Gets the default max size of a packet collector before it will delete
* the older packets.
*
* @return The number of packets to queue before deleting older packets.
*/
public static int getPacketCollectorSize() {
return packetCollectorSize;
}
/**
* Sets the default max size of a packet collector before it will delete
* the older packets.
*
* @param The number of packets to queue before deleting older packets.
*/
public static void setPacketCollectorSize(int collectorSize) {
packetCollectorSize = collectorSize;
}
/**
* Add a SASL mechanism to the list to be used.
*