summaryrefslogtreecommitdiff
path: root/java/src/IceInternal/UdpTransceiver.java
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2012-12-14 17:32:22 +0100
committerJose <jose@zeroc.com>2012-12-14 17:32:22 +0100
commit301cc174e4804045f66ce23b34bff84942db7a09 (patch)
treeda51c05094cb3c379c9c4cb00cdf63e094568f1a /java/src/IceInternal/UdpTransceiver.java
parentFixed (ICE-4913) - Deprecate Ice::Stats (diff)
downloadice-301cc174e4804045f66ce23b34bff84942db7a09.tar.bz2
ice-301cc174e4804045f66ce23b34bff84942db7a09.tar.xz
ice-301cc174e4804045f66ce23b34bff84942db7a09.zip
Fixed (ICE-5114) - android library demo exceptions.
Diffstat (limited to 'java/src/IceInternal/UdpTransceiver.java')
-rw-r--r--java/src/IceInternal/UdpTransceiver.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/java/src/IceInternal/UdpTransceiver.java b/java/src/IceInternal/UdpTransceiver.java
index 94912ddcf11..8b49ec6754b 100644
--- a/java/src/IceInternal/UdpTransceiver.java
+++ b/java/src/IceInternal/UdpTransceiver.java
@@ -52,6 +52,16 @@ final class UdpTransceiver implements Transceiver
public boolean
write(Buffer buf)
{
+ //
+ // We don't want write or send to be called on android main thread as this will cause
+ // NetworkOnMainThreadException to be thrown. If that is the android main thread
+ // we return false and this method will be later called from the thread pool
+ //
+ if(Util.isAndroidMainThread(Thread.currentThread()))
+ {
+ return false;
+ }
+
assert(buf.b.position() == 0);
assert(_fd != null && _state >= StateConnected);