Supermap iserverjava 6R extended field development and stress testing-points of judgment in that area (1)

Source: Internet
Author: User

Today, I suddenly gave a task to put the test point on the plane.AlgorithmAnd then publish it through Supermap iserverjava 6R to test the concurrent access performance. I haven't gotten any results for a long time. Java is suddenly a little messy. I have a beard and an eyebrow, but the idea is clear. I will record it for future search.

Overall Test ideas

1. Open rest interfaces in the extended domain.

(1) extended component.

 Extended component  Package Com. Zhangwei. Extend; Import Java. util. List; Import Com. Supermap. Services. components. component; Import Com. Supermap. Services. components. componentcontext; Import Com. Supermap. Services. components. componentcontextaware; Import Com. Supermap. Services. components. commontypes. feature; Import Com. Supermap. Services. components. commontypes. geometry; Import Com. Supermap. Services. components. SPI. dataprovider; @ component (providertypes = {dataprovider. Class }, Optional = False , Type ="  ") Public   Class Inwithcomponent Implements Componentcontextaware { // Data provider      Private Dataprovider =Null ; /*** Constructor */      Public Inwithcomponent (){} /***** Train of thought: * 1. query the data of the corresponding ID from the dataset. Now we assume that one vertex has multiple surface objects. * 2. Determine whether the vertex is in the object ry. */      Public Geometry inwithstring (string datasourcenamer, string datasetnamer, Int [] Idsr, string datasourcenamep, string datasetnamep, Int [] IDSP) {list <feature> listfeaturelistr = dataprovider. getfeature (datasourcenamer, datasetnamer, idsr, Null ); List <feature> listfeaturelistp = dataprovider. getfeature (datasourcenamep, datasetnamep, IDSP,Null ); Int Geometrylength = listfeaturelistr. Size (); Int I = 0; // Whether it is a result identifier          Boolean Flag = False ; While (I <geometrylength ){ If (Geometry. ispointinpolygon (listfeaturelistp. Get (0). Geometry. Points [0], listfeaturelistr. Get (I). Geometry) {flag = True ; // System. Out. println (flag + ""); }Else {Flag = False ;} I ++ ;} Return Listfeaturelistr. Get (I-1). geometry ;} /***** Context */      Public   Void Setcomponentcontext (componentcontext context) {list <Object> providers = context. getproviders (object. Class ); If (Providers! = Null ){ For (Object provider: providers ){If (Provider Instanceof Dataprovider ){ This . Dataprovider = (dataprovider) Provider ;}}}}}

(2) extended service interface, because it is a test, there is no restlet or JAX-RS here, In order to simulate the impact of data transmission on the server, so directly added parameter resolution and return results, it is actually just a test.

 Extended Interface  Package Com. Zhangwei. Extend; Import Java. Io. ioexception; Import Java. Io. printwriter; Import Java. util. List; Import Java. util. Random;Import Javax. servlet. servletexception; Import Javax. servlet. http. httpservlet; Import Javax. servlet. http. httpservletrequest; Import Javax. servlet. http. httpservletresponse; Import Com. Supermap. Services. interface; Import Com. Supermap. Services. interfacecontext; Import Com. Supermap. Services. interfacecontextaware; Import Com. Supermap. Services. components. commontypes. geometry; @ interface (componenttypes = {inwithcomponent. Class }, Optional = False , Multiple = False ) Public   Class Iswithinservlet Extends Httpservlet Implements Interfacecontextaware { Private   Static   Final   Long Serialversionuid = 1l; Private Inwithcomponent = Null ;Private String id = Null ; Public Iswithinservlet (){ This . ID = string. valueof (system. currenttimemillis ());} Public   Void Doget (httpservletrequest request, httpservletresponse response) Throws Ioexception, servletexception {printwriter out; response. setcontenttype (" Text/html; charsets = UTF-8 "); Response. setcharacterencoding (" UTF-8 "); Request. getparameter ("In "). Tostring (); out = response. getwriter (); Int [] Idsr = New   Int [2]; idsr [0] = generaterandom (); idsr [1] = generaterandom ); Int [] IDSP = New   Int [1]; IDSP [0] = generaterandom (1,163); geometry = inwithcomponent. inwithstring (" World "," Ocean ", Idsr ," World "," Capitals ", IDSP); Out. Print (" [6390, 4883,4882, 183,7136, 7135,181,180,298, 4578,4577] "+ Geometry. ID); Out. Close ();} Protected   Void Dopost (httpservletrequest request, httpservletresponse response) Throws Servletexception, ioexception {} Public   Void Setinterfacecontext (interfacecontext context ){ This . Getservletcontext (). setattribute ( This . ID +" Interfacecontext ", Context); List <Object> components = context. getcomponents (object. Class ); If (Components! = Null ){ For (Object component: Components ){ If (Component Instanceof Inwithcomponent ){ This . Inwithcomponent = (inwithcomponent) component; Break ;}}}}/*** How to obtain a random number within a certain range in Java * @ Param A * @ Param B * @ return */      Public   Static   Int Generaterandom ( Int A, Int B ){ Int Temp = 0; Try { If (A> B) {temp = New Random (). nextint (a-B ); Return Temp + B ;}Else {Temp = New Random (). nextint (B-); Return Temp + ;}} Catch (Exception e) {e. printstacktrace ();} Return Temp + ;}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.