Package jason.infra.local
Class RunLocalMAS
java.lang.Object
javax.management.NotificationBroadcasterSupport
jason.infra.local.BaseLocalMAS
jason.infra.local.RunLocalMAS
- All Implemented Interfaces:
RunLocalMASMBean
,javax.management.NotificationBroadcaster
,javax.management.NotificationEmitter
- Direct Known Subclasses:
RunCentralisedMAS
,RunJadeMAS
public class RunLocalMAS extends BaseLocalMAS implements RunLocalMASMBean
Runs MASProject using Local infrastructure.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
RunLocalMAS.LocalAgArchSynchronousScheduled
an agent architecture for the infra based on thread pool -
Field Summary
Fields Modifier and Type Field Description private javax.swing.JButton
btDebug
protected java.util.List<LocalAgArch>
createdAgents
private java.util.concurrent.ExecutorService
executor
private java.util.concurrent.ExecutorService
executorAct
private java.util.concurrent.ExecutorService
executorDeliberate
private java.util.concurrent.ExecutorService
executorSense
protected boolean
isRunning
protected java.util.concurrent.atomic.AtomicBoolean
isRunningFinish
private java.util.Set<LocalAgArch>
sleepingAgs
Fields inherited from class jason.infra.local.BaseLocalMAS
ags, appFromClassPath, control, debug, defaultProjectFileName, dfAg, env, logger, logPropFile, project, runner, stopMASFileName
-
Constructor Summary
Constructors Constructor Description RunLocalMAS()
-
Method Summary
Modifier and Type Method Description protected void
changeToDebugMode()
change the current running MAS to debug modeprotected void
create()
create environment, agents, controllerprotected void
createAgs()
private void
createAgsThreads()
creates one thread per agentprotected void
createButtons()
protected void
createController()
protected void
createEnvironment()
protected void
createNewReplAgButton()
protected void
createPauseButton()
protected void
createReplAg(java.lang.String n)
protected void
createStopButton()
private void
createThreadPool()
creates a pool of threads shared by all agentsvoid
enableDebugControl()
void
finish(int deadline, boolean stopJVM, int exitValue)
protected java.io.InputStream
getDefaultLogProperties()
boolean
hasDebugControl()
protected int
init(java.lang.String[] args)
boolean
isRunning()
boolean
killAg(java.lang.String agName)
static void
main(java.lang.String[] args)
protected java.util.Map<java.lang.String,java.lang.Object>
parseArgs(java.lang.String[] args)
protected void
registerMBean()
protected void
setupDefaultConsoleLogger()
void
setupLogger()
void
setupLogger(java.lang.String confFile)
private static void
showProjectSources(MAS2JProject project)
show the sources of the projectprotected void
start()
start agents, ....protected void
startAgs()
protected void
startSyncMode()
protected void
stopAgs(int deadline)
protected void
waitEnd()
Methods inherited from class jason.infra.local.BaseLocalMAS
addAg, delAg, dfAgExists, dfDeRegister, dfRegister, dfSearch, dfSubscribe, finish, getAg, getAgs, getControllerInfraTier, getDF, getDFAg, getDFAgArch, getEnvironmentInfraTier, getNbAgents, getProject, getRunner, getRuntimeServices, getSubscribers, getWP, isDebug, sendProvider, setProject, setRuntimeServives
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface jason.infra.local.RunLocalMASMBean
getNbAgents
-
Field Details
-
btDebug
private javax.swing.JButton btDebug -
isRunning
protected boolean isRunning -
createdAgents
-
sleepingAgs
-
executor
private java.util.concurrent.ExecutorService executor -
executorSense
private java.util.concurrent.ExecutorService executorSense -
executorDeliberate
private java.util.concurrent.ExecutorService executorDeliberate -
executorAct
private java.util.concurrent.ExecutorService executorAct -
isRunningFinish
protected java.util.concurrent.atomic.AtomicBoolean isRunningFinish
-
-
Constructor Details
-
RunLocalMAS
public RunLocalMAS()
-
-
Method Details
-
hasDebugControl
public boolean hasDebugControl()- Specified by:
hasDebugControl
in classBaseLocalMAS
-
enableDebugControl
public void enableDebugControl()- Specified by:
enableDebugControl
in classBaseLocalMAS
-
main
- Throws:
JasonException
-
registerMBean
protected void registerMBean() -
init
protected int init(java.lang.String[] args) -
parseArgs
protected java.util.Map<java.lang.String,java.lang.Object> parseArgs(java.lang.String[] args) -
create
create environment, agents, controller- Throws:
JasonException
-
start
protected void start()start agents, .... -
isRunning
public boolean isRunning()- Specified by:
isRunning
in classBaseLocalMAS
-
setupLogger
public void setupLogger()- Specified by:
setupLogger
in classBaseLocalMAS
-
setupLogger
public void setupLogger(java.lang.String confFile) -
getDefaultLogProperties
protected java.io.InputStream getDefaultLogProperties() throws java.io.IOException- Throws:
java.io.IOException
-
setupDefaultConsoleLogger
protected void setupDefaultConsoleLogger() -
createButtons
protected void createButtons() -
createPauseButton
protected void createPauseButton() -
createStopButton
protected void createStopButton() -
createNewReplAgButton
protected void createNewReplAgButton() -
createReplAg
protected void createReplAg(java.lang.String n) -
createEnvironment
- Throws:
JasonException
-
createAgs
- Throws:
JasonException
-
createController
- Throws:
JasonException
-
startAgs
protected void startAgs() -
createAgsThreads
private void createAgsThreads()creates one thread per agent -
createThreadPool
private void createThreadPool()creates a pool of threads shared by all agents -
stopAgs
protected void stopAgs(int deadline) -
killAg
public boolean killAg(java.lang.String agName)- Specified by:
killAg
in interfaceRunLocalMASMBean
-
changeToDebugMode
protected void changeToDebugMode()change the current running MAS to debug mode -
startSyncMode
protected void startSyncMode() -
waitEnd
protected void waitEnd() -
finish
public void finish(int deadline, boolean stopJVM, int exitValue)- Specified by:
finish
in interfaceRunLocalMASMBean
- Specified by:
finish
in classBaseLocalMAS
-
showProjectSources
show the sources of the project
-