/** * Performs a remote procedure call with the specified arguments but does * not wait for a response. The outbound message is sent on the specified channel. * There is no inbound response message. */ public void callAsync( byte channel, short objId, short procId, Object... args ) { RpcCallMessage msg = new RpcCallMessage(-1, channel, objId, procId, args); if( log.isLoggable(Level.FINEST) ) { log.log(Level.FINEST, "Sending:{0} on channel:{1}", new Object[]{msg, channel}); } connection.send(channel, msg); }
source.send(msg);
/** * Performs a remote procedure call with the specified arguments and waits * for the response. Both the outbound message and inbound response will * be sent on the specified channel. */ public Object callAndWait( byte channel, short objId, short procId, Object... args ) { RpcCallMessage msg = new RpcCallMessage(sequenceNumber.getAndIncrement(), channel, objId, procId, args); // Need to register an object so we can wait for the response. // ...before we send it. Just in case. ResponseHolder holder = new ResponseHolder(msg); responses.put(msg.getMessageId(), holder); if( log.isLoggable(Level.FINEST) ) { log.log(Level.FINEST, "Sending:{0} on channel:{1}", new Object[]{msg, channel}); } // Prevent non-async messages from being send as UDP // because there is a high probabilty that this would block // forever waiting for a response. For async calls it's ok // so it doesn't do the check. if( channel >= 0 ) { connection.send(channel, msg); } else { connection.send(msg); } return holder.getResponse(); }
/** * Performs a remote procedure call with the specified arguments but does * not wait for a response. The outbound message is sent on the specified channel. * There is no inbound response message. */ public void callAsync( byte channel, short objId, short procId, Object... args ) { RpcCallMessage msg = new RpcCallMessage(-1, channel, objId, procId, args); if( log.isLoggable(Level.FINEST) ) { log.log(Level.FINEST, "Sending:{0} on channel:{1}", new Object[]{msg, channel}); } connection.send(channel, msg); }
/** * Performs a remote procedure call with the specified arguments and waits * for the response. Both the outbound message and inbound response will * be sent on the specified channel. */ public Object callAndWait( byte channel, short objId, short procId, Object... args ) { RpcCallMessage msg = new RpcCallMessage(sequenceNumber.getAndIncrement(), channel, objId, procId, args); // Need to register an object so we can wait for the response. // ...before we send it. Just in case. ResponseHolder holder = new ResponseHolder(msg); responses.put(msg.getMessageId(), holder); if( log.isLoggable(Level.FINEST) ) { log.log(Level.FINEST, "Sending:{0} on channel:{1}", new Object[]{msg, channel}); } // Prevent non-async messages from being send as UDP // because there is a high probabilty that this would block // forever waiting for a response. For async calls it's ok // so it doesn't do the check. if( channel >= 0 ) { connection.send(channel, msg); } else { connection.send(msg); } return holder.getResponse(); }