cz.cuni.amis.pogamut.ut2004.tournament.match
Class UT2004MatchExecutor<MATCH extends UT2004Match,RESULT extends UT2004MatchResult>

Package class diagram package UT2004MatchExecutor
java.lang.Object
  extended by cz.cuni.amis.pogamut.ut2004.tournament.match.UT2004MatchExecutor<MATCH,RESULT>
Type Parameters:
MATCH -
RESULT - must be of the same type that the MATCH is producing via UT2004Match.execute().
All Implemented Interfaces:
Runnable, Callable<Map<cz.cuni.amis.utils.token.IToken,RESULT>>

public class UT2004MatchExecutor<MATCH extends UT2004Match,RESULT extends UT2004MatchResult>
extends Object
implements Callable<Map<cz.cuni.amis.utils.token.IToken,RESULT>>, Runnable

UT2004Match executor that will execute one instance of match a time == NO PARALELIZATION HERE!

Please note that executing more than one match on the same UT2004 instance is not considered to be safe because:

  1. GameBots2004.ini file is overwritten during the match execution == different GameBots2004.ini files in match configurations will pose problems
  2. UT2004 (ucc.exe) sometimes hangs if executed multiple times (we do not know why, it should not act that way

If you seek parallelization, consider this:

  1. Separate your matches that has the same GameBots2004.ini configuration (usually you are altering only frag limit and time limit, other things are not configured through GameBots2004.ini
  2. Create multiple UT2004MatchExecutors, each configured with matches of the same config
  3. Use ThreadPoolExecutor, note that this class is implementing Callable so it is easy to create FutureTask out of it and submit the FutureTask into ThreadPoolExecutor.execute(Runnable) and wait for results via FutureTask.get().

Author:
Jimmy

Constructor Summary
UT2004MatchExecutor(MATCH[] matches, Logger log)
           
 
Method Summary
 Map<cz.cuni.amis.utils.token.IToken,RESULT> call()
           
 Map<cz.cuni.amis.utils.token.IToken,Throwable> getExceptions()
          If some match fails, the exception reported is stored within this map.
 Map<cz.cuni.amis.utils.token.IToken,RESULT> getResults()
          This map holds the results of respective matches.
 void run()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UT2004MatchExecutor

public UT2004MatchExecutor(MATCH[] matches,
                           Logger log)
Method Detail

getResults

public Map<cz.cuni.amis.utils.token.IToken,RESULT> getResults()
This map holds the results of respective matches. Immutable.

Returns:

getExceptions

public Map<cz.cuni.amis.utils.token.IToken,Throwable> getExceptions()
If some match fails, the exception reported is stored within this map. Immutable.

Returns:

call

public Map<cz.cuni.amis.utils.token.IToken,RESULT> call()
                                                                           throws Exception
Specified by:
call in interface Callable<Map<cz.cuni.amis.utils.token.IToken,RESULT extends UT2004MatchResult>>
Throws:
Exception

run

public void run()
Specified by:
run in interface Runnable


Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.