summaryrefslogtreecommitdiff
path: root/jurt/com
diff options
context:
space:
mode:
authorRelease Engineering <releng@openoffice.org>2011-02-18 11:14:19 +0100
committerRelease Engineering <releng@openoffice.org>2011-02-18 11:14:19 +0100
commitea713649e558dcec291302bffd00b148a96e33a8 (patch)
treecfd191ca277fdd42ccdd6489e57e421a2c63470c /jurt/com
parenta60533f101359e6b506dcf0ff4d26956aa76df37 (diff)
parent677395ac556e88a674e21a5406875d72b140d241 (diff)
merged DEV300
Notes
Notes: split repo tag: ure_ooo/DEV300_m101
Diffstat (limited to 'jurt/com')
-rw-r--r--jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java17
-rw-r--r--jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java2
-rw-r--r--jurt/com/sun/star/lib/uno/environments/remote/IThreadPool.java6
-rw-r--r--jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java9
-rw-r--r--jurt/com/sun/star/lib/uno/protocols/urp/urp.java16
5 files changed, 35 insertions, 15 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..221870b0b035 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
@@ -155,7 +155,7 @@ public class java_remote_bridge
new Job(obj, java_remote_bridge.this, msg));
}
} catch (Throwable e) {
- dispose(new DisposedException(e.toString()));
+ dispose(e);
}
}
@@ -478,12 +478,12 @@ public class java_remote_bridge
dispose = _life_count <= 0;
}
if (dispose) {
- dispose(new com.sun.star.uno.RuntimeException("end of life"));
+ dispose(new Throwable("end of life"));
}
}
public void dispose() {
- dispose(new com.sun.star.uno.RuntimeException("user dispose"));
+ dispose(new Throwable("user dispose"));
}
private void dispose(Throwable throwable) {
@@ -499,6 +499,8 @@ public class java_remote_bridge
((DisposeListener) i.next()).notifyDispose(this);
}
+ _iProtocol.terminate();
+
try {
_messageDispatcher.terminate();
@@ -602,7 +604,8 @@ public class java_remote_bridge
_iProtocol.writeReply(exception, threadId, result);
} catch (IOException e) {
dispose(e);
- throw new DisposedException("unexpected " + e);
+ throw (DisposedException)
+ (new DisposedException("unexpected " + e).initCause(e));
} catch (RuntimeException e) {
dispose(e);
throw e;
@@ -631,9 +634,9 @@ public class java_remote_bridge
oid, TypeDescription.getTypeDescription(type), operation,
threadId, params);
} catch (IOException e) {
- DisposedException d = new DisposedException(e.toString());
- dispose(d);
- throw d;
+ dispose(e);
+ throw (DisposedException)
+ new DisposedException(e.toString()).initCause(e);
}
if (sync && Thread.currentThread() != _messageDispatcher) {
result = _iThreadPool.enter(handle, threadId);
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/environments/remote/IThreadPool.java b/jurt/com/sun/star/lib/uno/environments/remote/IThreadPool.java
index c70ccfa7e934..71961737fd55 100644
--- a/jurt/com/sun/star/lib/uno/environments/remote/IThreadPool.java
+++ b/jurt/com/sun/star/lib/uno/environments/remote/IThreadPool.java
@@ -110,10 +110,10 @@ public interface IThreadPool {
/**
* Disposes this thread pool, thus releasing
- * all threads by throwing the given
- * <code>Throwable</code>.
+ * all threads by throwing a <code>DisposedException</code> with the given
+ * <code>Throwable</code> cause.
* <p>
- * @param throwing the Throwable
+ * @param throwing the cause
*/
public void dispose(Throwable throwable);
diff --git a/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java b/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java
index f7568a30cef7..62e49cc44f16 100644
--- a/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java
+++ b/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java
@@ -27,6 +27,7 @@
package com.sun.star.lib.uno.environments.remote;
+import com.sun.star.lang.DisposedException;
/**
* The <code>JobQueue</code> implements a queue for jobs.
@@ -200,7 +201,7 @@ public class JobQueue {
* @return a job or null if timed out
* @param waitTime the maximum amount of time to wait for a job
*/
- private Job removeJob(int waitTime) throws Throwable {
+ private Job removeJob(int waitTime) {
if(DEBUG) System.err.println("##### " + getClass().getName() + ".removeJob:" + _head + " " + _threadId);
Job job = null;
@@ -210,7 +211,8 @@ public class JobQueue {
while(_head == null && (waitTime == 0 || !waited)) {
if(_doDispose == _disposeId) {
_doDispose = null;
- throw _throwable;
+ throw (DisposedException)
+ new DisposedException().initCause(_throwable);
}
// notify sync queues
@@ -250,7 +252,8 @@ public class JobQueue {
if(_doDispose == _disposeId) {
_doDispose = null;
- throw _throwable;
+ throw (DisposedException)
+ new DisposedException().initCause(_throwable);
}
try {
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;