final String strXms = getInitialMemorySize(); final String strXmx = getMaxMemorySize(); final long xms = Utils.parseMemString(strXms); final long xmx = Utils.parseMemString(strXmx); final String maxXmx = azkabanProperties .getString(Constants.JobProperties.JOB_MAX_XMX, Constants.JobProperties.MAX_XMX_DEFAULT); final long sizeMaxXms = Utils.parseMemString(maxXms); final long sizeMaxXmx = Utils.parseMemString(maxXmx);
final String maxXmx = props.getString( Constants.JobProperties.JOB_MAX_XMX, Constants.JobProperties.MAX_XMX_DEFAULT); final long sizeMaxXms = Utils.parseMemString(maxXms); final long sizeMaxXmx = Utils.parseMemString(maxXmx); final String xms = jobProps.getString(XMS, null); if (xms != null && !PropsUtils.isVariableReplacementPattern(xms) && Utils.parseMemString(xms) > sizeMaxXms) { errors.add(String.format( "%s: Xms value has exceeded the allowed limit (max Xms = %s)", && Utils.parseMemString(xmx) > sizeMaxXmx) { errors.add(String.format( "%s: Xmx value has exceeded the allowed limit (max Xmx = %s)",
@Test public void testConversion() { Assert.assertEquals(Utils.parseMemString("1024"), 1L); Assert.assertEquals(Utils.parseMemString("1K"), 1L); Assert.assertEquals(Utils.parseMemString("1M"), 1024L); Assert.assertEquals(Utils.parseMemString("1G"), 1024L * 1024L); Assert.assertEquals(Utils.parseMemString("1k"), 1L); Assert.assertEquals(Utils.parseMemString("1m"), 1024L); Assert.assertEquals(Utils.parseMemString("1g"), 1024L * 1024L); Assert.assertEquals(Utils.parseMemString("5000"), 4L); Assert.assertEquals(Utils.parseMemString("1024K"), 1024L); Assert.assertEquals(Utils.parseMemString("512M"), 512 * 1024L); Assert.assertEquals(Utils.parseMemString("2G"), 2L * 1024L * 1024L); }
private void badFormatHelper(final String str) { try { Utils.parseMemString(str); Assert.fail("should get a runtime exception"); } catch (final Exception e) { Assert.assertEquals(e instanceof NumberFormatException, true); } } }
final String strXms = getInitialMemorySize(); final String strXmx = getMaxMemorySize(); final long xms = Utils.parseMemString(strXms); final long xmx = Utils.parseMemString(strXmx); final String maxXmx = azkabanProperties .getString(Constants.JobProperties.JOB_MAX_XMX, Constants.JobProperties.MAX_XMX_DEFAULT); final long sizeMaxXms = Utils.parseMemString(maxXms); final long sizeMaxXmx = Utils.parseMemString(maxXmx);
final String maxXmx = props.getString( Constants.JobProperties.JOB_MAX_XMX, Constants.JobProperties.MAX_XMX_DEFAULT); final long sizeMaxXms = Utils.parseMemString(maxXms); final long sizeMaxXmx = Utils.parseMemString(maxXmx); final String xms = jobProps.getString(XMS, null); if (xms != null && !PropsUtils.isVariableReplacementPattern(xms) && Utils.parseMemString(xms) > sizeMaxXms) { errors.add(String.format( "%s: Xms value has exceeded the allowed limit (max Xms = %s)", && Utils.parseMemString(xmx) > sizeMaxXmx) { errors.add(String.format( "%s: Xmx value has exceeded the allowed limit (max Xmx = %s)",