RE: Thread pool samples

2008-09-03 Thread Reginald.Javier
You can try looking at : http://commons.apache.org/pool/

Reginald Javier
Software Engineer II, Strategic Customer Solutions Implementation
T: +632-859-5442
-Original Message-
From: Zoran Avtarovski [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 04, 2008 12:44 PM
To: Struts Users Mailing List
Subject: OT: Thread pool samples

I¹m trying to implement a simple thread pool model (Java 1.4) for a
telemetry application.

I¹m getting up to speed with threads but I haven¹t been able to find any
examples of setting a thread pool in a server/servlet environment.

I have a number of remote units which upload telemetry data for processing
via http and receive instructions via the response. The instructions aren¹t
dependent on the results of data processing. At present I fire off a new
thread to process the data for each unit, but it makes sense the best
approach would be to have a fixed pool of threads and then add the data to a
queue which is processed by the pool of threads.

It¹s setting up the initial pool that I¹m a little unclear about. Do I setup
a Threadpool servlet and set it to load on startup and store the pool in the
application scope?

Any advice or pointers to some good information would be appreciated.

Z.

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



RE: Background Threads

2008-07-28 Thread Reginald.Javier
Hi Dave,

You can just create any class that extends the Thread object or implements the 
runnable interface. The required method, run(), should abstract what u want to 
do, (connect to the 3rd party server). Instantiate that class then call its 
start() method from the Struts action that should trigger it. Your action 
should finish safely without waiting for that thread to finish. Note: this is 
just a bare implementation, you might want to consider using thread pooling to 
manage your resources. What exactly do you intend to do? Will you wait for a 
response from your HTTPS server?

Reginald Javier
Software Engineer II, Strategic Customer Solutions Implementation
T: +632-859-5442
-Original Message-
From: dave.smith [mailto:[EMAIL PROTECTED]
Sent: Monday, July 28, 2008 11:45 PM
To: user@struts.apache.org
Subject: Re: Background Threads


I forgot to mention that I am using Struts 1.1.


dave.smith wrote:
>
> I have a function that POSTs data to a third party HTTPS server:  void
> postData(String sURL, String sData);
>
> I need to call this function as a background thread from an Action class,
> so that the user doesn't have to wait on the connection to establish.  How
> can I safely call this function so that it becomes a background thread?
>
> Thanks,
> Dave
>

--
View this message in context: 
http://www.nabble.com/Background-Threads-tp18691709p18691741.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


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



RE: [OT] Scheduled DB clean up service with Spring

2008-04-15 Thread Reginald.Javier
Hi Peter,

Please try adding the quartz.jar or spring-quartz.jar to your classpath. You 
can check out http://www.springframework.org for the dependencies of the spring 
version you're using.

Pls don't add anymore jars at the moment. Also, I would suggest reverting your 
original classpath settings prior to testing the above, to isolate issues.

Reginald Javier

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 16, 2008 4:10 AM
To: Struts Users Mailing List
Subject: Re: [OT] Scheduled DB clean up service with Spring

Hi all,

sorry to continue with that OT thread, but its starting to get
really mad out here. But first of all, thanks for the hint that
the runtime classpath (rcp) has to be configured independently.
Well, I tried that but it ended up in a mess!

Of course, first thing I did was adding spring.jar to rcp of the
Apache... and I was awating the startup of my Webapp
joyfully. The joy ended quite soon with the following message
below (***)

Then I added servlet-api.jar to the rcp and another exception.
For every exception I got, I added a new (corresponding) jar
file. This ended up in a NullPointerEx. I guess thats because
the order of the jar files is also important.
However, to add those jars to the rcp, I added them in the
Run Dialog under Classpath, first I tried that under "User
Entries" and then under "Bootstrap Entries" in different permutations
and so on and so on. Happy trial and error.
But after some hours I have to admint: that doesnt make sense
any longer.

Can it be so difficult to use load class of the Spring Lib at runttime
and create it as a bean?
 >>>

<<<
If I omit this line, I have no problem to start the app at all!
In that case, my webApp works perfectly with default config:
Bootstrap Entries: JRE System Lib  jre_1.6.0_5
User Entries: bootstrap.jar

How can I find out what the required jar files are to add to the rcp
except Spring.jar and in which order do I have to provide them.
Which of them have to be in "Bootstrap Entries" and which one in
"User Entries"?

Could anybody point me to the rigth direction, please?
I have lost the rigth path ;-)

Thanks and best regards
Peter

PS: sorry if my question is not formulated professional,
Im quite new to all that JavaWebFramework stuff.

 >>>  (***)
java.lang.NoClassDefFoundError: javax/servlet/ServletContextListener
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1275)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206)
at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3786)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at
org.apache.catalina.core.StandardService.start(StandardService.java:516)
at
org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.ClassNotFoundException:
javax.servlet.ServletContextListener
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 28 more
<<<


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