Hi,
I would like to know the meaning of the property “IsMultiThreadDisabled” of LayerOverlay class because the documentation doesn’t mention anything relevant.
What I know about that property is that I can inherit from LayerOverlay class and get the values passed by the client on HTTP requests to the server (specifically, HttpContext.Current) if it’s set to false. If I set it to true, then, I cannot access the current HTTP request values passed by the client. It seems like there is some kind of THREAD switch. The thread that is used to process image drawing of LayerOverlay class is not the one that ASP .NET uses to process HTTP requests.
With this, we cannot access same parameters passed by client side!?
Can you give some feedback.
Best regards,
BdaF
LayerOverlay - IsMultiThreadDisabled Property
Hi Bruno,
The "IsMultiThreadDisabled" property is used to switch TileResource on server, if value is true, tile request will be handled by SingleThreadTileResource. And if the value is false, which is the default value, the request will be handled by TileResource, then process request with multi thread. For both of them, We can access current HTTP request values passed by client.
And image will be drawn when requestion processing, then save the image and return to client by HttpContext.Response.
Any other question please feel free to let us know.
Thanks,
Kevin
Hi Kevin,
When you mention “…And if the value is false, which is the default value, the request will be handled by TileResource, then process request with multi thread…”, are you saying that the rendering of one tile is done by multiple threads? From a previous analysis that we posted on the following item thinkgeo.com/forums/MapSuite…fault.aspx, that doesn’t seem to happen!
Nonetheless, we get an error accessing HttpContext.Current… object at runtime when feature layer is configured with IsMultiThreadDisabled = “false”. If we set it to “true” then, the HttpContext.Current is set. You can do a simple test, define the following class:
public class CustomLayerOverlay : LayerOverlay
{
protected override void DrawCore(GeoCanvas canvas, object nativeImage, RectangleShape canvasExtent, GeographyUnit mapUnit){
String entQueryString = HttpContext.Current.Request.QueryString[“ENT”];
base.DrawCore(canvas, nativeImage, canvasExtent, mapUnit);
}
}
Just add an instance of that class to the map with a layer configured with “IsMultiThreadDisabled” set to “false” and another one with “true” and check the results!? We are using TG 8.0.0.0.
This is not the first time that we face a kind of problem that forces us to rethink our architecture decisions…
Can you check this please?
Best regards,
BdaF
Hi Bruno,
Sorry for my reply confuse you. Actually, for one tile, both modes are rendering in a single thread, because when processing tile request in MultiThreadTileResource, ProcessRequest method will call image generation method of SingleThreadTileResource asynchronously. The mainly difference between the two modes is, MultiThreadTileResource implements the IHttpAsyncHandler while SingleThreadTileResource implements the IHttpHandler. Here is code snippet from MultiThreadTileResource:
protected
virtual
IAsyncResult BeginProcessRequestCore(HttpContext context, AsyncCallback cb,
object
extraData)
{
ProcessRequestDelegate processRequestMethod =
new
ProcessRequestDelegate(
new
SingleThreadTileResource().ProcessRequest);
return
processRequestMethod.BeginInvoke(context, cb, extraData);
}
As you can see, the MultiThreadTileResource only create another thread to execute ProcessRequest() of SingleThread asynchronously. Then the request is complete, the HttpContext.Current comes to null. But the tile image is still generating in another thread. So if you want to access the HttpContext, please try disable the multiple thread.
Hope this would be helpful and any other question please feel free to let us know.
Thanks,
Kevin
Hi Kevin,
We have configured the layer with IsMultiThreadDisable = true and it seems like it solves our problem and keeps the same behavior.
Thanks,
BdaF
Hi BdaF,
I am glad to hear that solved. Any question please feel free to let us know.
Regards,
Kevin