posts - 88, comments - 3, trackbacks - 0, articles - 0
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

介绍centos7如何安装3.0以上的新版本mongodb
https://docs.mongodb.org/manual/tutorial/install-mongodb-on-red-hat/

posted @ 2016-03-23 10:14 Milo的海域 阅读(180) | 评论 (0)编辑 收藏

1. 默认的3个classloader: BootstrapClassloader (Native实现), ExtClassloader, AppClassloader (Java实现)
2. 3个加载器并不是真正的父子继承关系,而是逻辑上的,JVM启动先创建ExtClassloader instance,然后构造AppClassloader的时候传入ExtClassloader实例作为parent
        Launcher.ExtClassLoader extcl;
        
try {
            extcl 
= Launcher.ExtClassLoader.getExtClassLoader();
        } 
catch (IOException var10) {
            
throw new InternalError("Could not create extension class loader", var10);
        }

        
try {
            
this.loader = Launcher.AppClassLoader.getAppClassLoader(extcl);
        } 
catch (IOException var9) {
            
throw new InternalError("Could not create application class loader", var9);
        }

关于双亲委派原理: 在加载类的时候,会看看parent有没有设定,如果设定了 就调用parent.loadClass方法,如果没设定(==null)也就是parent应该是BootstrapClassloader, 会调用native的findBootstrapClass来加载类,代码:
                try {
                    
if(this.parent != null) {
                        c 
= this.parent.loadClass(name, false);
                    } 
else {
                        c 
= this.findBootstrapClassOrNull(name);
                    }
                } 
catch (ClassNotFoundException var10) {
                    ;
                }

目的是按照一定优先级别装载系统的lib,系统ext目录的lib,以及classpath的lib,防止系统的默认行为或者类的实现被修改。

3. java 类的动态加载
Java内置的ClassLoader总会在加载一个Class之前检查这个Class是否已经被加载过,已经被加载过的Class不会加载第二次。因此要想重新加载Class,我们需要实现自己的ClassLoader。
另外一个问题是,每个被加载的Class都需要被链接(link),这是通过执行ClassLoader.resolve()来实现的,这个方法是 final的,因此无法重写。Resove()方法不允许一个ClassLoader实例link一个Class两次,因此,当你需要重新加载一个 Class的时候,你需要重新New一个你自己的ClassLoader实例。

posted @ 2016-03-16 15:40 Milo的海域 阅读(311) | 评论 (0)编辑 收藏


maven-shade-plugin 用来打可执行jar包, 可以把所有依赖的三方库都包括进来
exec-maven-plugin 可以执行外部命令, 在项目中对python代码进行编译, 配合maven-assembly-plugin来生成package
maven-assembly-plugin 用来构建项目发行包, 要配合xml配置文件来组织包的结构,基本思路是从build环境copy到outputDirectory
license-maven-plugin 用来生成项目用到的3方库的版权汇总 或者其他的一些用法
maven-dependency-plugin 用来生成项目库之间的依赖关系
appassembler-maven-plugin 可以为项目生成优雅的启动脚本 支持linux/win
rpm-maven-plugin 用来为项目构建rpm安装包
maven-compiler-plugin 指定项目的jdk的编译兼容版本以及encoding类别

posted @ 2016-01-26 11:41 Milo的海域 阅读(256) | 评论 (0)编辑 收藏

快捷键migrating
定位选中字符串下个匹配的位置
eclipse: ctrl + k
idea: ctrl + F3       

eclipse: ctrl + q
idea: ctrl + shift + backspace
回到上一次编辑的位置

持续更新

posted @ 2015-11-25 16:46 Milo的海域 阅读(120) | 评论 (0)编辑 收藏

发现一个不错的介绍shell中冒号的用法的文章
http://codingstandards.iteye.com/blog/1160298

posted @ 2015-11-09 15:11 Milo的海域 阅读(238) | 评论 (0)编辑 收藏

项目用mvn exec:exec指令来启动server, 工作中需要调式server初始化的过程, 很容易想到mvnDebug, 但是发现设置的断点都没有hit, 反复调式多次都是如此,折腾了1个多小时, 突然看到stackoverflow 上有人说exec:exec是独立进程模式, mvnDebug的一些debug选项都被append到了父进程了. idea设置断点就然并卵了.

知道了问题所在解决就容易了, 只要修改pom.xml, 然后直接mvn exec:exec就能正常调式了
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>${mvnexec.version}</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <includeProjectDependencies>true</includeProjectDependencies>
                            <executable>java</executable>
                            <workingDirectory>${basedir}/config/sim</workingDirectory>
                            <classpathScope>runtime</classpathScope>
                            <arguments>
                                <argument>-agentlib:jdwp
=transport=dt_socket,server=y,suspend=y,address=4000</argument>
                                <argument>-classpath</argument>
                                <classpath/>
                                <argument>com.ymiao.Main</argument>
                                <argument>server</argument>
                                <argument>${basedir}/config/sim/sim.yml</argument>
                            </arguments>
                        </configuration>
                    </plugin>
                </plugins>
            </build>

总结就是exec:exec是要独立一个新进程来执行程序的, exec:java就相反, 其实用mvnDebug + exec:java也是理论可行的

posted @ 2015-10-21 17:12 Milo的海域 阅读(826) | 评论 (0)编辑 收藏

After Centos 7.1 tobe installed on my t400, my wireless link "Intel 5100 AGN" cannot be managed by NetworkManager, which show in "PCI unknown" state.

Googled many pages, most of them introduced how to scan wifi links by command line tool "iw", i tried all steps supplied by the pages but was blocked at the last step to get dynamical ipaddress by dhclient command "sudo dhclient wlp3s0 -v". The dhclient always complain "NO DHCPOFFERS received." (I doubted there should be some tricky to play with dhclient but which i am not faimiar with.. sad.. )

But i think there would be some extending tool for NetworkManager to manager wifi, then i google "NetworkManager wifi", i got "NetwrokManager-wifi plugin" from link https://www.centos.org/forums/viewtopic.php?f=47&t=52810

After following steps , i finally make wifi work well on centos 7.1

  • yum install NetworkManager-wifi
  • reboot machine (i tried logout and login, not work) 

Problem is NetworkManager-wifi is not installed by default on centos 7.1, (would it be my mistake when install OS? strange..)

posted @ 2015-09-17 10:41 Milo的海域 阅读(383) | 评论 (1)编辑 收藏

http://onlywei.github.io/explain-git-with-d3

posted @ 2015-09-09 15:57 Milo的海域 阅读(242) | 评论 (0)编辑 收藏

项目中要用到MBean,于是快速体验下,体验过程中发现2个问题:

  1. 自定义的Mbean的普通method能在jconsole的Mbeans里显示出来,但是涉及到geters/seters就无法显示了
  2. 如果MBean注册到下面形式创建的MBeanServer在Jconsole上无法显示的
    MBeanServer server = MBeanServerFactory.createMBeanServer();
    但是如果注册到下面的形式创建的Server在Jconsole上是可以显示MBean的
    MBeanServer server = ManagementFactory.getPlatformMBeanServer();       

stackoverflow上也有人发现这个问题

    http://stackoverflow.com/questions/7424009/mbeans-registered-to-mbean-server-not-showing-up-in-jconsole

posted @ 2015-09-08 10:53 Milo的海域 阅读(508) | 评论 (0)编辑 收藏

http://www.ourd3js.com/wordpress/

posted @ 2015-08-26 11:22 Milo的海域 阅读(246) | 评论 (0)编辑 收藏

仅列出标题
共9页: 上一页 1 2 3 4 5 6 7 8 9 下一页