Skip to content

Commit

Permalink
Fix #37
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Thomas <markt@apache.org>
  • Loading branch information
markt-asf committed Feb 6, 2019
1 parent 5400648 commit 4a9c11d
Showing 1 changed file with 13 additions and 10 deletions.
Expand Up @@ -182,7 +182,7 @@ protected static String timeout(Async asyncRemote) {
* Again, since the asynchronous thread sends message in virtually no time,
* one does not have any force to hold that send operation in its thread, to
* check the send operation is really unblocking and asynchronous
*
*
* @param asyncRemote
* @return
*/
Expand Down Expand Up @@ -250,32 +250,35 @@ protected static String sendObject(Async asyncRemote) {

protected static String sendObject(Async asyncRemote, Class<?> type) {
try {
Future<Void> future = null;
if (type == byte.class) {
byte b = -100;
asyncRemote.sendObject(b);
future = asyncRemote.sendObject(b);
} else if (type == short.class) {
short s = -101;
asyncRemote.sendObject(s);
future = asyncRemote.sendObject(s);
} else if (type == int.class) {
int i = -102;
asyncRemote.sendObject(i);
future = asyncRemote.sendObject(i);
} else if (type == long.class) {
long l = -103L;
asyncRemote.sendObject(l);
future = asyncRemote.sendObject(l);
} else if (type == float.class) {
float f = -104f;
asyncRemote.sendObject(f);
future = asyncRemote.sendObject(f);
} else if (type == double.class) {
double d = -105d;
asyncRemote.sendObject(d);
future = asyncRemote.sendObject(d);
} else if (type == boolean.class) {
boolean b = false;
asyncRemote.sendObject(b);
future = asyncRemote.sendObject(b);
} else if (type == char.class) {
char c = 106;
asyncRemote.sendObject(c);
future = asyncRemote.sendObject(c);
}
return RESPONSE[0];
@SuppressWarnings("null") // v being null is a bug so we want the NPE in this case
Void v = future.get();
return v == null ? RESPONSE[0] : RESPONSE[1];
} catch (Exception e) {
e.printStackTrace();
return IOUtil.printStackTrace(e);
Expand Down

0 comments on commit 4a9c11d

Please sign in to comment.