@@ -211,51 +211,29 @@ public void run() {
211211 System .out .println (this .getLogStart () + "read valid pdu" );
212212 this .setRemotePeer (asappdu .getPeer ());
213213
214- // process received pdu
215- boolean pduExecuted = false ;
216- /*
217- if(asappdu.getFormat().equalsIgnoreCase(ASAP_1_0.ASAP_MANAGEMENT_FORMAT)) {
218- System.out.println(this.getLogStart()
219- + "got asap management message - let multi-engine handle this one");
220-
214+ try {
215+ this .executor = new ASAPPDUExecutor (asappdu ,
216+ this .is , this .os ,
217+ this .multiASAPEngineFS .getEngineSettings (asappdu .getFormat ()),
218+ protocol ,this );
219+
220+ // get exclusive access to streams
221+ System .out .println (this .getLogStart () + "asap pdu executor going to wait for stream access" );
222+ this .wait4ExclusiveStreamsAccess ();
221223 try {
222- // if return true - message was handled. No further actions required
223- pduExecuted = this.multiASAPEngineFS.handleASAPManagementPDU(asappdu, protocol, is);
224- } catch (ASAPException e) {
225- System.err.println("asap management pdu processing failed - go ahead in read/process loop: "
226- + e.getLocalizedMessage());
227- pduExecuted = false; // failed to execute - forget and go ahead
228- } catch (IOException e) {
229- this.terminate("asap management pdu processing failed", e);
224+ System .out .println (this .getLogStart () + "asap pdu executor got stream access - process pdu" );
225+ this .runObservedThread (executor , maxExecutionTime );
226+ } catch (ASAPExecTimeExceededException e ) {
227+ System .out .println (this .getLogStart () + "asap pdu processing took longer than allowed" );
228+ this .terminate ("asap pdu processing took longer than allowed" , e );
230229 break ;
230+ } finally {
231+ // wake waiting thread if any
232+ this .releaseStreamsLock ();
233+ System .out .println (this .getLogStart () + "asap pdu executor release locks" );
231234 }
232- }
233- */
234- if (!pduExecuted ) { // not (completely executed by multi engine
235- try {
236- this .executor = new ASAPPDUExecutor (asappdu ,
237- this .is , this .os ,
238- this .multiASAPEngineFS .getEngineSettings (asappdu .getFormat ()),
239- protocol ,this );
240-
241- // get exclusive access to streams
242- System .out .println (this .getLogStart () + "asap pdu executor going to wait for stream access" );
243- this .wait4ExclusiveStreamsAccess ();
244- try {
245- System .out .println (this .getLogStart () + "asap pdu executor got stream access - process pdu" );
246- this .runObservedThread (executor , maxExecutionTime );
247- } catch (ASAPExecTimeExceededException e ) {
248- System .out .println (this .getLogStart () + "asap pdu processing took longer than allowed" );
249- this .terminate ("asap pdu processing took longer than allowed" , e );
250- break ;
251- } finally {
252- // wake waiting thread if any
253- this .releaseStreamsLock ();
254- System .out .println (this .getLogStart () + "asap pdu executor release locks" );
255- }
256- } catch (ASAPException e ) {
257- System .out .println (this .getLogStart () + " problem when executing asap received pdu: " + e );
258- }
235+ } catch (ASAPException e ) {
236+ System .out .println (this .getLogStart () + " problem when executing asap received pdu: " + e );
259237 }
260238 }
261239 }
0 commit comments