Examples of JvmOptions


Examples of org.apache.twill.internal.JvmOptions

    throws JsonParseException {
    JsonObject jsonObj = json.getAsJsonObject();
    String extraOptions = context.deserialize(jsonObj.get("extraOptions"), String.class);
    JvmOptions.DebugOptions debugOptions = context.deserialize(jsonObj.get("debugOptions"),
                                                               JvmOptions.DebugOptions.class);
    return new JvmOptions(extraOptions, debugOptions);
  }
View Full Code Here

Examples of org.apache.twill.internal.JvmOptions

*/
public class JvmOptionsCodecTest {

  @Test
  public void testNoNulls() throws Exception {
    JvmOptions options = new JvmOptions("-version",
                                        new JvmOptions.DebugOptions(true, false, ImmutableSet.of("one", "two")));
    final StringWriter writer = new StringWriter();
    JvmOptionsCodec.encode(options, new OutputSupplier<Writer>() {
      @Override
      public Writer getOutput() throws IOException {
        return writer;
      }
    });
    JvmOptions options1 = JvmOptionsCodec.decode(new InputSupplier<Reader>() {
      @Override
      public Reader getInput() throws IOException {
        return new StringReader(writer.toString());
      }
    });
    Assert.assertEquals(options.getExtraOptions(), options1.getExtraOptions());
    Assert.assertEquals(options.getDebugOptions().doDebug(), options1.getDebugOptions().doDebug());
    Assert.assertEquals(options.getDebugOptions().doSuspend(), options1.getDebugOptions().doSuspend());
    Assert.assertEquals(options.getDebugOptions().getRunnables(), options1.getDebugOptions().getRunnables());
  }
View Full Code Here

Examples of org.apache.twill.internal.JvmOptions

    Assert.assertEquals(options.getDebugOptions().getRunnables(), options1.getDebugOptions().getRunnables());
  }

  @Test
  public void testSomeNulls() throws Exception {
    JvmOptions options = new JvmOptions(null, new JvmOptions.DebugOptions(false, false, null));
    final StringWriter writer = new StringWriter();
    JvmOptionsCodec.encode(options, new OutputSupplier<Writer>() {
      @Override
      public Writer getOutput() throws IOException {
        return writer;
      }
    });
    JvmOptions options1 = JvmOptionsCodec.decode(new InputSupplier<Reader>() {
      @Override
      public Reader getInput() throws IOException {
        return new StringReader(writer.toString());
      }
    });
    Assert.assertEquals(options.getExtraOptions(), options1.getExtraOptions());
    Assert.assertEquals(options.getDebugOptions().doDebug(), options1.getDebugOptions().doDebug());
    Assert.assertEquals(options.getDebugOptions().doSuspend(), options1.getDebugOptions().doSuspend());
    Assert.assertEquals(options.getDebugOptions().getRunnables(), options1.getDebugOptions().getRunnables());
  }
View Full Code Here

Examples of org.apache.twill.internal.JvmOptions

  }

  @Test
  public void testNoRunnables() throws Exception {
    List<String> noRunnables = Collections.emptyList();
    JvmOptions options = new JvmOptions(null, new JvmOptions.DebugOptions(true, false, noRunnables));
    final StringWriter writer = new StringWriter();
    JvmOptionsCodec.encode(options, new OutputSupplier<Writer>() {
      @Override
      public Writer getOutput() throws IOException {
        return writer;
      }
    });
    JvmOptions options1 = JvmOptionsCodec.decode(new InputSupplier<Reader>() {
      @Override
      public Reader getInput() throws IOException {
        return new StringReader(writer.toString());
      }
    });
    Assert.assertEquals(options.getExtraOptions(), options1.getExtraOptions());
    Assert.assertEquals(options.getDebugOptions().doDebug(), options1.getDebugOptions().doDebug());
    Assert.assertEquals(options.getDebugOptions().doSuspend(), options1.getDebugOptions().doSuspend());
    Assert.assertEquals(options.getDebugOptions().getRunnables(), options1.getDebugOptions().getRunnables());
  }
View Full Code Here

Examples of org.apache.twill.internal.JvmOptions

  }

  private JvmOptions loadJvmOptions() throws IOException {
    final File jvmOptsFile = new File(Constants.Files.JVM_OPTIONS);
    if (!jvmOptsFile.exists()) {
      return new JvmOptions(null, JvmOptions.DebugOptions.NO_DEBUG);
    }
    return JvmOptionsCodec.decode(new InputSupplier<Reader>() {
      @Override
      public Reader getInput() throws IOException {
        return new FileReader(jvmOptsFile);
View Full Code Here

Examples of org.apache.twill.internal.JvmOptions

      // If no vm options, no need to localize the file.
      return;
    }
    LOG.debug("Create and copy {}", Constants.Files.JVM_OPTIONS);
    final Location location = createTempLocation(Constants.Files.JVM_OPTIONS);
    JvmOptionsCodec.encode(new JvmOptions(extraOptions, debugOptions), new OutputSupplier<Writer>() {
      @Override
      public Writer getOutput() throws IOException {
        return new OutputStreamWriter(location.getOutputStream(), Charsets.UTF_8);
      }
    });
View Full Code Here

Examples of org.gradle.process.internal.JvmOptions

     * @return True if the current process could be configured, false otherwise.
     */
    public boolean configureForBuild(DaemonParameters requiredBuildParameters) {
        boolean javaHomeMatch = getJavaHome().equals(requiredBuildParameters.getEffectiveJavaHome());

        List<String> currentImmutable = new JvmOptions(new IdentityFileResolver()).getAllImmutableJvmArgs();
        List<String> requiredImmutable = requiredBuildParameters.getEffectiveJvmArgs();
        List<String> requiredImmutableMinusDefaults = removeDefaults(requiredImmutable);
        boolean noImmutableJvmArgsRequired = requiredImmutableMinusDefaults.equals(currentImmutable);

        if (javaHomeMatch && noImmutableJvmArgsRequired) {
View Full Code Here

Examples of org.gradle.process.internal.JvmOptions

    }

    private static JvmOptions inferJvmOptions() {
        // Try to infer the effective jvm options for the currently running process.
        // We only care about 'managed' jvm args, anything else is unimportant to the running build
        JvmOptions jvmOptions = new JvmOptions(new IdentityFileResolver());
        jvmOptions.setAllJvmArgs(ManagementFactory.getRuntimeMXBean().getInputArguments());
        return jvmOptions;
    }
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.