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;