Solved

Servlets priority

Posted on 2003-11-16
6
447 Views
Last Modified: 2013-11-24
Hi all
Is it possible to priorities servlets?
I have two different servlets, I want to be able to control which clients handled first.
One of the servlets is more important.
0
Comment
Question by:dannysh
  • 3
  • 2
6 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 40 total points
ID: 9758760
The servlets will be called in the order your program flow decides. If you mean can you prioritise the order in which they load on startup then you can change the loadonstartup tag of the servlet in your web.xml. The lower the figure the earlier the load. Here's an example:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
 <servlet>
  <servlet-name>deegreewms</servlet-name>
  <servlet-class>org.deegree_impl.enterprise.WMSServlet</servlet-class>
  <init-param>
   <param-name>capabilities</param-name>

<param-value>file:///C:/daten/software/geotools/deegreewms/WEB-INF/xml/sample_wms_capabilities.xml</param-value>

  </init-param>
  <init-param>
   <param-name>debug</param-name>
   <param-value>ERRORS_AND_COMMENTS</param-value>
  </init-param>
  <load-on-startup>
   1
  </load-on-startup>
 </servlet>
 <servlet-mapping>
  <servlet-name>deegreewms</servlet-name>
  <url-pattern>/wms</url-pattern>
 </servlet-mapping>
</web-app>


0
 
LVL 92

Expert Comment

by:objects
ID: 9759799
Am not aware of anything to achieve that, and thinking I'm not sure how you would achive it. Generally client requests are recieved by the server sequentially and each processed seperately, they don't wait for the previous request to be handled.
What is it exactly that you'd like to do instead?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9760025
If you're looking for a processing 'pipeline'  methodology/pattern, then a sequence of Struts Action may fit the bill
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 92

Expert Comment

by:objects
ID: 9761998
load-on-startup has nothing to do with priority of client requests.
0
 

Author Comment

by:dannysh
ID: 9762033
Hi Objects yes I know.
I close this question by mistake, sorry. I will open it again

http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_20800063.html
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9763244
>>load-on-startup has nothing to do with priority of client requests.

I hope you or dannysh didn't think that I suggested that ;-)
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question