This is the mail archive of the
frysk@sources.redhat.com
mailing list for the frysk project.
Patch: minor efficiency improvement in Host
- From: Tom Tromey <tromey at redhat dot com>
- To: Frysk Hackers <frysk at sourceware dot org>
- Date: 07 Sep 2006 18:22:25 -0600
- Subject: Patch: minor efficiency improvement in Host
- Reply-to: tromey at redhat dot com
Andrew got me cvs write access but I'm not comfortable simply
committing stuff yet. I'd prefer to get "ok"s for things more
complicated than typo fixes.
This patch makes a couple anonymous classes from 'Host' slight more
efficient. The compiler will already generate fields in an anonymous
class to capture 'final' variables from the method which are used in
the anonymous class body.
Having an explicit field is only needed if it will be modified in the
anonymous class. Otherwise we're just duplicating things for no benefit.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* Host.java (requestRefreshXXX): Remove extra field from anonymous
class.
(requestCreateAttachedProc): Likewise.
Index: Host.java
===================================================================
RCS file: /cvs/frysk/frysk-core/frysk/proc/Host.java,v
retrieving revision 1.40
diff -u -r1.40 Host.java
--- Host.java 7 Sep 2006 23:59:05 -0000 1.40
+++ Host.java 8 Sep 2006 00:15:18 -0000
@@ -176,12 +176,11 @@
* refreshing the internal structure to match. Optionally refresh
* each processes task list.
*/
- public void requestRefreshXXX (final boolean refreshAllArg)
+ public void requestRefreshXXX (final boolean refreshAll)
{
logger.log (Level.FINEST, "{0} requestRefreshXXX boolean\n", this);
Manager.eventLoop.add (new HostEvent ("RequestRefresh")
{
- boolean refreshAll = refreshAllArg;
public void execute ()
{
newState= oldState ().handleRefresh (Host.this, refreshAll);
@@ -191,24 +190,19 @@
/**
* Request that a new attached and running process be created.
*/
- public final void requestCreateAttachedProc (final String stdinArg,
- final String stdoutArg,
- final String stderrArg,
- final String[] argsArg,
+ public final void requestCreateAttachedProc (final String stdin,
+ final String stdout,
+ final String stderr,
+ final String[] args,
final TaskObserver.Attached attachedObserver)
{
logger.log (Level.FINE, "{0} requestCreateAttachedProc\n", this);
Manager.eventLoop.add (new HostEvent ("requestCreateAttachedProc")
{
- String stdin = stdinArg;
- String stdout = stdoutArg;
- String stderr = stderrArg;
- String[] args = argsArg;
- TaskObserver.Attached attached = attachedObserver;
public void execute ()
{
newState= oldState ().handleCreateAttachedProc
- (Host.this, stdin, stdout, stderr, args, attached);
+ (Host.this, stdin, stdout, stderr, args, attachedObserver);
}
});
}