summaryrefslogtreecommitdiff
path: root/jurt/com
diff options
context:
space:
mode:
authorsb <sb@openoffice.org>2011-01-13 12:57:42 +0100
committersb <sb@openoffice.org>2011-01-13 12:57:42 +0100
commitd873a6df8039666186ec3850562d35d10ef60b5f (patch)
tree9572877be2b4b8e3cd549aaa1b58dc64026f61eb /jurt/com
parent7bf5ab295e38ecdde42245ad8732cdf9c05ebcba (diff)
sb139: #i116445# do not write to a disposed Java URP bridge
Diffstat (limited to 'jurt/com')
-rw-r--r--jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java2
-rw-r--r--jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java2
-rw-r--r--jurt/com/sun/star/lib/uno/protocols/urp/urp.java16
3 files changed, 18 insertions, 2 deletions
diff --git a/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java b/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java
index 267a84d7515f..e37273be6902 100644
--- a/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java
+++ b/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java
@@ -499,6 +499,8 @@ public class java_remote_bridge
((DisposeListener) i.next()).notifyDispose(this);
}
+ _iProtocol.terminate();
+
try {
_messageDispatcher.terminate();
diff --git a/jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java b/jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java
index 1fae45e9ca23..de581ea86c7b 100644
--- a/jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java
+++ b/jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java
@@ -51,6 +51,8 @@ public interface IProtocol {
*/
void init() throws IOException;
+ void terminate();
+
/**
* Reads a request or reply message.
*
diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/urp.java b/jurt/com/sun/star/lib/uno/protocols/urp/urp.java
index da54bc7612a1..a158e1138db1 100644
--- a/jurt/com/sun/star/lib/uno/protocols/urp/urp.java
+++ b/jurt/com/sun/star/lib/uno/protocols/urp/urp.java
@@ -30,6 +30,7 @@ package com.sun.star.lib.uno.protocols.urp;
import com.sun.star.bridge.InvalidProtocolChangeException;
import com.sun.star.bridge.ProtocolProperty;
import com.sun.star.bridge.XProtocolProperties;
+import com.sun.star.lang.DisposedException;
import com.sun.star.lib.uno.environments.remote.IProtocol;
import com.sun.star.lib.uno.environments.remote.Message;
import com.sun.star.lib.uno.environments.remote.ThreadId;
@@ -79,6 +80,15 @@ public final class urp implements IProtocol {
}
}
+ // @see IProtocol#terminate
+ public void terminate() {
+ synchronized (monitor) {
+ state = STATE_TERMINATED;
+ initialized = true;
+ monitor.notifyAll();
+ }
+ }
+
// @see IProtocol#readMessage
public Message readMessage() throws IOException {
for (;;) {
@@ -125,6 +135,9 @@ public final class urp implements IProtocol {
throw new RuntimeException(e.toString());
}
}
+ if (state == STATE_TERMINATED) {
+ throw new DisposedException();
+ }
return writeRequest(false, oid, type, function, tid, arguments);
}
}
@@ -375,7 +388,6 @@ public final class urp implements IProtocol {
if ((header & HEADER_NEWTID) != 0) {
inL1Tid = unmarshal.readThreadId();
}
- //TODO: check HEADER_IGNORECACHE
return readRequest(funId, sync);
}
@@ -684,7 +696,6 @@ public final class urp implements IProtocol {
private static final int HEADER_NEWOID = 0x10;
private static final int HEADER_NEWTID = 0x08;
private static final int HEADER_FUNCTIONID16 = 0x04;
- private static final int HEADER_IGNORECACHE = 0x02;
private static final int HEADER_MOREFLAGS = 0x01;
private static final int HEADER_MUSTREPLY = 0x80;
private static final int HEADER_SYNCHRONOUS = 0x40;
@@ -701,6 +712,7 @@ public final class urp implements IProtocol {
private static final int STATE_REQUESTED = 2;
private static final int STATE_COMMITTED = 3;
private static final int STATE_WAIT = 4;
+ private static final int STATE_TERMINATED = 5;
private static final int MAX_RELEASE_QUEUE_SIZE = 100;
ssary? Change-Id: Ic06d723e404481e3f1bca67c43b70321b764d923 2015-03-08svx: nAnz -> nCountMiklos Vajna Change-Id: I88bff880a5fb27b259b66984a0637fe7d2ab51f6 2015-01-07fdo#84938: convert STREAM_ #defines to 'enum class'Noel Grandin Change-Id: Ibbf14c7e9a5c1883c1311d4c86f948f74f8e473e 2014-10-20loplugin: cstylecastNoel Grandin Change-Id: Ia3055b00c20a885dfa0584f864f0e91ccad1e9c9 2014-08-22Avoid invalid downcastsStephan Bergmann Change-Id: Iea1688213cc0ebb8fcb3d3e3c862fd31275b9b38 2014-06-30Avoid possible memory leaks in case of exceptionsTakeshi Abe Change-Id: I9a92edd7886db484f1333585545f6f63a233a6dd 2014-04-27cppcheck: reduce scopeJulien Nabet Change-Id: I18d7500dcc4b29e2d0face22649f6f96382eabe8 2014-04-10Clean up function declarations and some unused functionsStephan Bergmann Change-Id: Ic720aa7b30bbe56d67e0b65f3e047ad3ae521a97