Mtom Jee DataHandler - new thread creation

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Mtom Jee DataHandler - new thread creation

forums
I am using MTOM to stream the content of some file to the client side via a
WebSevice. The front end call a WS on a backend server and the file is
streamed to the client. However the app is a JEE environment (weblogic)...and
as far as i know it is not allowed (or considered a good practice to create
new threads) but the code of the DataHandler used by MTOM does that : //
there is none but the default^^^^^^^^^^^^^^^^ 252 final DataContentHandler
fdch = dch; 253 254 // from bill s. 255 // ce n'est pas une pipe! 256 // 257
// NOTE: This block of code needs to throw exceptions, but 258 // can't
because it is in another thread!!! ARG! 259 // 260 final PipedOutputStream
pos = new PipedOutputStream(); 261 PipedInputStream pin = new
PipedInputStream(pos); 262 new Thread( 263 new Runnable() { 264 public void
run() { 265 try { 266 fdch.writeTo(object, objectMimeType, pos); 267 } catch
(IOException e) { 268 269 } finally { 270 try { 271 pos.close(); 272 } catch
(IOException ie) { } 273 } 274 } 275 }, 276
"DataHandler.getInputStream").start(); 277 ins = pin;
http://www.docjar.org/html/api/javax/activation/DataHandler.java.html
http://docs.oracle.com/javaee/1.4/api/javax/activation/DataHandler.html So
using MTOM and with streaming is safe in JEE ...the fact that new threads are
created not by the container might not be dangerous ? Thanks

--

[Message sent by forum member 'csergiu77']

View Post: http://forums.java.net/node/895664