diff options
author | wjaniszewski <wjaniszewski@13f79535-47bb-0310-9956-ffa450edef68> | 2009-04-16 08:44:36 +0000 |
---|---|---|
committer | wjaniszewski <wjaniszewski@13f79535-47bb-0310-9956-ffa450edef68> | 2009-04-16 08:44:36 +0000 |
commit | cc8390a108db502b965721392f1df0a7be221754 (patch) | |
tree | b5d7e298439386edc47957605928e98fec098e36 /branches/sca-java-1.x/modules/binding-erlang-runtime/src/main/java/org/apache/tuscany | |
parent | ce604976d31aba76df48dfd271a3e0c8a1bcac18 (diff) |
Messaging improvements
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@765512 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/binding-erlang-runtime/src/main/java/org/apache/tuscany')
-rw-r--r-- | branches/sca-java-1.x/modules/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/ServiceExecutor.java | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/branches/sca-java-1.x/modules/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/ServiceExecutor.java b/branches/sca-java-1.x/modules/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/ServiceExecutor.java index 696447feef..e42b93c313 100644 --- a/branches/sca-java-1.x/modules/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/ServiceExecutor.java +++ b/branches/sca-java-1.x/modules/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/ServiceExecutor.java @@ -214,14 +214,17 @@ public class ServiceExecutor implements Runnable { if (msg.getMsg().getClass().equals(OtpErlangTuple.class) && (((OtpErlangTuple) msg.getMsg()).elementAt(0)) .getClass().equals(OtpErlangPid.class)) { + // PID provided by client senderPid = (OtpErlangPid) ((OtpErlangTuple) msg.getMsg()) .elementAt(0); msgNoSender = ((OtpErlangTuple) msg.getMsg()).elementAt(1); } else { + // PID obtained from jinterface + senderPid = msg.getSenderPid(); msgNoSender = msg.getMsg(); } } catch (Exception e) { - + e.printStackTrace(); } if (operations == null) { @@ -265,13 +268,32 @@ public class ServiceExecutor implements Runnable { if (response != null && senderPid != null) { connection.send(senderPid, response); } else if (response != null && senderPid == null) { - // FIXME: cannot send reply - sender didn't provided - // pid. Use PID obtained by jinteface or log this error? - // connection.send(msg.getSenderPid(), response); + // TODO: externalize message? + // TODO: do we need to send this reply? + logger + .log( + Level.WARNING, + "Cannot send reply - Erlang client didn't provide it's PID and couldn't obtain sender PID from jinterface"); } } catch (InvocationTargetException e) { - // FIXME: use linking feature? send some error? - e.printStackTrace(); + if (e.getCause() != null + && e.getCause().getClass().equals( + IllegalArgumentException.class)) { + // arguments number or type mismatch + try { + // TODO: externalize message? + connection + .send( + senderPid, + new OtpErlangString( + "Operation name found in SCA component, but parameters types didn't match.")); + } catch (IOException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } else { + e.printStackTrace(); + } // } catch (IOException e) { } catch (Exception e) { // FIXME: log this problem? use linking feature? send error? |