Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
NEXUS-3056: memory sizing made optional
Browse files Browse the repository at this point in the history
git-svn-id: file:///opt/svn/repositories/sonatype.org/nexus/trunk/nexus@5693 2aa8b3fc-8ebb-4439-a84f-95066eaea8ab
  • Loading branch information
cstamas committed Dec 8, 2009
1 parent af7a741 commit ece63c1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
Expand Up @@ -67,12 +67,12 @@ public boolean initiateUpgradeProcess()
NexusBuupInvocationRequest request = new NexusBuupInvocationRequest( upgradeBundleDir );

// simulate we have params for now
request.setNexusBundleXms( "128m" );
request.setNexusBundleXms( 128 );

request.setNexusBundleXmx( "512m" );
request.setNexusBundleXmx( 512 );

invoker.invokeBuup( request );

return true;
}

Expand Down
Expand Up @@ -5,7 +5,6 @@

import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Configuration;
import org.codehaus.plexus.util.StringUtils;
import org.sonatype.buup.BuupInvocationException;
import org.sonatype.buup.BuupInvocationRequest;
import org.sonatype.buup.BuupInvoker;
Expand All @@ -24,14 +23,14 @@ public void invokeBuup( NexusBuupInvocationRequest request )
{
HashMap<String, String> params = new HashMap<String, String>();

if ( StringUtils.isNotBlank( request.getNexusBundleXmx() ) )
if ( request.getNexusBundleXmx() != NexusBuupInvocationRequest.XM_UNCHANGED )
{
params.put( "nexus.bundle.xmx", request.getNexusBundleXmx() );
params.put( "nexus.bundle.xmx", request.getNexusBundleXmx() + "MB" );
}

if ( StringUtils.isNotBlank( request.getNexusBundleXms() ) )
if ( request.getNexusBundleXms() != NexusBuupInvocationRequest.XM_UNCHANGED )
{
params.put( "nexus.bundle.xms", request.getNexusBundleXms() );
params.put( "nexus.bundle.xms", request.getNexusBundleXms() + "MB" );
}

BuupInvocationRequest br =
Expand Down
Expand Up @@ -9,22 +9,28 @@
*/
public class NexusBuupInvocationRequest
{
/**
* Value to be interpreted as "unchanged", so user did not set any specific value. BUUP should leave the memory
* option unchanged.
*/
public static final int XM_UNCHANGED = -1;

/**
* The directory where the downloaded upgrade bundle is unzipped.
*/
private final File explodedUpgradeBundleDirectory;

/**
* The amount of memory to pass in as -Xmx parameter. Should be as JVM CLI specifies, but without the "-Xmx" prefix!
* Example: 512m means 512MB
* The number should be interpreted as MB. Example: 512 means 512MB
*/
private String nexusBundleXmx;
private int nexusBundleXmx = XM_UNCHANGED;

/**
* The amount of memory to pass in as -Xms parameter. Should be as JVM CLI specifies, but without the "-Xms" prefix!
* Example: 128m means 128MB
* The number should be interpreted as MB. Example: 128 means 128MB
*/
private String nexusBundleXms;
private int nexusBundleXms = XM_UNCHANGED;

public NexusBuupInvocationRequest( File explodedUpgradeBundleDirectory )
{
Expand All @@ -36,22 +42,22 @@ public File getExplodedUpgradeBundleDirectory()
return explodedUpgradeBundleDirectory;
}

public String getNexusBundleXmx()
public int getNexusBundleXmx()
{
return nexusBundleXmx;
}

public void setNexusBundleXmx( String nexusBundleXmx )
public void setNexusBundleXmx( int nexusBundleXmx )
{
this.nexusBundleXmx = nexusBundleXmx;
}

public String getNexusBundleXms()
public int getNexusBundleXms()
{
return nexusBundleXms;
}

public void setNexusBundleXms( String nexusBundleXms )
public void setNexusBundleXms( int nexusBundleXms )
{
this.nexusBundleXms = nexusBundleXms;
}
Expand Down

0 comments on commit ece63c1

Please sign in to comment.