Skip to content

Instantly share code, notes, and snippets.

/*
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
@CoderYellow
CoderYellow / ts
Last active February 3, 2024 14:36
RpcImpl
import * as grpc from '@grpc/grpc-js';
import { Observable } from 'rxjs';
import { first, toArray } from 'rxjs/operators';
class GrpcRpcImpl implements Rpc {
private client: grpc.Client;
constructor(serviceAddress: string) {
this.client = new grpc.Client(serviceAddress, grpc.credentials.createInsecure());
}
@CoderYellow
CoderYellow / OkHttpCall.java
Last active April 25, 2019 10:47
okhttp 错误的处理 error handle
/*
* Copyright (C) 2015 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software