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的海域 閱讀(191) | 評論 (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的海域 閱讀(318) | 評論 (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的海域 閱讀(269) | 評論 (0)編輯 收藏

          快捷鍵migrating
          定位選中字符串下個匹配的位置
          eclipse: ctrl + k
          idea: ctrl + F3       

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

          持續更新

          posted @ 2015-11-25 16:46 Milo的海域 閱讀(125) | 評論 (0)編輯 收藏

          發現一個不錯的介紹shell中冒號的用法的文章
          http://codingstandards.iteye.com/blog/1160298

          posted @ 2015-11-09 15:11 Milo的海域 閱讀(249) | 評論 (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的海域 閱讀(836) | 評論 (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的海域 閱讀(398) | 評論 (1)編輯 收藏

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

          posted @ 2015-09-09 15:57 Milo的海域 閱讀(244) | 評論 (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的海域 閱讀(520) | 評論 (0)編輯 收藏

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

          posted @ 2015-08-26 11:22 Milo的海域 閱讀(258) | 評論 (0)編輯 收藏

          僅列出標題
          共9頁: 上一頁 1 2 3 4 5 6 7 8 9 下一頁 
          主站蜘蛛池模板: 贵定县| 陵川县| 洛宁县| 德州市| 泰宁县| 武隆县| 玛多县| 辽阳市| 墨脱县| 三河市| 丰城市| 镇巴县| 五家渠市| 田阳县| 焦作市| 西林县| 蒙阴县| 邵阳县| 胶州市| 东山县| 无极县| 旺苍县| 新郑市| 滦南县| 易门县| 高淳县| 温宿县| 鄄城县| 威信县| 西乌珠穆沁旗| 松滋市| 渭源县| 安义县| 嵩明县| 门源| 乌兰浩特市| 平利县| 静乐县| 五大连池市| 翁源县| 巫溪县|