39     bool start(
Job* job, 
const shared_ptr<MetaIdentifier>& mid)
    41         boost::mutex::scoped_lock lock(runningMutex);
    43             if (j->getIdentifier() == mid)
    52     bool start(
Job* job, 
const shared_ptr<TileIdentifier>& ti, 
const shared_ptr<HttpRequest>& r)
    54         boost::mutex::scoped_lock lock(runningMutex);
    56             if (j->getIdentifier()->contains(ti)) {
    69         boost::mutex::scoped_lock lock(runningMutex);
    84                                 const shared_ptr<Geodata>& 
data,
    85                                 const shared_ptr<Renderer>& 
renderer,
    86                                 const shared_ptr<Cache>& 
cache,
    87                                 const shared_ptr<StylesheetManager>& 
ssm )
    98     for (
int i = 0; i < threads; ++i) {
    99         auto worker = boost::make_shared<boost::thread>(
   100             boost::bind(&boost::asio::io_service::run, &
jobPool)
   103         factories.push(boost::make_shared<RenderCanvasFactory>());
   116     LOG_SEV(request_log, debug) << 
"RequestManager destructed";
   173             LOG_SEV(request_log, error) << 
"Trying to run a job, but there is none.";
   190     shared_ptr<TileIdentifier> ti;
   197         LOG_SEV(request_log, info) << 
"MalformedURLException: "   198             << e.
what()  << 
" Url: " << req->getURL();
   204         LOG_SEV(request_log, info) << 
"UnknownImageFormatException: "   205             << e.
what()  << 
" Url: " << req->getURL();
   217     shared_ptr<RenderCanvasFactory> factory = 
factories.front();
   221     shared_ptr<RenderCanvas> canvas = factory->getCanvas(ti->getImageFormat());
   223     Job job(mid, 
config, shared_from_this(), canvas);
   226     if (
running->start(&job, ti, req))
   244     boost::mutex::scoped_lock preLock(
preRJMutex);
   254     shared_ptr<RenderCanvasFactory> factory = 
factories.front();
   258     shared_ptr<RenderCanvas> canvas = factory->getCanvas(mid->getImageFormat());
   260     Job job(mid, 
config, shared_from_this(), canvas);
   277         std::vector<shared_ptr<MetaIdentifier>> children;
   278         mid->getSubIdentifiers(children);
   279         for (
auto& c : children)
   289         int elapsed_seconds = std::chrono::duration_cast<std::chrono::seconds>
   291         LOG_SEV(request_log, info) << 
"Prerendering finished in "   292             << std::setfill(
'0') << std::setw(2) << elapsed_seconds / 60 << 
":" << elapsed_seconds % 60;
 
shared_ptr< Geodata > data
 
void addRequest(const shared_ptr< HttpRequest > &req, const shared_ptr< TileIdentifier > &id)
 
TESTABLE shared_ptr< StylesheetManager > getStylesheetManager() const 
Returns the StylesheetManager. 
 
std::vector< shared_ptr< boost::thread > > workers
 
virtual const char * what() const 
 
bool nextUserRequest()
Selects the next Job and runs it process Method. 
 
boost::mutex factoriesMutex
 
void stop()
stops all jobs 
 
void processNextRequest()
Selects the next Job and runs it process Method. 
 
std::queue< shared_ptr< HttpRequest > > userRequests
 
TESTABLE void enqueue(const shared_ptr< HttpRequest > &r)
Enqueues the HttpRequest. 
 
This file is part of alaCarte. 
 
std::queue< shared_ptr< RenderCanvasFactory > > factories
 
std::chrono::system_clock::time_point prerender_stop
 
RequestManager(const shared_ptr< Configuration > &config, const shared_ptr< Geodata > &data, const shared_ptr< Renderer > &renderer, const shared_ptr< Cache > &cache, const shared_ptr< StylesheetManager > &ssm)
Constructs a new RequestManager with the given parameters. 
 
bool start(Job *job, const shared_ptr< TileIdentifier > &ti, const shared_ptr< HttpRequest > &r)
 
Abstract Class which computes Tiles by a given TileIdentifier. 
 
#define LOG_SEV(log, lvl)
 
shared_ptr< Cache > cache
 
bool nextPreRenderRequest()
 
bool start(Job *job, const shared_ptr< MetaIdentifier > &mid)
 
TESTABLE shared_ptr< Geodata > getGeodata() const 
Returns the Geodata. 
 
shared_ptr< Configuration > config
 
boost::mutex runningMutex
 
std::queue< shared_ptr< MetaIdentifier > > preRenderRequests
 
static const char * max_queue_size
Maximum size for the queue (type: int) 
 
shared_ptr< Renderer > renderer
 
boost::asio::io_service::work preventStop
 
TESTABLE shared_ptr< Renderer > getRenderer() const 
Returns the Renderer. 
 
TESTABLE shared_ptr< Cache > getCache() const 
Returns the Cache. 
 
boost::asio::io_service jobPool
 
std::chrono::system_clock::time_point prerender_start
 
void process()
Computes a all tiles contained in the MetaIdentifier. 
 
static shared_ptr< TileIdentifier > Create(const string &url, shared_ptr< StylesheetManager > StylesheetManager, const shared_ptr< Configuration > &config)
Constructs a new TileIdentifier with the given url. 
 
shared_ptr< StylesheetManager > ssm
 
static const char * num_threads
Option to get number of worker threads (type: int) 
 
~RequestManager()
Stops the io_service, joins all Threads and destructs the RequestManager. 
 
static const char * prerender_level
Option to get the timeout for request-processing (type: int) 
 
scoped_ptr< RunningQueue > running
 
unsigned int currentPrerenderingThreads