Package org.springsource.loaded

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


    ReloadableType ctype = r.addType(c, loadBytesForClass(c));
    ReloadableType rtype = r.addType(t, loadBytesForClass(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("foo() running\nstring is abc\nowner is not null", result.stdout);

    rtype.loadNewVersion(
        "2",
        retrieveRename(t, t + "2", "simple.BasicWithClosureD2$_run_closure1:simple.BasicWithClosureD$_run_closure1",
            "simple.BasicWithClosureD2:simple.BasicWithClosureD"));

    ctype.loadNewVersion(
View Full Code Here


    ReloadableType ctype = r.addType(c, loadBytesForClass(c));
    ReloadableType rtype = r.addType(t, loadBytesForClass(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("foo() running\nstring is abc\nowner is not null", result.stdout);

    rtype.loadNewVersion(
        "2",
        retrieveRename(t, t + "2", "simple.BasicWithClosureE2$_run_closure1:simple.BasicWithClosureE$_run_closure1",
            "simple.BasicWithClosureE2:simple.BasicWithClosureE"));

    ctype.loadNewVersion("2",
View Full Code Here

        retrieveRename(c, "simple.BasicWithClosureE2$_run_closure1", "simple.BasicWithClosureE2:simple.BasicWithClosureE"));

    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("foo() running\nstring is abc def\nowner is not null", result.stdout);

    rtype.loadNewVersion(
        "3",
        retrieveRename(t, t + "3", "simple.BasicWithClosureE3$_run_closure1:simple.BasicWithClosureE$_run_closure1",
            "simple.BasicWithClosureE3:simple.BasicWithClosureE"));

    ctype.loadNewVersion("3",
View Full Code Here

    result = runUnguarded(ttype.getClazz(), "execute");
    assertEquals("[action:list, params:2]", result.stdout);

    // Change the body of the 'index' closure
    closuretype.loadNewVersion("2", retrieveRename(closure, "controller.Controller2$_closure1"));
    result = runUnguarded(ttype.getClazz(), "execute");
    assertEquals("[action:custard, params:345]", result.stdout);

    // Introduced a new closure, left the index one unchanged...
    closuretype.loadNewVersion("3", retrieveRename(closure, "controller.Controller3$_closure1"));
View Full Code Here

    closuretype.loadNewVersion("2", retrieveRename(closure, "controller.Controller2$_closure1"));
    result = runUnguarded(ttype.getClazz(), "execute");
    assertEquals("[action:custard, params:345]", result.stdout);

    // Introduced a new closure, left the index one unchanged...
    closuretype.loadNewVersion("3", retrieveRename(closure, "controller.Controller3$_closure1"));

    result = runUnguarded(ttype.getClazz(), "execute");
    System.out.println(result);
    // assertEquals("[action:custard, params:345]", result.stdout);
View Full Code Here

    String t = "clinitg.One";
    TypeRegistry typeRegistry = getTypeRegistry(t);
    ReloadableType rtype = typeRegistry.addType(t, loadBytesForClass(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("5", result.returnValue);
    rtype.loadNewVersion("39", retrieveRename(t, t + "2"));
    rtype.runStaticInitializer(); // call is made on reloadable type
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("7", result.returnValue);
  }
View Full Code Here

    String t = "clinitg.One";
    TypeRegistry typeRegistry = getTypeRegistry(t);
    ReloadableType rtype = typeRegistry.addType(t, loadBytesForClass(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("5", result.returnValue);
    rtype.loadNewVersion("39", retrieveRename(t, t + "2"));

    // use the 'new' ___clinit___ method to drive the static initializer
    Method staticInitializer = rtype.getClazz().getMethod("___clinit___");
    assertNotNull(staticInitializer);
    staticInitializer.invoke(null);
View Full Code Here

    String t = "clinitg.Two";
    TypeRegistry typeRegistry = getTypeRegistry(t);
    ReloadableType rtype = typeRegistry.addType(t, loadBytesForClass(t));
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("55", result.returnValue);
    rtype.loadNewVersion("39", retrieveRename(t, t + "2"));
    rtype.runStaticInitializer();
    result = runUnguarded(rtype.getClazz(), "run");
    assertEquals("99", result.returnValue);
  }
View Full Code Here

    tOne.loadNewVersion("002", retrieveRename(one, one + "002"));
    // Should be dispatcher and executor for the reloaded type
    assertEquals(2, typeRegistry.getChildClassLoader().getDefinedCount());
    assertEquals(7, runUnguarded(tOne.getClazz(), "getValue").returnValue);

    tTwo.loadNewVersion("002", tTwo.bytesInitial);
    assertEquals(4, typeRegistry.getChildClassLoader().getDefinedCount());
    result = runUnguarded(tOne.getClazz(), "getValue");
    assertEquals(5, runUnguarded(tTwo.getClazz(), "getValue").returnValue);

    Class<?> cOneExecutor = tOne.getLatestExecutorClass();
View Full Code Here

    // Now on this reload the child classloader should be recreated as it already has more
    // than 2 defined.
    // Note: this will currently cause us to redefine all the reloadable types
    // according to their most recent version. An optimization may be to only
    // define them on demand
    tTwo.loadNewVersion("002", tTwo.bytesInitial);
    assertEquals(4, typeRegistry.getChildClassLoader().getDefinedCount());
    assertEquals(5, runUnguarded(tTwo.getClazz(), "getValue").returnValue);

    // But what about calling the older types?
    assertEquals(5, runUnguarded(tOne.getClazz(), "getValue").returnValue);
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.