Package org.springsource.loaded

Examples of org.springsource.loaded.ReloadableType.loadNewVersion()


    ReloadableType BB = tr.addType("invokestatic.issue4.BB", loadBytesForClass("invokestatic.issue4.BB"));
   
    Result r = runUnguarded(BB.getClazz(), "getMessage");
    assertEquals("String1",(String)r.returnValue);
   
    BB.loadNewVersion(BB.bytesInitial);

    r = runUnguarded(BB.getClazz(), "getMessage");
    assertEquals("String1",(String)r.returnValue);
  }
 
View Full Code Here


   
    Result r = runUnguarded(B.getClazz(), "getMessage");
    assertEquals("String1",(String)r.returnValue);

    A.loadNewVersion(A.bytesInitial);
    B.loadNewVersion(B.bytesInitial);

    r = runUnguarded(B.getClazz(), "getMessage");
    assertEquals("String1",(String)r.returnValue);
  }
 
View Full Code Here

    Object callerInstance = rcaller.getClazz().newInstance();
    res = runOnInstance(rcaller.getClazz(), callerInstance, "getValue");
    assertEquals("324 abc", res.returnValue.toString());

    // Reload the code
    rcaller.loadNewVersion("002", retrieveRename(caller, caller + "2"));

    // Constants are inlined - that is why getValue() returns the new value for the String
    res = runOnInstance(rcaller.getClazz(), callerInstance, "getValue");
    assertEquals("324 def", res.returnValue.toString());
View Full Code Here

    assertEquals("callee", res.returnValue.toString());

    // Reload the code, a new constructor in the callee and runB() invokes it
    rcalleeSuper.loadNewVersion("002", retrieveRename(calleeSuper, calleeSuper + "2"));
    rcaller.loadNewVersion("002", retrieveRename(caller, caller + "2", "ctors.CalleeB2:ctors.CalleeB"));
    rcallee.loadNewVersion("002", retrieveRename(callee, callee + "2", "ctors.CalleeSuperB2:ctors.CalleeSuperB"));

    // The new runB() method will include a call 'new Callee("abcde")'
    // Without a rewrite, it will cause this problem:
    // Caused by: java.lang.NoSuchMethodError: ctors.Callee.<init>(Ljava/lang/String;)V
    //   at ctors.Caller__E002.runB(Caller2.java:10)
View Full Code Here

    TypeRegistry r = getTypeRegistry("data.HelloWorldFields");
    ReloadableType rtype = r.addType("data.HelloWorldFields", loadBytesForClass("data.HelloWorldFields"));
    assertEquals("Hello Andy", runUnguarded(rtype.getClazz(), "greet").stdout);

    // Just reload that same version (creates new CurrentLiveVersion)
    rtype.loadNewVersion("000", rtype.bytesInitial);
    assertEquals("Hello Andy", runUnguarded(rtype.getClazz(), "greet").stdout);

    // Load a real new version
    rtype.loadNewVersion("002", retrieveRename("data.HelloWorldFields", "data.HelloWorldFields002"));
    assertEquals("Hello Christian", runUnguarded(rtype.getClazz(), "greet").stdout);
View Full Code Here

    // Just reload that same version (creates new CurrentLiveVersion)
    rtype.loadNewVersion("000", rtype.bytesInitial);
    assertEquals("Hello Andy", runUnguarded(rtype.getClazz(), "greet").stdout);

    // Load a real new version
    rtype.loadNewVersion("002", retrieveRename("data.HelloWorldFields", "data.HelloWorldFields002"));
    assertEquals("Hello Christian", runUnguarded(rtype.getClazz(), "greet").stdout);

    Object o = rtype.getClazz().newInstance();
    assertEquals("Hello Christian", runOnInstance(rtype.getClazz(), o, "greet").stdout);
    runOnInstance(rtype.getClazz(), o, "setMessage", "Hello Christian");
View Full Code Here

    TypeRegistry r = getTypeRegistry("data.HelloWorldStaticFields");
    ReloadableType rtype = r.addType("data.HelloWorldStaticFields", loadBytesForClass("data.HelloWorldStaticFields"));
    assertEquals("Hello Andy", runUnguarded(rtype.getClazz(), "greet").stdout);

    // Just reload that same version (creates new CurrentLiveVersion)
    rtype.loadNewVersion("000", rtype.bytesInitial);
    assertEquals("Hello Andy", runUnguarded(rtype.getClazz(), "greet").stdout);

    // Load a real new version
    // won't say 'hello christian' because field static initializers are not re-run
    rtype.loadNewVersion("002", retrieveRename("data.HelloWorldStaticFields", "data.HelloWorldStaticFields002"));
View Full Code Here

    rtype.loadNewVersion("000", rtype.bytesInitial);
    assertEquals("Hello Andy", runUnguarded(rtype.getClazz(), "greet").stdout);

    // Load a real new version
    // won't say 'hello christian' because field static initializers are not re-run
    rtype.loadNewVersion("002", retrieveRename("data.HelloWorldStaticFields", "data.HelloWorldStaticFields002"));
    assertEquals("Hello Andy", runUnguarded(rtype.getClazz(), "greet").stdout);

    Object o = rtype.getClazz().newInstance();
    assertEquals("Hello Andy", runOnInstance(rtype.getClazz(), o, "greet").stdout);
    runOnInstance(rtype.getClazz(), o, "setMessage", "Hello Christian");
View Full Code Here

    TypeRegistry typeRegistry = getTypeRegistry("data.HelloWorld");
    ReloadableType rtype = typeRegistry.addType("data.HelloWorld", loadBytesForClass("data.HelloWorld"));
    runUnguarded(rtype.getClazz(), "greet");

    // Just transform the existing version into a dispatcher/executor
    rtype.loadNewVersion("000", rtype.bytesInitial);
    assertEquals("Greet from HelloWorld", runUnguarded(rtype.getClazz(), "greet").stdout);

    // Load a real new version
    rtype.loadNewVersion("002", retrieveRename("data.HelloWorld", "data.HelloWorld002"));
    assertEquals("Greet from HelloWorld 2", runUnguarded(rtype.getClazz(), "greet").stdout);
View Full Code Here

    // Just transform the existing version into a dispatcher/executor
    rtype.loadNewVersion("000", rtype.bytesInitial);
    assertEquals("Greet from HelloWorld", runUnguarded(rtype.getClazz(), "greet").stdout);

    // Load a real new version
    rtype.loadNewVersion("002", retrieveRename("data.HelloWorld", "data.HelloWorld002"));
    assertEquals("Greet from HelloWorld 2", runUnguarded(rtype.getClazz(), "greet").stdout);
  }

  /**
   * Simple rewrite but the class has a static initializer (which we have to merge some code into)
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.