个人博客:https://www.zhoujunwen.com
能力说明:
精通JVM运行机制,包括类生命、内存模型、垃圾回收及JVM常见参数;能够熟练使用Runnable接口创建线程和使用ExecutorService并发执行任务、识别潜在的死锁线程问题;能够使用Synchronized关键字和atomic包控制线程的执行顺序,使用并行Fork/Join框架;能过开发使用原始版本函数式接口的代码。
阿里云技能认证
详细说明一般情况下,我们会单独生成一个ssh-key公钥用于备份数据,而不是和其他公钥混合使用,避免因为因为某些操作不安全,造成代码丢失。当然你也可以选择一个其他账户操作也是可以的,但如果选择其他账户了,也就没有这篇文章的存在了。还是回到多个私钥的问题上,默认情况下,RSA算法的 ssh 私钥文件名为 id_rsa,我们可以通过ssh-keygen生成 ssh key 的时候可以指定其名称。 当有多个SSH KEY存在的时候,如何指定某个ssh读取某个私钥呢?本文就提供一个解决方案。
本文分析阻塞、非阻塞、同步和异步概念上的区别以及各种IO模型的操作流程,同时分析BIO、 NIO、 AIO的通信机制,并通过demo深入比较三种IO的优缺点。输入输出(IO)是指计算机同任何外部设备之间的数据传递。常见的输入输出设备有文件、键盘、打印机、屏幕等。数据可以按记录(或称数据块)的方式传递,也可以 流的方式传递 。所谓记录,是指有着内部结构的数据块。记录内部除了有需要处理的实际数据之外,还可能包含附加信息,这些附加信息通常是对本记录数据的描述。
AOP(Aspect Orient Programming),作为面向对象编程的一种补充,广泛应用于处理一些具有横切性质的系统级服务,如日志收集、事务管理、安全检查、缓存、对象池管理等。AOP实现的关键就在于AOP框架自动创建的AOP代理,AOP代理则可分为静态代理和动态代理两大类,其中静态代理是指使用AOP框架提供的命令进行编译,从而在编译阶段就可生成 AOP 代理类,因此也称为编译时增强;而动态代理则在运行时借助于`JDK动态代理`、`CGLIB`等在内存中“临时”生成AOP动态代理类,因此也被称为运行时增强。
管道就像水管,有流入才会有流出,水管数水流的通道,管道是数据的通道。管道分为无名管道和有名管道。 无名管道:常用的|就是管道,只不过是无名的,可以直接作为两个进程的数据通道,比如:cat file.txt | grep test 有名管道:mkfilo 可以创建一个管道文件,比如:mkfiflo testfifo 管道有一个特点,如果管道中没有数据,那么取管道数据的操作就会阻塞,直到管道内进入数据,然后读出后才会终止这一操作,同理,写入管道的操作如果没有读取操作,这一个动作也会阻塞。
当系统升级到OSX 10.10.3的时候,用brew更新软件安装包,出现了curl抛出的错误。 ==> Upgrading boost ==> Downloading https://homebrew.
使用maven包管理器开发java web时,由于国内网速太慢,或者墙的缘故,创建project后,总是要等待很长时间加载所需jar包。这对于开发者而言,是一种痛苦的等待,对于企业,也是一种损失。
在ubuntu中,使用svn控制代码版本(其实个人喜欢GIT的,但是team使用的svn),出现冲突问题,做程序员就得上刀山下火海,不怕问题来找你,所以,本着职业的精神,好吧,解决吧。 第一次使用markdown写博客,写的时间有点久,语法不熟悉,看着语法手册一步一步创建的,大家凑合着看吧。
JUnit4的官网(junit.org)有详细定义:JUnit is a simple framework to write repeatable tests.It is an instance of the xUnit architecture for unit testing framework.意思是:JUnit是一个用于编写可复用测试集的简单框架,它是xUnit的子集。
Google Chrome 下载文件的时候有个小 bug,文件名中不能包含逗号(,),而且字符编码需要改为 ISO 8859-1。
可以用下面的方式尝试一下:
String fileName = URLEncoder.encode(mixedFileNameArr[1],"UTF-8");
new String(fileName.getBytes("UTF-8"), "ISO8859-1");
百灵,凌云
家里冷,不敢吹空调,只能在脚下放一个暖风机。
首先在 Mysql8 中,默认“LOAD DATA LOCAL INFILE”是OFF,即关闭的一起。需要在服务端开启:
SET @@GLOBAL.local_infile=1;
在客户端命令行中使用,正如你所说,需要添加--local-infile=1
参数,但是在JDBC中,貌似没有这个限制。只是需要使用超级用户权限。同时,你需要注意,你的文件必须是MySQL服务系统所在机器中的文件,而不是本地客户机器中中文件(或者说并不是你应用部署系统的文件,除非你的应用和MySQL在同一个机器上)。
Connection con = DriverManager.getConnection("jdbc:mysql://localhost/foobar", "root", "password");
Statement stmt = con.createStatement();
String sql =
"load data infile 'c:/temp/some_data.txt' \n" +
" replace \n" +
" into table prd \n" +
" columns terminated by '\\t' \n" +
" ignore 1 lines";
stmt.execute(sql);
kafka的目录,kfka的端口,zk的端口,zk的目录分别配置就可以了呀。
The transient
keyword in Java is used to indicate that a field should not be part of the serialization (which means saved, like to a file) process.
From the Java Language Specification, Java SE 7 Edition, Section 8.3.1.3. transient Fields:
Variables may be marked transient to indicate that they are not part of the persistent state of an object.
For example, you may have fields that are derived from other fields, and should only be done so programmatically, rather than having the state be persisted via serialization.
Here's a GalleryImage
class which contains an image and a thumbnail derived from the image:
class GalleryImage implements Serializable
{
private Image image;
private transient Image thumbnailImage;
private void generateThumbnail()
{
// Generate thumbnail.
}
private void readObject(ObjectInputStream inputStream)
throws IOException, ClassNotFoundException
{
inputStream.defaultReadObject();
generateThumbnail();
}
}
In this example, the thumbnailImage
is a thumbnail image that is generated by invoking the generateThumbnail
method.
The thumbnailImage
field is marked as transient
, so only the original image
is serialized rather than persisting both the original image and the thumbnail image. This means that less storage would be needed to save the serialized object. (Of course, this may or may not be desirable depending on the requirements of the system -- this is just an example.)
At the time of deserialization, the readObject method is called to perform any operations necessary to restore the state of the object back to the state at which the serialization occurred. Here, the thumbnail needs to be generated, so the readObject
method is overridden so that the thumbnail will be generated by calling the generateThumbnail
method.
For additional information, the Discover the secrets of the Java Serialization API article (which was originally available on the Sun Developer Network) has a section which discusses the use of and presents a scenario where the transient
keyword is used to prevent serialization of certain fields.
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.1.4</version>
</dependency>
不知道为什么,显示不了xml标签,我截图如下:
localhost也叫local ,正确的解释是:
本地服务器
127.0.0.1在windows等系统的正确解释是:本机地址(本机服务器)
127.0.0.1 localhost
localhot(local)是不经网卡传输,它不受网络防火墙和网卡相关的的限制。 127.0.0.1 是通过网卡传输,依赖网卡,并受到网络防火墙和网卡相关的限制。
一般设置程序时本地服务用localhost是最好的,localhost不会解析成ip,也不会占用网卡、网络资源。
有时候用localhost可以,但用127.0.0.1就不可以的情况就是在于此。猜想localhost访问时,系统带的本机当前用户的权限去访问,而用ip的时候,等于本机是通过网络再去访问本机,可能涉及到网络用户的权限。
这里有具体的排查思路你可以参考一下:https://help.aliyun.com/knowledge_detail/84083.html?spm=5176.13394938.0.0.6ff04d57onSrct
感觉这个和你现在遇到的情况很相似。
2003-不能连接到MySQL服务器上的’119.23.168.137’(100060"未知错误")
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;
通过修改表来实现远程:
mysql -u root -pvmwaremysql>use mysql;
mysql>update user set host = '%' where user = 'root';
mysql>select host, user from user;
不管是BIO还是NIO,其实都是通过轮训的方式来实现socket服务的。下面几个demo或许有助于你:
public class BIODemo {
public static void main(String[] args) throws IOException {
ServerSocket serverSocket = new ServerSocket();
serverSocket.bind(new InetSocketAddress("0.0.0.0", 8888), 50);
Socket socket;
while ((socket = serverSocket.accept()) != null) {
InputStream is = socket.getInputStream();
byte[] data = new byte[1024];
is.read(data);
System.out.println(new String(data, UTF_8));
OutputStream out = socket.getOutputStream();
out.write(data);
socket.close();
}
}
}
public class NIODemo {
public static void main(String[] args) throws IOException {
ServerSocketChannel serverSocketChannel = ServerSocketChannel.open();
serverSocketChannel.bind(new InetSocketAddress("0.0.0.0", 8888), 50);
serverSocketChannel.configureBlocking(false);
Selector selector = Selector.open();
serverSocketChannel.register(selector, SelectionKey.OP_ACCEPT);
while (true) {
selector.select();
Set<SelectionKey> selectionKeys = selector.selectedKeys();
Iterator<SelectionKey> iterator = selectionKeys.iterator();
while (iterator.hasNext()) {
SelectionKey key = iterator.next();
if (!key.isValid()) {
continue;
}
if (key.isAcceptable()) {
ServerSocketChannel serverChannel = (ServerSocketChannel) key.channel();
SocketChannel clientChannel = serverChannel.accept();
clientChannel.configureBlocking(false);
clientChannel.register(selector, SelectionKey.OP_READ);
} else if (key.isReadable()) {
ByteBuffer buffer = ByteBuffer.wrap(new byte[1024]);
SocketChannel clientChannel = (SocketChannel) key.channel();
int read = clientChannel.read(buffer);
if (read == -1) {
key.cancel();
clientChannel.close();
} else {
buffer.flip();
clientChannel.write(buffer);
}
}
}
iterator.remove();
}
}
}
如果你需要更详细的更深入的了解,可以参考我的这篇文章 JAVA中BIO、NIO、AIO的分析理解 https://developer.aliyun.com/article/726698?spm=a2c6h.13148508.0.0.1d844f0eaWNdWj
很棒!!!
不支持的操作异常,根据提示,当前某个类不允许子类覆盖。检查你的业务代码,是不是集成了final的类,或者有哪些集合是不可修改的。
没有其他错误信息,也看不出具体的问题。
从两个方面来说吧。第一个是编码安全,第二个是网络设备安全。
#
做参数的获取http://app.ym.163.com/ym/reg/view/index 这个163域名企业邮箱注册地址,根据提示一步一步操作。需要在你的域名解析服务中增加一条MX
的配置,值为mx.ym.163.com
。
http://app.ym.163.com/ym/help/help-hmail.html#3.6 这是域名验证的方法。
特殊符号&通过urlencode编码试试看。 &
编码后为 %26
。
上面各位都已经回答的很好了,再补充一个人,国内go语言方面的大神:郝林。
郝林是 GoHackers 技术社群发起人,畅销榜书籍《Go并发编程实战》的作者,前轻松筹大数据负责人。13年软件开发从业经验,做过银行、电信软件和互联网社交产品。从2012年底开始关注Go语言,对Go语言和 Docker 技术都情有独钟,是Go语言的忠实拥护者。
不过,郝林一直活跃在 GoHackers 微信群和知识星球,如果你需要进入 GoHackers 技术群,你可以加我,我征询一下大佬,看能不能把你加进去,微群是免费的,知识星球可能是收费的,我没太关注过。