<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    I want to fly higher
    programming Explorer
    posts - 114,comments - 263,trackbacks - 0
    1.Spring-loaded項目核心作者Andy Clement
         github主頁:
            https://github.com/aclement
        可以看到是一個開源大神.

    2.往來郵件,其中有很多東西值得學習:尤其是紅色部分

    2015年6月26日

    Hi,

    Really all the docs is what I wrote in that bug report: https://github.com/spring-projects/spring-loaded/issues/70

    Yes you need javaagent (and noverify), the -Dspringloaded=watchJars=foo.jar:bar.jar part is just the options that get passed to the agent to configure the behavior.

    There are a couple of regression tests in the class: SpringLoadedTestsInSeparateJVM

    Remember that you only need the short part of the jar name (foo.jar), I’m not sure what will happen if you fully qualify the path to the jar.

    You could turn on -Dspringloaded=verbose to check spring loaded is basically functioning (can’t recall if I added extra verbose output specifically for jar reloading).

    cheers,
    Andy

    On Jun 232015, at 5:09 AM, landon <340706410@qq.com> wrote:

    Hi,
       I'm a software engineer in china.I'm interested in spring-loaded recently.But pre 1.2.3,it's only reload calsses.In github,i saw you said 1.2.4 can do reload class files in jar.
      eg,with -Dspringloaded=watchJars parameters.
      My question is:
      1.Can you give a detail examples,it's also need -javaagent?
      2.I build a jar using the master code in github,but i test it's no effect to reload jar files.I want to know when the 1.2.4 version can support the function.
       _____________________
       Thanks very much.
       Best Regards.


    2015年6月29日

    Hi,

    Possibly it could be a windows thing I suppose. This works perfectly for me:

    Code.java
    ===
    public class Code {
      public static void main(String []argv) {
        while (true) {
          new Bar().run();
          try { Thread.sleep(2000); } catch (Exception e) {}
        }
      }
    }
    ===

    Bar.java
    ===
    public class Bar {
      public void run() {
        System.out.println(“one");
      }
    }
    ===

    javac *.java
    jar -cvMf spring-load-example-main.jar Code.class
    jar -cvMf spring-load-example-extra.jar Bar.class

    java -classpath spring-load-example-main.jar:spring-load-example-extra.jar -Dspringloaded="verbose;watchJars=spring-load-example-extra.jar" -javaagent:/Users/aclement/gits/spring-loaded/springloaded/build/libs/springloaded-1.2.4.BUILD-SNAPSHOT.jar -noverify Code

    This will print ‘one’ every second.

    Then I change Bar, edit the ‘one’ and replace with ‘two’. Then:

    javac Bar.java
    jar -cvMf newjar.jar Bar.class
    mv newjar.jar spring-load-example-extra.jar

    This triggers some trace output and then it starts printing two:


    INFO: Observed last modification time change for /Users/aclement/gits/spring-loaded/springloaded/build/libs/play/spring-load-example-extra.jar (lastScanTime=1435594228140)
    Jun 292015 9:10:29 AM org.springsource.loaded.agent.Watcher determineChangesSince
    INFO: Firing file changed event /Users/aclement/gits/spring-loaded/springloaded/build/libs/play/spring-load-example-extra.jar

    Reloading: Loading new version of Bar [PH0x0kq]

    two
    two
    two


    This is on a mac. Can you look at the timestamps of your files inside the jar? Confirm it is changing to something more recent inside the jar? That is what is being used to determine if an update occurred.

    > can the spring-loaded used to the production environment?

    Nothing prevents it but it does add significant overhead to running code because it introduces a lot of indirection to make the reloading work.

    cheers,
    Andy

    On Jun 282015, at 7:29 PM, landon <340706410@qq.com> wrote:

    Hi,
      I'm so excited to receive your reply.Thanks very much.
      I say my example:
         I have two jars,spring-load-example-main.jar,spring-load-example-extra.jar,The former depends on the latter.The classes in spring-loaded-example-extra.jar often changes,so i want to reload the jar using spring-loaded.
          My Launch script is:
                     @echo off
                     cd /%~dp0
                     java -Dspringloaded=verbose;explain;watchJars=spring-load-example-extra.jar -javaagent:springloaded-1.2.4.BUILD-SNAPSHOT.jar -noverify -cp spring-load-example-main.jar;spring-load-example-extra.jar com.mavsplus.example.springloaded.SpringLoadedExample
         The spring-load-example-main.jar,spring-load-example-extra.jar,springloaded-1.2.4.BUILD-SNAPSHOT.jar are in the same directory.When i want to reload the spring-load-example-extra.jar,i repackage the jar and replace to the directory and override it,but it has no effect.That's all.I also used jrebel,it can reload ja,but must assign the monitor reload jar classes dirctory,i also cannot to ovverride the reload jar to reache the reload goal.
     And Finally i want to ask: can the spring-loaded used to the production environment?


    2015年6月30日

    Hi,

    Sorry about that - I made the change you noticed to correctly use File.separator and committed that (thanks for telling me about it). I notice a TODO had been left there saying to sort it out for windows!

       ->I ask another question,i know if used to production environment,it maybe has some performance loss.To avoid it,i suggest,when we decide to reload the jar,we can send a message to notice to reload,and to avoid must be monitor the jar change every seconds.
        ->can extract a mini-framework only to reload jars.
        ->or can add a switch,by the switch,we can reload jars manually?
          if above can reduce the performance loss?

    It isn’t the act of watching the jar that is expensive or the act of loading the jar changes into the system. Basically for code to support reloading it goes through a massive transformation process at loadtime, this transformed byte code is slower, but it needs to be done up front just in case you reload anything.  To minimize the performance impact you would reduce what is made reloadable - so in the jar watching case watch as few jars as possible. Maybe break big jars into smaller ones so you can watch only a subset of the jars.

    cheers,
    Andy

    On Jun 302015, at 3:00 AM, landon <340706410@qq.com> wrote:

    Hi,
      First,Thanks very much to reply me.
      Okay,I Got the reason,you are right,it's the os environment problem.I Browse the source code,i find the code,{@link org.springsource.loaded.TypeRegistry#private boolean couldBeReloadable(String slashedName)},The method 689L:
           int lastSlashPos = slashedName.lastIndexOf('/');
       The Seperator is unix seperator,not windows.I change it to the cross-platform code:
           int lastSlashPos = slashedName.lastIndexOf(File.separator);
        And finally,I rebuild the source code and got the new jar.I tested,it can reload jars perfectly!

       ->I ask another question,i know if used to production environment,it maybe has some performance loss.To avoid it,i suggest,when we decide to reload the jar,we can send a message to notice to reload,and to avoid must be monitor the jar change every seconds.
        ->can extract a mini-framework only to reload jars.
        ->or can add a switch,by the switch,we can reload jars manually?
          if above can reduce the performance loss?



    2015-7-2

    Hey,
    Actually email is probably the best way to communicate on this, I don’t work on spring loaded all that much, only occasionally.
               ->two jars,main.jar and patch.jar,when launch main,i used a classloader load classes in patch.jar and put them to a Map,and some logic used the class intance...when some logic changes,i send a message(eg.use http) to the main process(it's a network program,can listen),when receive the message,i used another classloader to load the new patch.jar and re-fill the Map.By this method,i can implement some hot-swap logics,new request can used the new classes from Map...
    I think there are use cases where that can work fine and you don’t need the full flexibility of a general purpose reloading system like spring loaded. You just have to make sure those instances don’t leak into other places where you can’t keep track of them as you’ll want to get rid of all of them when loading a new version.
         ->another question is:i think the hot-loaded has a deadly problem is : the Data in the class instance or in the memory...when reload the new class,the data in the old class instance was lost...
     to avoid it,in the class implemention,only have method/logic,not has property/data...put all data to a common place...but in my opinion,in oop,data and actions in fact ,they are together...so this is the confict.
             ->so can you give me some suggestion or give me a good practice?
    With spring loaded the class instances remain around, they change on the fly to support new fields and methods are not rebuilt. This can cause issues because constructors are not re-run for pre-existing instances and so new fields added to existing objects may not be set. I think, in your case, you can break encapsulation by keeping state separation to behaviour if it is necessary and helpful for your use case - don’t be forced to keep them together if it makes your system less flexible than you need. I don’t see why you can’t have a bean that keeps state and then a class something like XXXOperator that operates on those state objects.  Or perhaps you could have a constructor on your objects that takes in one of the older objects and copies the state into the new instance before you discard the older object.
    cheers,
    Andy

    On Jul 1, 2015, at 6:47 AM, landon <340706410@qq.com> wrote:

    Hi,
      So excited to reply me.Thank you.
      Here, i have two questions want to interchange with you.
          ->I write a function used to reload jar.The implementation is:
                ->two jars,main.jar and patch.jar,when launch main,i used a classloader load classes in patch.jar and put them to a Map,and some logic used the class intance...when some logic changes,i send a message(eg.use http) to the main process(it's a network program,can listen),when receive the message,i used another classloader to load the new patch.jar and re-fill the Map.By this method,i can implement some hot-swap logics,new request can used the new classes from Map...
               ->how would you evaluate my way?
         ->another question is:i think the hot-loaded has a deadly problem is : the Data in the class instance or in the memory...when reload the new class,the data in the old class instance was lost...
     to avoid it,in the class implemention,only have method/logic,not has property/data...put all data to a common place...but in my opinion,in oop,data and actions in fact ,they are together...so this is the confict.
             ->so can you give me some suggestion or give me a good practice?
         ->finally,can you give a contact way the except email.i think it's low efficiency.
      Cherrs.



    3.感受
        1.開源的力量真是偉大!
        2.開源大神的回復真是給力!
        3.我也會加入開源的大軍中!
    posted on 2015-07-01 21:06 landon 閱讀(6706) 評論(3)  編輯  收藏 所屬分類: JVMHotSwap

    FeedBack:
    # re: Spring-Loaded 使用Ⅲ -與其作者Andy Clement往來郵件
    2015-07-29 13:57 | David1228
    Good!!!  回復  更多評論
      
    # re: Spring-Loaded 使用Ⅲ -與其作者Andy Clement往來郵件[未登錄]
    2015-09-23 13:22 | zy
    博主你好:

    我按照你的博客測試,watchJars并沒有起作用啊,是我的版本問題嗎?我從github上下的springloaded-1.2.4.RELEASE.jar ,和你所使用的springloaded-1.2.4.BUILD-SNAPSHOT.jar會有區(qū)別嗎?
    我的測試代碼是借用的你與大神郵件中的測試代碼。  回復  更多評論
      
    # re: Spring-Loaded 使用Ⅲ -與其作者Andy Clement往來郵件
    2015-10-05 23:04 | landon
    @zy
    http://m.tkk7.com/landon/archive/2015/10/05/425994.html#427599
    _______
    看一下這下面我的評論回復.  回復  更多評論
      
    主站蜘蛛池模板: 四虎影视永久免费观看地址| 久久久久久影院久久久久免费精品国产小说| 免费观看成人久久网免费观看| 亚洲综合精品网站在线观看| 黄网站色视频免费看无下截| 国产一级特黄高清免费大片| 亚洲人成人无码.www石榴 | 中文字幕免费在线视频| 亚洲欧洲中文日韩久久AV乱码| 一级毛片免费全部播放| 区久久AAA片69亚洲| 久久精品中文字幕免费| 亚洲黄色在线视频| 四虎1515hh永久久免费| 四虎必出精品亚洲高清| 国产免费拔擦拔擦8x| 一区二区三区免费电影| 国产亚洲综合网曝门系列| 97公开免费视频| 亚洲成av人片在线天堂无| 亚洲AV无码一区二区三区在线观看| 黄桃AV无码免费一区二区三区| 亚洲爱情岛论坛永久| 日韩一区二区a片免费观看 | 国产成人精品日本亚洲11| 国产精品免费综合一区视频| sss日本免费完整版在线观看| 亚洲AV午夜成人片| 最新欧洲大片免费在线| 高h视频在线免费观看| 亚洲av综合av一区| 久久不见久久见中文字幕免费| 日本特黄特色AAA大片免费| 久久久久久亚洲精品| 天天干在线免费视频| 中国在线观看免费的www| 亚洲手机中文字幕| 亚洲精品人成无码中文毛片 | 中文字幕免费在线视频| 亚洲国产精品久久网午夜| 免费在线观看黄网|