private Agent createAgent ( Task forTask ) { logger . debug ( "Creating new agent for task {}" , forTask . getClass ( ) . getSimpleName ( ) ) ; Agent agent = null ; try { agent = lookupAgent ( forTask ) ; if ( agent != null ) { // register us in agent.. agent . setAgentService ( this ) ; } } catch ( Throwable t ) { t . printStackTrace ( ) ; } return ( agent ) ; }
Creates a new agent for the given Task . Note that the agent must be started manually after creation .