use only on jaxbcontext to reduce memory consumption

This commit is contained in:
Sebastian Sdorra
2012-05-19 11:12:46 +02:00
parent a8d5e677de
commit 89a84e30e3
3 changed files with 18 additions and 67 deletions

View File

@@ -322,29 +322,6 @@ public class AbstractHgHandler
protected <T> T getResultFromScript(Class<T> resultType,
HgPythonScript script, Map<String, String> extraEnv)
throws IOException, RepositoryException
{
return getResultFromScript(resultType, script, jaxbContext, extraEnv);
}
/**
* Method description
*
*
* @param resultType
* @param script
* @param jaxbContext
* @param extraEnv
* @param <T>
*
* @return
*
* @throws IOException
* @throws RepositoryException
*/
protected <T> T getResultFromScript(Class<T> resultType,
HgPythonScript script, JAXBContext jaxbContext,
Map<String, String> extraEnv)
throws IOException, RepositoryException
{
Process p = createScriptProcess(script, extraEnv);
T result = null;

View File

@@ -70,18 +70,15 @@ public class HgChangesetViewer extends AbstractHgHandler
*
*
* @param handler
* @param changesetPagingResultContext
* @param changesetContext
* @param jaxbContext
* @param context
* @param repositoryDirectory
*/
public HgChangesetViewer(HgRepositoryHandler handler,
JAXBContext changesetPagingResultContext,
JAXBContext changesetContext, HgContext context,
JAXBContext jaxbContext, HgContext context,
File repositoryDirectory)
{
super(handler, changesetPagingResultContext, context, repositoryDirectory);
this.changesetContext = changesetContext;
super(handler, jaxbContext, context, repositoryDirectory);
}
/**
@@ -90,18 +87,15 @@ public class HgChangesetViewer extends AbstractHgHandler
*
*
* @param handler
* @param changesetContext
* @param jaxbContext
* @param context
* @param changesetPagingResultContext
* @param repository
*/
public HgChangesetViewer(HgRepositoryHandler handler,
JAXBContext changesetPagingResultContext,
JAXBContext changesetContext, HgContext context,
JAXBContext jaxbContext, HgContext context,
Repository repository)
{
super(handler, changesetPagingResultContext, context, repository);
this.changesetContext = changesetContext;
super(handler, jaxbContext, context, repository);
}
//~--- get methods ----------------------------------------------------------
@@ -130,8 +124,7 @@ public class HgChangesetViewer extends AbstractHgHandler
env.put(ENV_REVISION_START, Util.EMPTY_STRING);
env.put(ENV_REVISION_END, Util.EMPTY_STRING);
return getResultFromScript(Changeset.class, HgPythonScript.CHANGELOG,
changesetContext, env);
return getResultFromScript(Changeset.class, HgPythonScript.CHANGELOG, env);
}
/**
@@ -249,9 +242,4 @@ public class HgChangesetViewer extends AbstractHgHandler
return getChangesets(null, null, null, null, startNode, endNode);
}
//~--- fields ---------------------------------------------------------------
/** Field description */
private JAXBContext changesetContext;
}

View File

@@ -126,11 +126,8 @@ public class HgRepositoryHandler
try
{
this.browserResultContext = JAXBContext.newInstance(BrowserResult.class);
this.blameResultContext = JAXBContext.newInstance(BlameResult.class);
this.changesetContext = JAXBContext.newInstance(Changeset.class);
this.changesetPagingResultContext =
JAXBContext.newInstance(ChangesetPagingResult.class);
this.jaxbContext = JAXBContext.newInstance(BrowserResult.class,
BlameResult.class, Changeset.class, ChangesetPagingResult.class);
}
catch (JAXBException ex)
{
@@ -225,7 +222,7 @@ public class HgRepositoryHandler
if (TYPE_NAME.equals(type))
{
blameViewer = new HgBlameViewer(this, blameResultContext,
blameViewer = new HgBlameViewer(this, jaxbContext,
hgContextProvider.get(), repository);
}
else
@@ -257,8 +254,7 @@ public class HgRepositoryHandler
if (TYPE_NAME.equals(type))
{
changesetViewer = new HgChangesetViewer(this,
changesetPagingResultContext, changesetContext,
changesetViewer = new HgChangesetViewer(this, jaxbContext,
hgContextProvider.get(), repository);
}
else
@@ -326,8 +322,8 @@ public class HgRepositoryHandler
@Override
public RepositoryBrowser getRepositoryBrowser(Repository repository)
{
return new HgRepositoryBrowser(this, browserResultContext,
hgContextProvider.get(), repository);
return new HgRepositoryBrowser(this, jaxbContext, hgContextProvider.get(),
repository);
}
/**
@@ -474,8 +470,7 @@ public class HgRepositoryHandler
throw new IllegalStateException("directory not found");
}
return new HgChangesetViewer(this, changesetPagingResultContext,
changesetContext, context,
return new HgChangesetViewer(this, jaxbContext, context,
repositoryDirectory);
}
@@ -766,18 +761,9 @@ public class HgRepositoryHandler
//~--- fields ---------------------------------------------------------------
/** Field description */
private JAXBContext blameResultContext;
/** Field description */
private JAXBContext browserResultContext;
/** Field description */
private JAXBContext changesetContext;
/** Field description */
private JAXBContext changesetPagingResultContext;
/** Field description */
private Provider<HgContext> hgContextProvider;
/** Field description */
private JAXBContext jaxbContext;
}