summaryrefslogtreecommitdiff
path: root/jurt/com
diff options
context:
space:
mode:
Diffstat (limited to 'jurt/com')
-rw-r--r--jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java12
-rw-r--r--jurt/com/sun/star/comp/connections/Acceptor.java15
-rw-r--r--jurt/com/sun/star/comp/connections/Connector.java15
-rw-r--r--jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java14
-rw-r--r--jurt/com/sun/star/comp/connections/PipedConnection.java13
-rw-r--r--jurt/com/sun/star/comp/urlresolver/UrlResolver.java14
-rw-r--r--jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java15
-rw-r--r--jurt/com/sun/star/lib/connections/pipe/pipeConnector.java15
-rw-r--r--jurt/com/sun/star/lib/connections/socket/socketAcceptor.java15
-rw-r--r--jurt/com/sun/star/lib/connections/socket/socketConnector.java15
-rw-r--r--jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java13
-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/Cache.java2
-rw-r--r--jurt/com/sun/star/lib/uno/protocols/urp/urp.java16
17 files changed, 48 insertions, 160 deletions
diff --git a/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java b/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java
index a444f1813c3d..1c4819326268 100644
--- a/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java
+++ b/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java
@@ -94,18 +94,6 @@ public class BridgeFactory implements XBridgeFactory/*, XEventListener*/ {
}
/**
- * Writes the service information into the given registry key.
- * This method is called by the <code>JavaLoader</code>
- * <p>
- * @return returns true if the operation succeeded
- * @param regKey the registryKey
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(BridgeFactory.class.getName(), __serviceName, regKey);
- }
-
- /**
* Creates a remote bridge and memorizes it under <code>sName</code>.
* <p>
* @return the bridge
diff --git a/jurt/com/sun/star/comp/connections/Acceptor.java b/jurt/com/sun/star/comp/connections/Acceptor.java
index 3df51e735a1c..2dcfbc507d7b 100644
--- a/jurt/com/sun/star/comp/connections/Acceptor.java
+++ b/jurt/com/sun/star/comp/connections/Acceptor.java
@@ -84,21 +84,6 @@ public final class Acceptor implements XAcceptor {
}
/**
- * Writes the service information into the given registry key.
- *
- * <p>This method is called by the <code>JavaLoader</code>.</p>
- *
- * @param regKey the registry key.
- * @return <code>true</code> if the operation succeeded.
- *
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(Acceptor.class.getName(),
- __serviceName, regKey);
- }
-
- /**
* Constructs a new <code>Acceptor</code> that uses the given service
* factory to create a specific <code>XAcceptor</code>.
*
diff --git a/jurt/com/sun/star/comp/connections/Connector.java b/jurt/com/sun/star/comp/connections/Connector.java
index c02db5c52b8b..a9e0a2c5cc84 100644
--- a/jurt/com/sun/star/comp/connections/Connector.java
+++ b/jurt/com/sun/star/comp/connections/Connector.java
@@ -84,21 +84,6 @@ public class Connector implements XConnector {
}
/**
- * Writes the service information into the given registry key.
- *
- * <p>This method is called by the <code>JavaLoader</code>.</p>
- *
- * @param regKey the registry key.
- * @return <code>true</code> if the operation succeeded.
- *
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(Connector.class.getName(),
- __serviceName, regKey);
- }
-
- /**
* Constructs a new <code>Connector</code> that uses the given service
* factory to create a specific <code>XConnector</code>.
*
diff --git a/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java b/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java
index f63eeadf10d8..b801cb36d8a5 100644
--- a/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java
+++ b/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java
@@ -85,20 +85,6 @@ public class ConstantInstanceProvider implements XInstanceProvider {
return xSingleServiceFactory;
}
- /**
- * Writes the service information into the given registry key.
- * This method is called by the <code>JavaLoader</code>
- * <p>
- * @return returns true if the operation succeeded
- * @param regKey the registryKey
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(ConstantInstanceProvider.class.getName(), __serviceName, regKey);
- }
-
-
-
protected XMultiServiceFactory _serviceManager;
protected String _serviceName;
protected Object _instance;
diff --git a/jurt/com/sun/star/comp/connections/PipedConnection.java b/jurt/com/sun/star/comp/connections/PipedConnection.java
index 630adf4e223b..f5a839ea78c5 100644
--- a/jurt/com/sun/star/comp/connections/PipedConnection.java
+++ b/jurt/com/sun/star/comp/connections/PipedConnection.java
@@ -86,19 +86,6 @@ public class PipedConnection implements XConnection {
}
/**
- * Writes the service information into the given registry key.
- * This method is called by the <code>JavaLoader</code>
- * <p>
- * @return returns true if the operation succeeded
- * @param regKey the registryKey
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(PipedConnection.class.getName(), __serviceName, regKey);
- }
-
-
- /**
* The amount of time in milliseconds, to wait to
* see check the buffers.
*/
diff --git a/jurt/com/sun/star/comp/urlresolver/UrlResolver.java b/jurt/com/sun/star/comp/urlresolver/UrlResolver.java
index 3509dfb303f2..538315638553 100644
--- a/jurt/com/sun/star/comp/urlresolver/UrlResolver.java
+++ b/jurt/com/sun/star/comp/urlresolver/UrlResolver.java
@@ -154,18 +154,4 @@ public class UrlResolver {
return xSingleServiceFactory;
}
-
- /**
- * Writes the service information into the given registry key.
- * This method is called by the <code>JavaLoader</code>
- * <p>
- * @return returns true if the operation succeeded
- * @param regKey the registryKey
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(_UrlResolver.class.getName(), _UrlResolver.__serviceName, regKey);
- }
-
}
-
diff --git a/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java b/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java
index 4c5bf7f1c979..25b2ec4abfe3 100644
--- a/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java
+++ b/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java
@@ -84,21 +84,6 @@ public final class pipeAcceptor implements XAcceptor {
}
/**
- * Writes the service information into the given registry key.
- *
- * <p>This method is called by the <code>JavaLoader</code>.</p>
- *
- * @param regKey the registry key.
- * @return <code>true</code> if the operation succeeded.
- *
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(
- pipeAcceptor.class.getName(), __serviceName, regKey);
- }
-
- /**
* Accepts a connection request via the described pipe.
*
* <p>This call blocks until a connection has been established.</p>
diff --git a/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java b/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java
index 9c0c412ec2bc..9856fb2e116e 100644
--- a/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java
+++ b/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java
@@ -84,21 +84,6 @@ public final class pipeConnector implements XConnector {
}
/**
- * Writes the service information into the given registry key.
- *
- * <p>This method is called by the <code>JavaLoader</code>.</p>
- *
- * @param regKey the registry key.
- * @return <code>true</code> if the operation succeeded.
- *
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(
- pipeConnector.class.getName(), __serviceName, regKey);
- }
-
- /**
* Connects via the described pipe to a waiting server.
*
* <p>The connection description has the following format:
diff --git a/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java b/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java
index f2119225f029..bf9456d0058a 100644
--- a/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java
+++ b/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java
@@ -89,21 +89,6 @@ public final class socketAcceptor implements XAcceptor {
}
/**
- * Writes the service information into the given registry key.
- *
- * <p>This method is called by the <code>JavaLoader</code>.</p>
- *
- * @param regKey the registry key.
- * @return <code>true</code> if the operation succeeded.
- *
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(
- socketAcceptor.class.getName(), __serviceName, regKey);
- }
-
- /**
* Accepts a connection request via the described socket.
*
* <p>This call blocks until a connection has been established.</p>
diff --git a/jurt/com/sun/star/lib/connections/socket/socketConnector.java b/jurt/com/sun/star/lib/connections/socket/socketConnector.java
index f85a5ac41bd0..3a7bf183d223 100644
--- a/jurt/com/sun/star/lib/connections/socket/socketConnector.java
+++ b/jurt/com/sun/star/lib/connections/socket/socketConnector.java
@@ -89,21 +89,6 @@ public final class socketConnector implements XConnector {
}
/**
- * Writes the service information into the given registry key.
- *
- * <p>This method is called by the <code>JavaLoader</code>.</p>
- *
- * @param regKey the registry key.
- * @return <code>true</code> if the operation succeeded.
- *
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(
- socketConnector.class.getName(), __serviceName, regKey);
- }
-
- /**
* Connects via the described socket to a waiting server.
*
* <p>The connection description has the following format:
diff --git a/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java b/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java
index b81db391966f..ae2719f1c07d 100644
--- a/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java
+++ b/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java
@@ -148,11 +148,22 @@ final class ProxyFactory {
private Object request(String operation, Object[] args) throws Throwable
{
- return requestHandler.sendRequest(oid, type, operation, args);
+ Object res = requestHandler.sendRequest(oid, type, operation, args);
+ // Avoid early finalization of this object, while an invoke ->
+ // request call is still ongoing; as finalize also calls request,
+ // this should fulfil the condition from The Java Language
+ // Specification, 3rd ed., that "if an object's finalizer can result
+ // in synchronization on that object, then that object must be alive
+ // and considered reachable whenever a lock is held on it:"
+ synchronized (this) {
+ ++dummy;
+ }
+ return res;
}
private final String oid;
private final Type type;
+ private int dummy = 0;
}
private static final Method METHOD_EQUALS;
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/Cache.java b/jurt/com/sun/star/lib/uno/protocols/urp/Cache.java
index 48268a53a260..d9c57af30cce 100644
--- a/jurt/com/sun/star/lib/uno/protocols/urp/Cache.java
+++ b/jurt/com/sun/star/lib/uno/protocols/urp/Cache.java
@@ -52,7 +52,7 @@ final class Cache {
if (e == null) {
if (map.size() < maxSize) {
// There is still room for a new entry at the front:
- e = new Entry(content, map.size(), last, null);
+ e = new Entry(content, map.size(), null, first);
if (first == null) {
last = e;
} else {
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;