<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 閱讀(6693) 評論(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會有區別嗎?
    我的測試代碼是借用的你與大神郵件中的測試代碼。  回復  更多評論
      
    # re: Spring-Loaded 使用Ⅲ -與其作者Andy Clement往來郵件
    2015-10-05 23:04 | landon
    @zy
    http://www.tkk7.com/landon/archive/2015/10/05/425994.html#427599
    _______
    看一下這下面我的評論回復.  回復  更多評論
      
    主站蜘蛛池模板: 亚洲av成人中文无码专区| 亚洲免费电影网站| 久久国产精品免费一区| 免费一级做a爰片久久毛片潮喷| 亚洲中文字幕无码中文字| 久久这里只有精品国产免费10| 亚洲国产成人精品电影| 无码av免费毛片一区二区 | 免费大片黄手机在线观看| 337P日本欧洲亚洲大胆精品| 国产精品公开免费视频| 国产成人 亚洲欧洲| 久久激情亚洲精品无码?V| 91精品成人免费国产| 久久久久久久久亚洲| 久久久久久精品成人免费图片| 亚洲欧洲另类春色校园小说| 久久不见久久见免费影院| 亚洲精品无码mⅴ在线观看| 国产免费AV片无码永久免费| 一级毛片在播放免费| 人人狠狠综合久久亚洲88| 曰批视频免费40分钟试看天天| 91午夜精品亚洲一区二区三区| 日本免费电影一区| 久久久久久久久久免免费精品 | 亚洲精品无码Av人在线观看国产 | 成人免费无码视频在线网站| 亚洲av无码专区国产不乱码| 狠狠亚洲狠狠欧洲2019| 18未年禁止免费观看| 国产99久久亚洲综合精品| 久久亚洲精品中文字幕三区| 永久免费的网站在线观看| 一级做a爰片性色毛片免费网站| 亚洲精品美女久久久久99| 台湾一级毛片永久免费| 一个人免费观看视频在线中文| 亚洲午夜精品一区二区| 国产又大又黑又粗免费视频| 两个人看的www高清免费视频|