本文整理汇总了Java中org.jivesoftware.smackx.disco.ServiceDiscoveryManager.removeFeature方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceDiscoveryManager.removeFeature方法的具体用法?Java ServiceDiscoveryManager.removeFeature怎么用?Java ServiceDiscoveryManager.removeFeature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.smackx.disco.ServiceDiscoveryManager
的用法示例。
在下文中一共展示了ServiceDiscoveryManager.removeFeature方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setServiceEnabled
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入方法依赖的package包/类
/**
* Enable the Jabber services related to file transfer on the particular
* connection.
*
* @param connection The connection on which to enable or disable the services.
* @param isEnabled True to enable, false to disable.
*/
private static void setServiceEnabled(final XMPPConnection connection,
final boolean isEnabled) {
ServiceDiscoveryManager manager = ServiceDiscoveryManager
.getInstanceFor(connection);
List<String> namespaces = new ArrayList<String>();
namespaces.addAll(Arrays.asList(NAMESPACE));
namespaces.add(DataPacketExtension.NAMESPACE);
if (!IBB_ONLY) {
namespaces.add(Bytestream.NAMESPACE);
}
for (String namespace : namespaces) {
if (isEnabled) {
manager.addFeature(namespace);
} else {
manager.removeFeature(namespace);
}
}
}
示例2: disable
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入方法依赖的package包/类
public synchronized void disable() {
if (!enabled)
return;
ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection());
sdm.removeFeature(Time.NAMESPACE);
enabled = false;
}
示例3: disableService
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; //导入方法依赖的package包/类
/**
* Disables the SOCKS5 Bytestream manager by removing the SOCKS5 Bytestream feature from the
* service discovery, disabling the listener for SOCKS5 Bytestream initiation requests and
* resetting its internal state, which includes removing this instance from the managers map.
* <p>
* To re-enable the SOCKS5 Bytestream feature invoke {@link #getBytestreamManager(XMPPConnection)}.
* Using the file transfer API will automatically re-enable the SOCKS5 Bytestream feature.
*/
public synchronized void disableService() {
XMPPConnection connection = connection();
// remove initiation packet listener
connection.unregisterIQRequestHandler(initiationListener);
// shutdown threads
this.initiationListener.shutdown();
// clear listeners
this.allRequestListeners.clear();
this.userListeners.clear();
// reset internal state
this.lastWorkingProxy = null;
this.proxyBlacklist.clear();
this.ignoredBytestreamRequests.clear();
// remove manager from static managers map
managers.remove(connection);
// shutdown local SOCKS5 proxy if there are no more managers for other connections
if (managers.size() == 0) {
Socks5Proxy.getSocks5Proxy().stop();
}
// remove feature from service discovery
ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(connection);
// check if service discovery is not already disposed by connection shutdown
if (serviceDiscoveryManager != null) {
serviceDiscoveryManager.removeFeature(Bytestream.NAMESPACE);
}
}