自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(15)
  • 资源 (3)
  • 收藏
  • 关注

原创 Mac 修改环境变量

操作顺序:bash打开 ~/.bash_profile文件:sudo vi ~/.bash_profile修改.bash_profile文件。添加环境变量:export {变量}={变量值}保存,重启bash生效Mac 环境变量加载顺序Mac系统的环境变量,加载顺序为:/etc/profile/etc/paths~/.bash_profile~/.bash_login~/.profile~/.bashrc/etc/profile和/etc/paths是系统

2021-04-25 12:00:49 684

原创 C#中的delegate和event作用及区别

Delegatedelegate是C#中很重要的语法。委托是一种引用类型,表示对具有特定参数列表和返回类型的方法的引用。声明了delegate的属性都会继承自Delegate类。使用单播委托类似C和C++的函数指针,但委托是面向对象和类型安全的(封装成delegate对象)。使用多播委托类似观察者模式(发布/订阅模式)。实际上源码使用得最多的也是多播模式。但委托的通知实现方法绑定是基于函数签名(duck type)而非接口。相比传统的观察者模式实现更加灵活,有点像guava的Eventbus,而且

2020-07-25 13:27:30 1577

原创 git 每次拉取都要输入密码

git 每次拉取代码都要输入密码。可以配置credential.helper保存git账号密码。存储密码mac:控制台操作#确认mac已经安装 credential-osxkeychaingit credential-osxkeychain#output:usage: git credential-osxkeychain <get|store|erase>git config --system credential.helper osxkeychainwindows:git

2020-07-17 17:16:27 1535

原创 java ServiceLoader和spi机制

spispi(Service Provider Interface)是一种服务发现机制。可以实现这样一种机制。由框架定义好接口,其他拓展包或者程序实现这个了这个接口后,可以通过在ClassPath路径下的META-INF/services文件夹查找文件,自动加载文件里所定义的类。例子新建一个模块,定义接口:HelloServicepublic interface HelloService { String sayHello();}新建另外一个模块,实现接口:ChineseHell

2020-06-03 22:33:51 229

原创 java ClassLoader源码剖析和双亲委派模型实现

ClassLoader是做什么的?一个类的生命周期取决于它Class对象的生命周期,经历加载、连接、初始化、使用、和卸载五个阶段。ClassLoader负责将.class文件中的二进制数据加载到内存中,放到jvm的方法区中。什么是双亲委派模型一个类加载器收到了类加载请求,它并不会自己先去加载,而是把这个请求委托给父类的加载器去执行,如果父类加载器还存在其父类加载器,则进一步向上委托,依次递归,请求最终将到达顶层的启动类加载器,如果父类加载器可以完成类加载任务,就成功返回,倘若父类加载器无法完成此加载

2020-05-13 22:52:09 220

原创 idea 查看sun包下源码

前言最近想研究下jdk的ClassLoader。发现jdk 1.8下没有包含sun.*的源码。所以在idea中打开sun.*下的类,都只能查看通过反编译得到的代码,由于缺少相应的注释,且某些变量变成了val1,val2等,可读性变得很差,给源码的学习效率造成影响。我们可以通过引入外部的源码文件依赖,使得idea在打开sun.*包下的类时,可以找到并打开对应的源码下载OpenJDK源码到本地从github上下载OpenJDK源码:git clone https://github.com/openjd

2020-05-10 20:57:32 1677

原创 github/git 修改已提交记录的作者和邮箱

前言最近在github上发现自己的代码仓库有两个contributor,但实际上仓库只有我一个人管理。原来我本地的git设置了作者和邮箱,跟github上的作者不相同。虽然本地提交的时候使用同一个github帐号,但还是会认为是不通过的contributor贡献的代码。一、修改git配置作者和邮箱只有github和本地的作者保持一致就可以了。1.修改github的配置,在settings...

2020-03-16 17:19:15 4841 6

原创 在netty项目中使用protobuf编解码(二):netty项目中使用protobuf编解码

一、配置protobuf环境支持idea安装protobuf插件preference -> plugins ->搜索protobuf support安装环境安装protoc编译工具1.下载protoc:https://github.com/protocolbuffers/protobuf/releases2.选择合适操作系统的zip包,解压后protoc就是可执行程序。...

2020-03-08 20:44:36 434

原创 在netty项目中使用protobuf编解码(一):protobuf与其他主流编解码方案的对比

为什么选择protobuf目前java常用的编解码方案有:xmljava序列化xmljsonmsgPackthriftprotobuf选择编解码方案的主要维度:1.编码后占用空间:xml,java序列化 out!2.编解码速度,占用内存:xml,java序列化 out!out!3.多种编程语言支持:java序列化 out!out!out!xml,json best!...

