io.grpc.ServerTransportFilter源码实例Demo

类io.grpc.ServerTransportFilter源码实例Demo

下面列出了io.grpc.ServerTransportFilter 类实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: grpc-nebula-java   文件: ServerImpl.java
@Override
public Attributes transportReady(Attributes attributes) {
  handshakeTimeoutFuture.cancel(false);
  handshakeTimeoutFuture = null;

  for (ServerTransportFilter filter : transportFilters) {
    attributes = Preconditions.checkNotNull(filter.transportReady(attributes),
        "Filter %s returned null", filter);
  }
  this.attributes = attributes;
  return attributes;
}
 
源代码2 项目: grpc-nebula-java   文件: ServerImpl.java
@Override
public void transportTerminated() {
  if (handshakeTimeoutFuture != null) {
    handshakeTimeoutFuture.cancel(false);
    handshakeTimeoutFuture = null;
  }
  for (ServerTransportFilter filter : transportFilters) {
    filter.transportTerminated(attributes);
  }
  transportClosed(transport);
}
 
源代码3 项目: pinpoint   文件: ServerFactory.java
public Server build() {
    InetSocketAddress bindAddress = new InetSocketAddress(this.hostname, this.port);
    NettyServerBuilder serverBuilder = NettyServerBuilder.forAddress(bindAddress);
    serverBuilder.bossEventLoopGroup(bossEventLoopGroup);
    serverBuilder.workerEventLoopGroup(workerEventLoopGroup);

    setupInternal(serverBuilder);

    for (Object service : this.bindableServices) {

        if (service instanceof BindableService) {
            logger.info("Add BindableService={}, server={}", service, name);
            serverBuilder.addService((BindableService) service);
        } else if (service instanceof ServerServiceDefinition) {
            final ServerServiceDefinition definition = (ServerServiceDefinition) service;
            logger.info("Add ServerServiceDefinition={}, server={}", definition.getServiceDescriptor(), name);
            serverBuilder.addService(definition);
        }
    }
    for (ServerTransportFilter transportFilter : this.serverTransportFilters) {
        logger.info("Add transportFilter={}, server={}", transportFilter, name);
        serverBuilder.addTransportFilter(transportFilter);
    }
    for (ServerInterceptor serverInterceptor : this.serverInterceptors) {
        logger.info("Add intercept={}, server={}", serverInterceptor, name);
        serverBuilder.intercept(serverInterceptor);
    }

    serverBuilder.executor(serverExecutor);
    setupServerOption(serverBuilder);

    Server server = serverBuilder.build();
    return server;
}
 
源代码4 项目: pinpoint   文件: ChannelFactoryTest.java
private static void addFilter(ServerFactory serverFactory) {
    TransportMetadataFactory transportMetadataFactory = new TransportMetadataFactory(ChannelFactoryTest.class.getSimpleName());
    final ServerTransportFilter metadataTransportFilter = new MetadataServerTransportFilter(transportMetadataFactory);
    serverFactory.addTransportFilter(metadataTransportFilter);

    ServerInterceptor transportMetadataServerInterceptor = new TransportMetadataServerInterceptor();
    serverFactory.addInterceptor(transportMetadataServerInterceptor);

}
 
源代码5 项目: grpc-java   文件: ServerImpl.java
@Override
public Attributes transportReady(Attributes attributes) {
  handshakeTimeoutFuture.cancel(false);
  handshakeTimeoutFuture = null;

  for (ServerTransportFilter filter : transportFilters) {
    attributes = Preconditions.checkNotNull(filter.transportReady(attributes),
        "Filter %s returned null", filter);
  }
  this.attributes = attributes;
  return attributes;
}
 
源代码6 项目: grpc-java   文件: ServerImpl.java
@Override
public void transportTerminated() {
  if (handshakeTimeoutFuture != null) {
    handshakeTimeoutFuture.cancel(false);
    handshakeTimeoutFuture = null;
  }
  for (ServerTransportFilter filter : transportFilters) {
    filter.transportTerminated(attributes);
  }
  transportClosed(transport);
}
 
