@@ -149,17 +149,18 @@ private Message decryptIfNecessary(ICryptoService cryptoService, Message message
149149
150150 private void handleWithReply (IDaemonHandler handler , InterconnectResponseContext context ) throws Exception {
151151 try {
152- final InterconnectObject responseIco = this .handleRequest (handler , context .getCreateResponseMethod (),
153- context .getReceivedContext ().getRequestIco ());
152+ final InterconnectObject responseIco = this .handleRequest (handler , context .getCreateResponseMethod (), context .getReceivedContext ().getRequestIco ());
154153 context .setResponseICO (responseIco );
155154 if (this .duration (context ) == HandlingDurationType .TIMEOUT ) {
156155 return ;
157156 }
158157 this .reply (context );
159158 } catch (final DaemonError e ) {
160- this .getLogger ().debug ("DaemonError for " + context .getCreateResponseMethod ().getMethod ().getName () + "(" +
161- context .getReceivedContext ().getIcoClass ().getSimpleName () + ")" + " with " +
162- de .taimos .dvalin .interconnect .model .InterconnectContext .getContext (), e );
159+ if (e .getNumber ().get () < 0 ) {
160+ this .getLogger ().error ("DaemonError for " + context .getCreateResponseMethod ().getMethod ().getName () + "(" + context .getReceivedContext ().getIcoClass ().getSimpleName () + ")" + " with " + de .taimos .dvalin .interconnect .model .InterconnectContext .getContext (), e );
161+ } else {
162+ this .getLogger ().debug ("DaemonError for " + context .getCreateResponseMethod ().getMethod ().getName () + "(" + context .getReceivedContext ().getIcoClass ().getSimpleName () + ")" + " with " + de .taimos .dvalin .interconnect .model .InterconnectContext .getContext (), e );
163+ }
163164 this .sendErrorResponse (e , context );
164165 }
165166 }
@@ -175,13 +176,9 @@ private void sendErrorResponse(DaemonError e, InterconnectResponseContext contex
175176 }
176177
177178 private void updateThreadContext (InterconnectResponseContext context ) throws Exception {
178- de .taimos .dvalin .interconnect .model .InterconnectContext .setUuid (
179- ADaemonMessageHandler .getUuid (context .getReceivedMessage (),
180- context .getReceivedContext ().getIcoClass ()));
181- de .taimos .dvalin .interconnect .model .InterconnectContext .setDeliveryCount (
182- this .getDeliveryCount (context .getReceivedMessage ()));
183- de .taimos .dvalin .interconnect .model .InterconnectContext .setRedelivered (
184- context .getReceivedMessage ().getJMSRedelivered ());
179+ de .taimos .dvalin .interconnect .model .InterconnectContext .setUuid (ADaemonMessageHandler .getUuid (context .getReceivedMessage (), context .getReceivedContext ().getIcoClass ()));
180+ de .taimos .dvalin .interconnect .model .InterconnectContext .setDeliveryCount (this .getDeliveryCount (context .getReceivedMessage ()));
181+ de .taimos .dvalin .interconnect .model .InterconnectContext .setRedelivered (context .getReceivedMessage ().getJMSRedelivered ());
185182 Class <? extends IVO > ivoClass ;
186183 if (context .getReceivedContext () instanceof IVO ) {
187184 ivoClass = ADaemonMessageHandler .uncheckedCast (context .getResponseICO ());
@@ -192,20 +189,15 @@ private void updateThreadContext(InterconnectResponseContext context) throws Exc
192189 private static DaemonMethod getDaemonMethod (RegistryEntry registryEntry , InterconnectResponseContext context ) throws Exception {
193190 final DaemonMethod method = registryEntry .getMethod ();
194191 if (method .isSecure () != context .getReceivedContext ().isSecure ()) {
195- throw new Exception (
196- "Insecure call (is " + context .getReceivedContext ().isSecure () + " should be " + method .isSecure () +
197- ") for " + context .getReceivedContext ().getIcoClass ().getSimpleName () + " from " +
198- context .getReceivedMessage ().getJMSReplyTo ());
192+ throw new Exception ("Insecure call (is " + context .getReceivedContext ().isSecure () + " should be " + method .isSecure () + ") for " + context .getReceivedContext ().getIcoClass ().getSimpleName () + " from " + context .getReceivedMessage ().getJMSReplyTo ());
199193 }
200194 return method ;
201195 }
202196
203197 private RegistryEntry getRegistryEntry (InterconnectResponseContext context ) throws Exception {
204198 final RegistryEntry registryEntry = this .registry .get (context .getReceivedContext ().getIcoClass ());
205199 if (registryEntry == null ) {
206- throw new Exception (
207- "No registered method found for " + context .getReceivedContext ().getIcoClass ().getSimpleName () +
208- " from " + context .getReceivedMessage ().getJMSReplyTo ());
200+ throw new Exception ("No registered method found for " + context .getReceivedContext ().getIcoClass ().getSimpleName () + " from " + context .getReceivedMessage ().getJMSReplyTo ());
209201 }
210202 return registryEntry ;
211203 }
@@ -241,8 +233,7 @@ private void logInvoke(InterconnectResponseContext context) {
241233 .append ("(" ).append (context .getReceivedContext ().getIcoClass ().getSimpleName ()).append (")" );
242234 if (context .getReceivedContext ().getRequestIco () instanceof IPageable ) {
243235 sbInvokeLog //
244- .append (" at Page " ).append (((IPageable ) context .getReceivedContext ().getRequestIco ()).getOffset ())
245- .append (";" ).append (((IPageable ) context .getReceivedContext ().getRequestIco ()).getLimit ());
236+ .append (" at Page " ).append (((IPageable ) context .getReceivedContext ().getRequestIco ()).getOffset ()).append (";" ).append (((IPageable ) context .getReceivedContext ().getRequestIco ()).getLimit ());
246237 }
247238 sbInvokeLog .append (" with " ).append (de .taimos .dvalin .interconnect .model .InterconnectContext .getContext ());
248239 this .getLogger ().info (sbInvokeLog .toString ());
@@ -267,15 +258,12 @@ private int getDeliveryCount(Message message) throws JMSException {
267258 private static UUID getUuid (Message message , Class <? extends InterconnectObject > icoClass ) throws Exception {
268259 final String requestUUID = message .getStringProperty (InterconnectContext .HEADER_REQUEST_UUID );
269260 if (requestUUID == null ) {
270- throw new Exception ("No request UUID found in message with " + icoClass .getSimpleName () + " from " +
271- message .getJMSReplyTo ());
261+ throw new Exception ("No request UUID found in message with " + icoClass .getSimpleName () + " from " + message .getJMSReplyTo ());
272262 }
273263 try {
274264 return UUID .fromString (requestUUID );
275265 } catch (final IllegalArgumentException e ) {
276- throw new Exception (
277- "No valid request UUID " + requestUUID + " message with " + icoClass .getSimpleName () + " from " +
278- message .getJMSReplyTo ());
266+ throw new Exception ("No valid request UUID " + requestUUID + " message with " + icoClass .getSimpleName () + " from " + message .getJMSReplyTo ());
279267 }
280268 }
281269
@@ -314,9 +302,7 @@ private InterconnectObject handleRequest(final IDaemonHandler handler, final Dae
314302 throw new IdemponentRetryException (targetException );
315303 }
316304
317- this .getLogger ().error (
318- "Exception in non-idempotent " + method .getMethod ().getName () + "(" + ico .getClass ().getSimpleName () +
319- ")" + " with " + de .taimos .dvalin .interconnect .model .InterconnectContext .getContext (), e );
305+ this .getLogger ().error ("Exception in non-idempotent " + method .getMethod ().getName () + "(" + ico .getClass ().getSimpleName () + ")" + " with " + de .taimos .dvalin .interconnect .model .InterconnectContext .getContext (), e );
320306 throw new DaemonError (FrameworkErrors .FRAMEWORK_ERROR , targetException );
321307 } catch (final Exception e ) {
322308 throw new RuntimeException (e );
0 commit comments