当前位置: 首页>>代码示例>>Java>>正文


Java ServerWebSocket.textHandlerID方法代码示例

本文整理汇总了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());
        });
    }
}
 
开发者ID:amoAHCP,项目名称:vert.x-microservice,代码行数:18,代码来源:WSLocalHandler.java

示例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);

    }))
    );
}
 
开发者ID:amoAHCP,项目名称:vert.x-microservice,代码行数:11,代码来源:WSClusterHandler.java

示例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);
    }
}
 
开发者ID:amoAHCP,项目名称:vert.x-microservice,代码行数:15,代码来源:WSClusterHandler.java

示例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);


}
 
开发者ID:amoAHCP,项目名称:vert.x-microservice,代码行数:14,代码来源:WSLocalHandler.java


注:本文中的io.vertx.core.http.ServerWebSocket.textHandlerID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。