|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.pogamut.server.UCCWrapper
public class UCCWrapper
Wrapper of running instance of UCC server. Implements pooling of instances.
Usage scenario is:
UCCWrapper ucc = UCCWrapper.create();
...
ucc.release();
The location of UCC executabe will be determined by an environment variable
pogamut.unreal.home (e.g. c:\Games\UT2004). The property cam be set via java ...
-Dpogamut.unreal.home=c:\Games\UT2004
Nested Class Summary | |
---|---|
class |
UCCWrapper.ScannerSink
Scanns the output of UCC for some specific srings (Ports bounded. |
protected class |
UCCWrapper.StreamSink
Reads content of the stream and discards it. |
Field Summary | |
---|---|
protected static int |
basePort
First port assigned to a ucc instance. |
protected int |
controlPort
|
protected static int |
fileCounter
Counter of files with ports. |
protected java.lang.String |
gameType
One of BotAPI.* modes |
protected int |
gbPort
|
protected long |
killAfter
Time in miliseconds for which the unused instance will remain in the pool of servers. |
protected java.lang.String |
mapName
|
protected static java.lang.Integer |
nextUccWrapperUID
|
protected java.util.Timer |
poolCleanerTimer
Timer executing tasks for cleaning pool of UCC servers. |
private static java.lang.Object |
poolRetrievalLock
Lock used when retrieving existing node from the pool. |
protected boolean |
released
Was this instance already released? |
static long |
stamp
|
protected java.util.TimerTask |
terminationTask
Task that will remove this timer from the pool. |
static java.lang.String |
UCC_EXEC
Constant for environment variable with ucc executable. |
protected java.util.logging.Logger |
uccLog
Loger containing all output from running instance of UCC. |
protected static java.util.Collection<UCCWrapper> |
uccPool
Pool of unused ucc servers, it takes some time to start new ucc server so it is convenientto keep unused instances in this pool. |
(package private) java.lang.Process |
uccProcess
|
protected static java.util.Collection<UCCWrapper> |
uccUnreleased
List of unreleased UCC instances. |
protected int |
uccWrapperUID
ID of the wrapper object. |
static java.lang.String |
UNREAL_HOME
Constant for environment variable with path to the Unreal home dir. |
protected UTServer |
utServer
|
Constructor Summary | |
---|---|
protected |
UCCWrapper(java.util.logging.Logger parent)
Creates new instance ith default parrent logger |
Method Summary | |
---|---|
protected void |
close()
Removes the UCC from the pool and terminates it. |
static UCCWrapper |
create()
Returns instance of UCC server that is not in use. |
static UCCWrapper |
create(java.util.logging.Logger parent)
Returns instance of UCC server that is not in use. |
static UCCWrapper |
create(long maxTimeInPool)
Returns instance of UCC server that is not in use. |
static UCCWrapper |
create(long maxTimeInPool,
java.util.logging.Logger parent)
Returns instance of UCC server that is not in use. |
int |
getControlPort()
|
int |
getGbPort()
|
java.util.logging.Logger |
getLogger()
|
java.lang.Process |
getProcess()
|
protected static java.lang.String |
getUnrealHome()
|
UTServer |
getUTServer()
|
protected void |
initUCCWrapper()
|
void |
kill()
|
void |
release()
This informs UCC that you dont want to use it in the future. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.logging.Logger uccLog
public static final java.lang.String UNREAL_HOME
public static final java.lang.String UCC_EXEC
protected static java.util.Collection<UCCWrapper> uccPool
protected static java.util.Collection<UCCWrapper> uccUnreleased
protected java.util.Timer poolCleanerTimer
protected java.util.TimerTask terminationTask
protected static int fileCounter
java.lang.Process uccProcess
protected int gbPort
protected int controlPort
protected UTServer utServer
protected static final int basePort
protected static java.lang.Integer nextUccWrapperUID
protected int uccWrapperUID
protected java.lang.String mapName
protected java.lang.String gameType
public static long stamp
protected long killAfter
private static java.lang.Object poolRetrievalLock
protected boolean released
Constructor Detail |
---|
protected UCCWrapper(java.util.logging.Logger parent) throws UCCStartException
parent
- Parent logger for sending UT messages. Can be null.
UCCStartException
Method Detail |
---|
public java.util.logging.Logger getLogger()
public UTServer getUTServer()
protected static java.lang.String getUnrealHome()
public static UCCWrapper create(long maxTimeInPool) throws UCCStartException
maxTimeInPool
- Time in miliseconds for which the unused instance
will remain in the pool of servers.
UCCStartException
public static UCCWrapper create(long maxTimeInPool, java.util.logging.Logger parent) throws UCCStartException
maxTimeInPool
- Time in miliseconds for which the unused instance will remain in the pool of servers.parent
- Parent logger for logging UCC output. Can be null.
UCCStartException
public static UCCWrapper create() throws UCCStartException
UCCStartException
public static UCCWrapper create(java.util.logging.Logger parent) throws UCCStartException
parent
- Parent logger for logging UCC output. Can be null.
UCCStartException
protected void initUCCWrapper() throws UCCStartException
UCCStartException
public java.lang.Process getProcess()
public void kill()
protected void close()
public void release()
public int getGbPort()
public int getControlPort()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |