本文整理汇总了Java中io.vertx.core.http.ServerWebSocket.textHandlerID方法的典型用法代码示例。如果您正苦于以下问题:Java ServerWebSocket.textHandlerID方法的具体用法?Java ServerWebSocket.textHandlerID怎么用?Java ServerWebSocket.textHandlerID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.vertx.core.http.ServerWebSocket
的用法示例。
在下文中一共展示了ServerWebSocket.textHandlerID方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findRouteSocketInRegistryAndRemove
import io.vertx.core.http.ServerWebSocket; //导入方法依赖的package包/类
@Override
public void findRouteSocketInRegistryAndRemove(ServerWebSocket serverSocket) {
final SharedData sharedData = this.vertx.sharedData();
final String binaryHandlerID = serverSocket.binaryHandlerID();
final String textHandlerID = serverSocket.textHandlerID();
final LocalMap<String, byte[]> wsRegistry = sharedData.getLocalMap(WS_REGISTRY);
final WSEndpointHolder holder = getWSEndpointHolderFromSharedData(wsRegistry);
if (holder != null) {
final List<WSEndpoint> all = holder.getAll();
final Optional<WSEndpoint> first = all.parallelStream().filter(e -> e.getBinaryHandlerId().equals(binaryHandlerID) && e.getTextHandlerId().equals(textHandlerID)).findFirst();
first.ifPresent(endpoint -> {
holder.remove(endpoint);
wsRegistry.replace(WS_ENDPOINT_HOLDER, serialize(holder));
log("OK REMOVE: " + serverSocket.binaryHandlerID());
});
}
}
示例2: findRouteSocketInRegistryAndRemove
import io.vertx.core.http.ServerWebSocket; //导入方法依赖的package包/类
@Override
public void findRouteSocketInRegistryAndRemove(ServerWebSocket serverSocket) {
final String binaryHandlerID = serverSocket.binaryHandlerID();
final String textHandlerID = serverSocket.textHandlerID();
this.vertx.sharedData().<String, WSEndpointHolder>getClusterWideMap(WS_REGISTRY, onSuccess(registryMap -> registryMap.get(WS_ENDPOINT_HOLDER, wsEndpointHolder -> {
retrieveEndpointHolderAndRemove(serverSocket, binaryHandlerID, textHandlerID, registryMap, wsEndpointHolder);
}))
);
}
示例3: updateWSEndpointHolder
import io.vertx.core.http.ServerWebSocket; //导入方法依赖的package包/类
private void updateWSEndpointHolder(ServerWebSocket serverSocket, AsyncMap<String, WSEndpointHolder> registryMap, AsyncResult<WSEndpointHolder> wsEndpointHolder) {
log("add entry: " + Thread.currentThread());
final String binaryHandlerId = serverSocket.binaryHandlerID();
final String textHandlerId = serverSocket.textHandlerID();
final String path = serverSocket.path();
final EventBus eventBus = vertx.eventBus();
final WSEndpoint endpoint = new WSEndpoint(binaryHandlerId, textHandlerId, path);
final WSEndpointHolder result = wsEndpointHolder.result();
if (result != null) {
addDefinitionToRegistry(serverSocket, eventBus, path, endpoint, registryMap, result);
} else {
createEntryAndAddDefinition(serverSocket, eventBus, path, endpoint, registryMap);
}
}
示例4: createEndpointDefinitionAndRegister
import io.vertx.core.http.ServerWebSocket; //导入方法依赖的package包/类
private void createEndpointDefinitionAndRegister(ServerWebSocket serverSocket) {
final SharedData sharedData = this.vertx.sharedData();
final LocalMap<String, byte[]> wsRegistry = sharedData.getLocalMap(WS_REGISTRY);
final WSEndpointHolder holder = getWSEndpointHolderFromSharedData(wsRegistry);
final String path = serverSocket.path();
final WSEndpoint endpoint = new WSEndpoint(serverSocket.binaryHandlerID(), serverSocket.textHandlerID(), path);
replaceOrAddEndpoint(wsRegistry, holder, endpoint);
sendToWSService(serverSocket, path, endpoint);
}