2020-03-08 15:50:58 392

原创 proto3解决使用JsonFormat转化含有Any类型的对象时报错InvalidProtocolBufferException: Cannot find type for url

使用protobuf的过程中有时需要将proto对象转成json对象方便阅读。谷歌提供了JsonFormat类提供json和proto之前的转化操作。如果proto对象含有Any类型的时候。转化会报错:om.google.protobuf.InvalidProtocolBufferException: Cannot find type for url: type.googleapis.com/...

2020-03-07 17:07:21 3268

原创 protobuf 笔记

文档proto语法java apidemo代码proto3首行加上syntax = “proto3”;Assigning Field Numbersgoogle保留字段 19000 through 19999也可以用reserve设置保留字段(去掉之前的参数,保留不用,怕用旧版本的proto文件会出问题)Specifying Field Rulessingular:.? 0次...

2020-03-07 12:25:19 351

原创 postman请求https接口配置

前言postman是个简单好用的接口测试工具。项目的https接口需要做双向认证。要使用postman调试的话还需要做一些额外的配置。步骤打开菜单-setting - general - SSL certification verification 关闭2.certificates tab - client certificates - add certificatehost 填需...

2020-03-05 21:40:12 3543

原创 Java for(;;)和while(true)的区别

前言今天看netty的源码,发现netty写无限循环喜欢用for(; ; ),例如io.netty.channel.nio.NioEventLoop里run方法的实现: protected void run() { for (;;) { try { try { switch (...

2020-02-25 22:11:17 502

原创 快速搭建 netty服务器

前言使用idea快速搭建基于maven的netty服务器项目1.新建空白maven项目file-new-project选择maven空白项目,输入groupid和artifactid,一路点next2.引入netty maven 依赖pom.xml 文件加入netty-all 依赖io.nettynetty-all4.1.42.Final</dependenci...

2020-02-24 12:58:38 1144

原创 Java nio套接字编程

前言最近在学习java网络编程。用原生jdk接口做套接字编程开发,感觉劳心且费神。java项目套接字编程,首选还是使用netty。jdk的接口仅做入门和掌握netty架构设计之用。基本概念首先说几个基本概念。与去饭店吃饭做类比。简单说下java bio,nio和aio三种io模式的区别。1.bio,nio ,aiobio等待数据就序,再对数据进行操作 ->去饭堂排队打饭,等待饭菜...

2020-02-23 22:35:06 170

asmtools-7.0.zip

在OpenJDK里有一个AsmTools项目,用来生成正确的或者不正确的java .class文件,主要用来测试和验证。使用AsmTools能方便修改.class文件。官网https://wiki.openjdk.java.net/display/CodeTools/asmtools。由于墙的原因官网编译包无法下载。我从源码编译后生成的asmtools-7.0.zip上传方便使用。

2020-08-31

kafkatool_64bit_v1.0.3.exe.zip

To download the Kafka UI Tool for your operating system, use the links below. All versions of Kafka Tool come with a bundled JRE with the exception of the Linux version. For Linux, you must have Java 8 installed on your operating system before using Kafka Tool. After downloading, refer to the Documentation to configure Kafka Tool correctly. View change history to see recent updates to Kafka Tool. Before clicking on the download button below, carefully read the terms of the license agreement. By clicking and downloading the software you are consenting to be bound by the license agreement. Do not click on download unless you agree to all terms of the license agreement. Kafka Tool is free for personal use only. Kafka Tool supports Apache Kafka ® version 0.8.1 and above.

2020-08-07

kafkatool_64bit.exe.zip

Kafka Tool is a GUI application for managing and using Apache Kafka ® clusters. It provides an intuitive UI that allows one to quickly view objects within a Kafka cluster as well as the messages stored in the topics of the cluster. It contains features geared towards both developers and administrators. Some of the key features include Quickly view all your Kafka clusters, including their brokers, topics and consumers View contents of messages in your partitions and add new messages View offsets of the consumers, including Apache Storm Kafka spout consumers Show JSON and XML messages in a pretty-printed format Add and drop topics plus other management features Save individual messages from your partitions to local hard drive Write your own plugins that allow you to view custom data formats Kafka Tool runs on Windows, Linux and Mac OS Kafka Tool is free for personal use only. Any non-personal use, including commercial, educational and non-profit work is not permitted without purchasing a license. Non-personal use is allowed for evaluation purposes for 30 days following the download of Kafka Tool, after which you must purchase a valid license or remove the software.

2020-08-06

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除