源代码7 项目: grpc-nebula-java   文件: AltsServerBuilder.java
/** {@inheritDoc} */
@Override
public AltsServerBuilder addTransportFilter(ServerTransportFilter filter) {
  delegate.addTransportFilter(filter);
  return this;
}
 
@Override
public final T addTransportFilter(ServerTransportFilter filter) {
  transportFilters.add(checkNotNull(filter, "filter"));
  return thisT();
}
 
源代码9 项目: dropwizard-grpc   文件: DropwizardServerBuilder.java
@Override
public DropwizardServerBuilder addTransportFilter(final ServerTransportFilter filter) {
    origin.addTransportFilter(filter);
    return this;
}
 
源代码10 项目: pinpoint   文件: GrpcReceiver.java
@Override
public void afterPropertiesSet() throws Exception {
    if (Boolean.FALSE == this.enable) {
        return;
    }

    Objects.requireNonNull(this.beanName, "beanName");
    Objects.requireNonNull(this.bindIp, "bindIp");
    Objects.requireNonNull(this.addressFilter, "addressFilter");
    Assert.isTrue(CollectionUtils.hasLength(this.serviceList), "serviceList must not be empty");
    Objects.requireNonNull(this.serverOption, "serverOption");

    this.serverFactory = new ServerFactory(beanName, this.bindIp, this.bindPort, this.executor, serverOption);
    ServerTransportFilter permissionServerTransportFilter = new PermissionServerTransportFilter(this.beanName, addressFilter);
    this.serverFactory.addTransportFilter(permissionServerTransportFilter);

    TransportMetadataFactory transportMetadataFactory = new TransportMetadataFactory(beanName);
    // Mandatory interceptor
    final ServerTransportFilter metadataTransportFilter = new MetadataServerTransportFilter(transportMetadataFactory);
    this.serverFactory.addTransportFilter(metadataTransportFilter);

    if (CollectionUtils.hasLength(transportFilterList)) {
        for (ServerTransportFilter transportFilter : transportFilterList) {
            this.serverFactory.addTransportFilter(transportFilter);
        }
    }

    // Mandatory interceptor
    ServerInterceptor transportMetadataServerInterceptor = new TransportMetadataServerInterceptor();
    this.serverFactory.addInterceptor(transportMetadataServerInterceptor);

    if (CollectionUtils.hasLength(serverInterceptorList)) {
        for (ServerInterceptor serverInterceptor : serverInterceptorList) {
            this.serverFactory.addInterceptor(serverInterceptor);
        }
    }

    // Add service
    addService();

    this.server = serverFactory.build();
    if (logger.isInfoEnabled()) {
        logger.info("Start {} server {}", this.beanName, this.server);
    }
    this.server.start();
}
 
源代码11 项目: pinpoint   文件: GrpcReceiver.java
public void setTransportFilterList(List<ServerTransportFilter> transportFilterList) {
    this.transportFilterList = transportFilterList;
}
 
源代码12 项目: pinpoint   文件: ServerFactory.java
public void addTransportFilter(ServerTransportFilter serverTransportFilter) {
    Assert.requireNonNull(serverTransportFilter, "serverTransportFilter");
    this.serverTransportFilters.add(serverTransportFilter);
}
 
源代码13 项目: grpc-java   文件: XdsServerBuilder.java
@Override
public XdsServerBuilder addTransportFilter(ServerTransportFilter filter) {
  delegate.addTransportFilter(filter);
  return this;
}
 
源代码14 项目: grpc-java   文件: AltsServerBuilder.java
/** {@inheritDoc} */
@Override
public AltsServerBuilder addTransportFilter(ServerTransportFilter filter) {
  delegate.addTransportFilter(filter);
  return this;
}
 
源代码15 项目: grpc-java   文件: AbstractServerImplBuilder.java
@Override
public final T addTransportFilter(ServerTransportFilter filter) {
  transportFilters.add(checkNotNull(filter, "filter"));
  return thisT();
}
 
源代码评论
动弹
沙发等你来抢
 类所在包
 类方法
 同包方法