re: making a singleton servlet

2005-12-06 Thread Magyar, Bence
If you deploy your servlet with an application  deployment scope, you will have 
just one instance of the server classes  instantiated.  Multiple clients can 
still call into your web  service, but you have to make sure that your member 
data is thread-safe.

James Black <[EMAIL PROTECTED]> wrote:  -BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I am going to make my servlet be static, with the hope that it will only
have one instance running, regardless of how many clients connect to it.

My concern is what happens when two clients try to connect at one time.
 Will the second client block, until the servlet is available?

I am planning on having it be multi-threaded to handle several clients,
but I was just curious if the client will block.

I only want one instance because I want to control the number of
database connections, and right now the magic number is one db
connection. I will just queue up the client updates and there will be a
mechanism for them to be informed when the db update is completed.

Thank you.

- --
Corruptisima republica plurimae leges. [The more corrupt a republic, the
more laws.]
Tacitus from Annals III, 116AD
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.0 (MingW32)

iD8DBQFDljy7J/zyYkX46joRAhq7AJ9NF9R+xV8NMsveActW3OTAZB0W2gCghqS+
EwHmAiwiaBQ8wWh6HlDB9SI=
=9o02
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
 Yahoo! Personals
 Skip the bars and set-ups and start using Yahoo! Personals for free

Java client does not re-use TCP/IP connections.

2005-11-29 Thread Magyar, Bence
Sorry,
  I'm quite new with all of this.  I've created a java client to my tomcat web 
service using the Java2WSDL2 utility and WSDL2Java utility.  Correct me if I'm 
wrong, I believe this is called the "stub" client model.  At any rate, my 
main() function in my client looks like:
   
  // get the web service...
   service = new WSDefinitionServiceLocator();
   
   // Now use the service to get a stub to the service
   ws = service.getMyWebService();
  
   Stub s = (Stub) ws;
   s.setMaintainSession(true);
   
  After this is set up, I can correctly call methods on my service such as 
   
  ws.Method1();
  ws.Method2();
   
  For each one of these invocations, my client creates a new TCP/IP connection 
to the service instead of reusing the existing one.  Am I missing some critical 
parameter 
  in my Stub class?  I'm not sure how else to configure the client.  If anyone 
could 
  point me in the right direction, it would be much appreciated. Thanks!
   
  B.M
   
   
  

"Caldarale, Charles R" <[EMAIL PROTECTED]> wrote:  > From: Magyar, Bence 
[mailto:[EMAIL PROTECTED] 
> Subject: RE: web client running out of ports! (timeout exception)
>
> Shouldn't I be getting persistent, reusable connections as 
> the default with HTTP/1.1?

I'm sure you are - but it's the client's responsibility to reuse them;
all the server has to do is expect more traffic on the connection, which
appears to be what it's doing.

- Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
 Yahoo! Music Unlimited - Access over 1 million songs. Try it free.

RE: web client running out of ports! (timeout exception)

2005-11-29 Thread Magyar, Bence
Hi,
   
  You're right, it's probably something screwy with my client.  Not sure what 
it could be though.
   
  In looking at my Tomcat terminal, i see:
   
  INFO: Starting Coyote HTTP/1.1 on http-8080
   
  Shouldn't I be getting persistent, reusable connections as the default with 
HTTP/1.1?
   
  B.M
   
   
  

"Caldarale, Charles R" <[EMAIL PROTECTED]> wrote:  > From: Magyar, Bence 
[mailto:[EMAIL PROTECTED] 
> Subject: web client running out of ports! (timeout exception)
> 
> Every time I call a method, my java client opens a new port!

If I'm understanding the problem correctly, I don't see how changing
anything in the Tomcat configuation will help this anti-social client
behavior. Sounds like you need to fix your client to reuse connections
rather than creating a new one for each request.

- Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
 Yahoo! Music Unlimited - Access over 1 million songs. Try it free.

web client running out of ports! (timeout exception)

2005-11-29 Thread Magyar, Bence
Hello,  I noticed some strange behavior the other day while load testing my simple web service.  First, my environment:  I am running Apache Tomcat 5.5.12 with Axis 1.3 on an XP box.  I've used Java2WSDL and WSDL2Java to generate the necessary bindings.  I used the generated .wsdd file to deploy my service with an "Application" deployment scope and my Java client can call methods on the service the ease.  So far, so good.  By looking at the Axis SOAP monitor, all my messages seem to be getting through fine.  The trouble starts when I begin rapidly calling web service methods within a loop.  The first 3000 calls or so go through fine.  Then I get an Axis Fault: timeout exception.  See the attached is the stack trace.  Why is this happening?  I used the -netstat utility on the machine hosting the web service and noticed that -ea
 ch-
 method call is coming in on a different port!  Every time I call a method, my java client opens a new port!  On XP, the default port range goes from 1024-5000.  Worse yet, each port is in the TIME_WAIT state, meaning that it can't be re-used untill some specified timeout period.  After waiting for 10-20 seconds, Windows frees up all the ports and I can begin happily calling methods again.          I'm not sure why this is happening!  I thought the entire point of HTTP/1.1 was to persist connections.  If I make two calls to the same web service within X seconds of each other, shouldn't TCP/IP use the already established connection?  Especially a connection that is not in use and in the TIME_WAIT state?     I am fairly sure that I need to set the well-known TCP/IP parameter SO_REUSEADDR to true.  I know I can configure Tomcat with the server.xml file, but I could 
 not find
 anything related to this phenomena.  Instead, I see parameters relating to the keepalivetime, etc...My method calls will not be data intensive, but will be making many (thousands) method invocations at once.  Ideally I'd like to have one or two connections to the webservice and re-use them.  Does anyone have any idea how I could configure Tomcat/Axis to perform in this manner?        P.S.. In looking at some Apache source, I noticed that Apache sets the SO_REUSE_ADDR variable, but only in NON-win32 environments!  Is this feature not available in the Windows world?  Thanks for any leads!!!  BM.     
		 Yahoo! Music Unlimited - Access over 1 million songs. Try it free.AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode: 
 faultString: java.net.ConnectException: Connection timed out: connect
 faultActor: 
 faultNode: 
 faultDetail: 
{http://xml.apache.org/axis/}stackTrace:java.net.ConnectException: 
Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:364)
at java.net.Socket.connect(Socket.java:507)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at 
org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:153)
at 
org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:120)
at 
org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191)
at 
org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
at 
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at 
webService.ws.SensorcontrolSoapBindingStub.getCapabilities(SensorcontrolSoapBindingStub.java:305)
at somepackage.Tester$3.mouseDown(Tester.java:275)
at 
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:133)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3080)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java: