summaryrefslogtreecommitdiff
path: root/jurt/com/sun/star/lib/uno
diff options
context:
space:
mode:
authorrbuj <robert.buj@gmail.com>2014-07-23 18:51:20 +0200
committerMichael Stahl <mstahl@redhat.com>2014-07-24 13:11:41 +0200
commitb01358553082fd6f30781d0641c652f206c90c63 (patch)
tree24aa9acf9d1331ded2a12aef1cc230b267ea8e49 /jurt/com/sun/star/lib/uno
parentc8aa8226962db6ddbca6bfec8e415dfd5ecdda6f (diff)
jurt: Enhanced For-Loops, code formatting, javadoc & overrides
Signed-off-by: Michael Stahl <mstahl@redhat.com> Conflicts: jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java Change-Id: I6d6324c5597fa472360a1b8bb4153dec647a36f0
Diffstat (limited to 'jurt/com/sun/star/lib/uno')
-rw-r--r--jurt/com/sun/star/lib/uno/bridges/java_remote/BridgedObject.java4
-rw-r--r--jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionInputStream_Adapter.java10
-rw-r--r--jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionOutputStream_Adapter.java16
-rw-r--r--jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java102
-rw-r--r--jurt/com/sun/star/lib/uno/environments/java/java_environment.java30
-rw-r--r--jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java20
-rw-r--r--jurt/com/sun/star/lib/uno/environments/remote/IThreadPool.java68
-rw-r--r--jurt/com/sun/star/lib/uno/environments/remote/JavaThreadPool.java2
-rw-r--r--jurt/com/sun/star/lib/uno/environments/remote/Job.java15
-rw-r--r--jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java76
-rw-r--r--jurt/com/sun/star/lib/uno/environments/remote/Message.java162
-rw-r--r--jurt/com/sun/star/lib/uno/environments/remote/ThreadId.java24
-rw-r--r--jurt/com/sun/star/lib/uno/environments/remote/ThreadPoolManager.java4
-rw-r--r--jurt/com/sun/star/lib/uno/protocols/urp/Cache.java20
-rw-r--r--jurt/com/sun/star/lib/uno/protocols/urp/urp.java34
15 files changed, 324 insertions, 263 deletions
diff --git a/jurt/com/sun/star/lib/uno/bridges/java_remote/BridgedObject.java b/jurt/com/sun/star/lib/uno/bridges/java_remote/BridgedObject.java
index 776296dd6d85..639e9f6532fd 100644
--- a/jurt/com/sun/star/lib/uno/bridges/java_remote/BridgedObject.java
+++ b/jurt/com/sun/star/lib/uno/bridges/java_remote/BridgedObject.java
@@ -28,9 +28,9 @@ public final class BridgedObject {
* Obtains the bridge associated with a bridged object.
*
* @param obj a reference to a (Java representation of a) UNO object;
- * must not be null
+ * must not be null.
* @return the bridge associated with the given object, if it is indeed
- * bridged; otherwise, null is returned
+ * bridged; otherwise, null is returned.
*/
public static XBridge getBridge(Object obj) {
return ProxyFactory.getBridge(obj);
diff --git a/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionInputStream_Adapter.java b/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionInputStream_Adapter.java
index 1d45cb950b74..a189115b47ec 100644
--- a/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionInputStream_Adapter.java
+++ b/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionInputStream_Adapter.java
@@ -40,13 +40,11 @@ class XConnectionInputStream_Adapter extends InputStream {
}
public int read() throws IOException {
-
- int len ;
+ int len;
try {
len = _xConnection.read(_bytes, 1);
- }
- catch(com.sun.star.io.IOException ioException) {
+ } catch(com.sun.star.io.IOException ioException) {
throw new IOException(ioException.toString());
}
@@ -55,13 +53,13 @@ class XConnectionInputStream_Adapter extends InputStream {
return len == 0 ? -1 : _bytes[0][0] & 0xff;
}
+ @Override
public int read(byte[] b, int off, int len) throws IOException {
// byte bytes[][] = new byte[1][];
try {
len = _xConnection.read(_bytes, len - off);
- }
- catch(com.sun.star.io.IOException ioException) {
+ } catch(com.sun.star.io.IOException ioException) {
throw new IOException(ioException.toString());
}
diff --git a/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionOutputStream_Adapter.java b/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionOutputStream_Adapter.java
index 999970e4c5c1..3bc7e49975a5 100644
--- a/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionOutputStream_Adapter.java
+++ b/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionOutputStream_Adapter.java
@@ -42,21 +42,20 @@ class XConnectionOutputStream_Adapter extends OutputStream {
try {
_xConnection.write(_bytes);
- }
- catch(com.sun.star.io.IOException ioException) {
+ } catch(com.sun.star.io.IOException ioException) {
throw new IOException(ioException.toString());
}
if(DEBUG) System.err.println("#### " + this.getClass() + " - one byte written:" + _bytes[0]);
}
+ @Override
public void write(byte[] b, int off, int len) throws IOException {
byte bytes[] ;
- if(off == 0 && len == b.length)
+ if(off == 0 && len == b.length) {
bytes = b;
-
- else {
+ } else {
bytes = new byte[len];
System.arraycopy(b, off, bytes, 0, len);
@@ -64,17 +63,16 @@ class XConnectionOutputStream_Adapter extends OutputStream {
try {
_xConnection.write(bytes);
- }
- catch(com.sun.star.io.IOException ioException) {
+ } catch(com.sun.star.io.IOException ioException) {
throw new IOException(ioException.toString());
}
}
+ @Override
public void flush() throws IOException {
try {
_xConnection.flush();
- }
- catch(com.sun.star.io.IOException ioException) {
+ } catch(com.sun.star.io.IOException ioException) {
throw new IOException(ioException.toString());
}
}
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 841cd7cda412..4f76c5c304ce 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
@@ -22,7 +22,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -63,12 +62,13 @@ import com.sun.star.uno.TypeClass;
import com.sun.star.uno.Any;
/**
- * This class implements a remote bridge. Therefor
- * various interfaces are implemented.
- * <p>
- * The protocol to used is passed by name, the bridge
- * then looks for it under <code>com.sun.star.lib.uno.protocols</code>.
- * <p>
+ * This class implements a remote bridge.
+ *
+ * <p>Therefor various interfaces are implemented.</p>
+ *
+ * <p>The protocol to used is passed by name, the bridge
+ * then looks for it under <code>com.sun.star.lib.uno.protocols</code>.</p>
+ *
* @since UDK1.0
*/
public class java_remote_bridge
@@ -185,10 +185,13 @@ public class java_remote_bridge
return _iProtocol;
}
- // The ref holder stuff strongly holds objects mapped out via this bridge
- // (the java_environment only holds them weakly). When this bridge is
- // disposed, all remaining ref holder entries are released.
-
+ /**
+ * The ref holder stuff strongly holds objects mapped out via this bridge
+ * (the java_environment only holds them weakly).
+ *
+ * <p>When this bridge is disposed, all remaining ref holder entries are
+ * released.</p>
+ */
private static final class RefHolder {
public RefHolder(Type type, Object object) {
this.type = type;
@@ -219,8 +222,7 @@ public class java_remote_bridge
synchronized (refHolders) {
LinkedList<RefHolder> l = refHolders.get(oid);
if (l != null) {
- for (Iterator<RefHolder> i = l.iterator(); i.hasNext();) {
- RefHolder rh = i.next();
+ for (RefHolder rh : l) {
if (type.isSupertypeOf(rh.getType())) {
return true;
}
@@ -256,8 +258,7 @@ public class java_remote_bridge
synchronized (refHolders) {
LinkedList<RefHolder> l = refHolders.get(oid);
if (l != null) {
- for (Iterator<RefHolder> i = l.iterator(); i.hasNext();) {
- RefHolder rh = i.next();
+ for (RefHolder rh : l) {
if (rh.getType().equals(type)) {
try {
if (rh.release()) {
@@ -353,19 +354,22 @@ public class java_remote_bridge
/**
* Constructs a new bridge.
- * <p>
- * This method is not part of the provided <code>api</code>
- * and should only be used by the UNO runtime.
- * <p>
+ * <p> This method is not part of the provided <code>api</code>
+ * and should only be used by the UNO runtime.</p>
+ *
+ * @param args the custom parameters: arg[0] == protocol_name,
+ * arg[1] == xConnection, arg[2] == xInstanceProvider.
+ *
* @deprecated as of UDK 1.0
- * <p>
- * @param args the custom parameters: arg[0] == protocol_name, arg[1] == xConnection, arg[2] == xInstanceProvider
*/
public java_remote_bridge(Object args[]) throws Exception {
this(UnoRuntime.getEnvironment("java", null), UnoRuntime.getEnvironment("remote", null), args);
}
- // @see com.sun.star.uno.IBridge#mapInterfaceTo
+ /**
+ *
+ * @see com.sun.star.uno.IBridge#mapInterfaceTo
+ */
public Object mapInterfaceTo(Object object, Type type) {
checkDisposed();
if (object == null) {
@@ -397,10 +401,11 @@ public class java_remote_bridge
/**
* Maps an object from destination environment to the source environment.
- * <p>
- * @return the object in the source environment
- * @param oId the object to map
- * @param type the interface under which is to be mapped
+ *
+ * @param oId the object to map.
+ * @param type the interface under which is to be mapped.
+ * @return the object in the source environment.
+ *
* @see com.sun.star.uno.IBridge#mapInterfaceFrom
*/
public Object mapInterfaceFrom(Object oId, Type type) {
@@ -423,8 +428,8 @@ public class java_remote_bridge
/**
* Gives the source environment.
- * <p>
- * @return the source environment of this bridge
+ *
+ * @return the source environment of this bridge.
* @see com.sun.star.uno.IBridge#getSourceEnvironment
*/
public IEnvironment getSourceEnvironment() {
@@ -433,8 +438,8 @@ public class java_remote_bridge
/**
* Gives the destination environment.
- * <p>
- * @return the destination environment of this bridge
+ *
+ * @return the destination environment of this bridge.
* @see com.sun.star.uno.IBridge#getTargetEnvironment
*/
public IEnvironment getTargetEnvironment() {
@@ -443,7 +448,7 @@ public class java_remote_bridge
/**
* Increases the life count.
- * <p>
+ *
* @see com.sun.star.uno.IBridge#acquire
*/
public synchronized void acquire() {
@@ -454,8 +459,9 @@ public class java_remote_bridge
/**
* Decreases the life count.
- * If the life count drops to zero, the bridge disposes itself.
- * <p>
+ *
+ * <p>If the life count drops to zero, the bridge disposes itself.</p>
+ *
* @see com.sun.star.uno.IBridge#release
*/
public void release() {
@@ -552,7 +558,10 @@ public class java_remote_bridge
}
}
- // @see com.sun.star.bridge.XBridge#getInstance
+ /**
+ *
+ * @see com.sun.star.bridge.XBridge#getInstance
+ */
public Object getInstance(String instanceName) {
Type t = new Type(XInterface.class);
return sendInternalRequest(
@@ -560,9 +569,9 @@ public class java_remote_bridge
}
/**
- * Gives the name of this bridge
- * <p>
- * @return the name of this bridge
+ * Gives the name of this bridge.
+ *
+ * @return the name of this bridge.
* @see com.sun.star.bridge.XBridge#getName
*/
public String getName() {
@@ -570,9 +579,9 @@ public class java_remote_bridge
}
/**
- * Gives a description of the connection type and protocol used
- * <p>
- * @return connection type and protocol
+ * Gives a description of the connection type and protocol used.
+ *
+ * @return connection type and protocol.
* @see com.sun.star.bridge.XBridge#getDescription
*/
public String getDescription() {
@@ -664,7 +673,9 @@ public class java_remote_bridge
}
}
- // Methods XComponent
+ /**
+ * Methods XComponent.
+ */
public void addEventListener(XEventListener xEventListener) {
_listeners.add(xEventListener);
}
@@ -673,7 +684,10 @@ public class java_remote_bridge
_listeners.remove(xEventListener);
}
- // @see NotifyDispose.addDisposeListener
+ /**
+ *
+ * @see NotifyDispose.addDisposeListener
+ */
public void addDisposeListener(DisposeListener listener) {
synchronized (this) {
if (!disposed) {
@@ -684,7 +698,9 @@ public class java_remote_bridge
listener.notifyDispose(this);
}
- // This function must only be called while synchronized on this object:
+ /**
+ * This function must only be called while synchronized on this object.
+ */
private synchronized void checkDisposed() {
if (disposed) {
throw new DisposedException("java_remote_bridge " + this
diff --git a/jurt/com/sun/star/lib/uno/environments/java/java_environment.java b/jurt/com/sun/star/lib/uno/environments/java/java_environment.java
index 522ca8c2408b..e02f0cebf2c9 100644
--- a/jurt/com/sun/star/lib/uno/environments/java/java_environment.java
+++ b/jurt/com/sun/star/lib/uno/environments/java/java_environment.java
@@ -43,17 +43,26 @@ public final class java_environment implements IEnvironment {
this.context = context;
}
- // @see com.sun.star.uno.IEnvironment#getContext
+ /**
+ *
+ * @see com.sun.star.uno.IEnvironment#getContext
+ */
public Object getContext() {
return context;
}
- // @see com.sun.star.uno.IEnvironment#getName
+ /**
+ *
+ * @see com.sun.star.uno.IEnvironment#getName
+ */
public String getName() {
return "java";
}
- // @see com.sun.star.uno.IEnvironment#registerInterface
+ /**
+ *
+ * @see com.sun.star.uno.IEnvironment#registerInterface
+ */
public Object registerInterface(Object object, String[] oid, Type type) {
if (oid[0] == null) {
oid[0] = UnoRuntime.generateOid(object);
@@ -66,8 +75,8 @@ public final class java_environment implements IEnvironment {
* You have to revoke ANY interface that has been registered via this
* method.
*
- * @param oid object id of interface to be revoked
- * @param type the type description of the interface
+ * @param oid object id of interface to be revoked.
+ * @param type the type description of the interface.
* @see com.sun.star.uno.IEnvironment#revokeInterface
*/
public void revokeInterface(String oid, Type type) {
@@ -80,8 +89,8 @@ public final class java_environment implements IEnvironment {
* Retrieves an interface identified by its object id and type from this
* environment.
*
- * @param oid object id of interface to be retrieved
- * @param type the type description of the interface to be retrieved
+ * @param oid object id of interface to be retrieved.
+ * @param type the type description of the interface to be retrieved.
* @see com.sun.star.uno.IEnvironment#getRegisteredInterface
*/
public Object getRegisteredInterface(String oid, Type type) {
@@ -96,14 +105,17 @@ public final class java_environment implements IEnvironment {
* Retrieves the object identifier for a registered interface from this
* environment.
*
- * @param object a registered interface
+ * @param object a registered interface.
* @see com.sun.star.uno.IEnvironment#getRegisteredObjectIdentifier
*/
public String getRegisteredObjectIdentifier(Object object) {
return UnoRuntime.generateOid(object);
}
- // @see com.sun.star.uno.IEnvironment#list
+ /**
+ *
+ * @see com.sun.star.uno.IEnvironment#list
+ */
public void list() {
// TODO???
// synchronized (proxies) {
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 1409787567d2..f736142e0b20 100644
--- a/jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java
+++ b/jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java
@@ -51,24 +51,24 @@ public interface IProtocol {
* synchronized.</p>
*
* @return a non-null message; if the input stream is exhausted, a
- * <code>java.io.IOException</code> is thrown instead
+ * <code>java.io.IOException</code> is thrown instead.
*/
Message readMessage() throws IOException;
/**
* Writes a request message.
*
- * @param oid a non-null OID
- * @param type a non-null UNO type
+ * @param oid a non-null OID.
+ * @param type a non-null UNO type.
* @param function a non-null function (the name of a UNO interface method
* or attribute compatible with the given <code>type</code>, or either
- * <code>"queryInterface"</code> or <code>"release"</code>)
- * @param tid a non-null TID
+ * <code>"queryInterface"</code> or <code>"release"</code>).
+ * @param tid a non-null TID.
* @param arguments a list of UNO arguments compatible with the given
* <code>type</code> and <code>function</code>; may be null to represent
- * an empty list
+ * an empty list.
* @return <code>true</code> if the request message is sent as a synchronous
- * request
+ * request.
*/
boolean writeRequest(
String oid, TypeDescription type, String function, ThreadId tid,
@@ -79,11 +79,11 @@ public interface IProtocol {
* Writes a reply message.
*
* @param exception <code>true</code> if the reply corresponds to a raised
- * exception
- * @param tid a non-null TID
+ * exception.
+ * @param tid a non-null TID.
* @param result if <code>exception</code> is <code>true</code>, a non-null
* UNO exception; otherwise, a UNO return value, which may be null to
- * represent a <code>VOID</code> return value
+ * represent a <code>VOID</code> return value.
*/
void writeReply(boolean exception, ThreadId tid, Object result)
throws IOException;
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 e9a03783c5e2..385b79c2c230 100644
--- a/jurt/com/sun/star/lib/uno/environments/remote/IThreadPool.java
+++ b/jurt/com/sun/star/lib/uno/environments/remote/IThreadPool.java
@@ -19,9 +19,8 @@
package com.sun.star.lib.uno.environments.remote;
/**
- * This interface is an abstraction of the various
- * threadpool implementations.
- * <p>
+ * This interface is an abstraction of the various threadpool implementations.
+ *
* @see com.sun.star.lib.uno.environments.remote.ThreadPoolFactory
* @see com.sun.star.lib.uno.environments.remote.IThreadPoolFactory
* @since UDK1.0
@@ -29,25 +28,25 @@ package com.sun.star.lib.uno.environments.remote;
public interface IThreadPool {
/**
* Retrieves the global threadId for the current thread.
- * <p>
- * @return the thread id
+ *
+ * @return the thread id.
*/
ThreadId getThreadId();
/**
* Attaches this thread to the thread pool.
- * <p>
+ *
* @see #enter
*/
public void attach();
/**
- * As above, but hands in an already existing
- * instance of the threadid of the current thread.
- * Returns a handle which can be used in enter and
- * detach calls.<p>
- * The function exists for performance
- * optimization reasons.
+ * As above, but hands in an already existing instance of the threadid of
+ * the current thread.
+ *
+ * <p>The function exists for performance.</p>
+ *
+ * @return Returns a handle which can be used in enter and detach calls.
* @see #attach
*/
public Object attach( ThreadId id );
@@ -59,11 +58,11 @@ public interface IThreadPool {
public void detach();
/**
- * As above, but hands in an already existing
- * instance of the threadid of the current thread
- * and a handle returned by attach.
- * The function exists for performance
- * optimization reasons.
+ * As above, but hands in an already existing instance of the threadid of
+ * the current thread and a handle returned by attach.
+ *
+ * <p>The function exists for performance.</p>
+ *
* @see #attach()
* @see #detach()
*/
@@ -71,45 +70,44 @@ public interface IThreadPool {
/**
* Lets this thread enter the thread pool.
- * This thread then executes all jobs put via
- * <code>putJob</code> until a reply job arrives.
- * <p>
+ *
+ * <p>This thread then executes all jobs put via <code>putJob</code> until
+ * a reply job arrives.</p>
+ *
* @see #putJob
*/
public Object enter() throws Throwable;
/**
- * as above but hands in an already existing
- * instance of the threadid of the current thread
- * and a handle returned by attach.
- * This thread then executes all jobs put via
- * <code>putJob</code> until a reply job arrives.
- * <p>
+ * As above but hands in an already existing instance of the threadid of
+ * the current thread and a handle returned by attach.
+ *
+ * <p>This thread then executes all jobs put via <code>putJob</code> until
+ * a reply job arrives.</p>
+ *
* @see #putJob
*/
public Object enter( Object handle, ThreadId id ) throws Throwable;
/**
- * Queues a job into the jobQueue of the thread belonging
- * to the jobs threadId.
- * <p>
+ * Queues a job into the jobQueue of the thread belonging to the jobs
+ * threadId.
+ *
* @param job the job
*/
public void putJob(Job job);
/**
- * Disposes this thread pool, thus releasing
- * all threads by throwing a <code>DisposedException</code> with the given
- * <code>Throwable</code> cause.
- * <p>
+ * Disposes this thread pool, thus releasing all threads by throwing a
+ * <code>DisposedException</code> with the given <code>Throwable</code> cause.
+ *
* @param throwable the cause
*/
public void dispose(Throwable throwable);
/**
- * Destroys the thread pool and tries
- * to join all created threads immediately.
+ * Destroys the thread pool and tries to join all created threads immediately.
*/
public void destroy();
}
diff --git a/jurt/com/sun/star/lib/uno/environments/remote/JavaThreadPool.java b/jurt/com/sun/star/lib/uno/environments/remote/JavaThreadPool.java
index 0b6c8afc0f04..c43bcfa465f7 100644
--- a/jurt/com/sun/star/lib/uno/environments/remote/JavaThreadPool.java
+++ b/jurt/com/sun/star/lib/uno/environments/remote/JavaThreadPool.java
@@ -20,7 +20,7 @@ package com.sun.star.lib.uno.environments.remote;
/**
* This class implements a java thread pool.
- * <p>
+ *
* @see com.sun.star.uno.UnoRuntime
* @see com.sun.star.lib.uno.environments.remote.ThreadPool
* @see com.sun.star.lib.uno.environments.remote.IThreadPool
diff --git a/jurt/com/sun/star/lib/uno/environments/remote/Job.java b/jurt/com/sun/star/lib/uno/environments/remote/Job.java
index 29287190fbf1..47fc03342ef2 100644
--- a/jurt/com/sun/star/lib/uno/environments/remote/Job.java
+++ b/jurt/com/sun/star/lib/uno/environments/remote/Job.java
@@ -22,7 +22,6 @@ package com.sun.star.lib.uno.environments.remote;
import java.io.PrintWriter;
import java.io.StringWriter;
-
import java.lang.reflect.InvocationTargetException;
import com.sun.star.lib.uno.typedesc.MethodDescription;
@@ -35,7 +34,7 @@ import com.sun.star.uno.XCurrentContext;
/**
* The Job is an abstraction for tasks which have to be done
* remotely because of a method invocation.
- * <p>
+ *
* @see com.sun.star.lib.uno.environments.remote.ThreadId
* @see com.sun.star.lib.uno.environments.remote.IReceiver
* @since UDK1.0
@@ -56,9 +55,9 @@ public class Job {
}
/**
- * Dispatches a <code>queryInterface</code> call
- * <p>
- * @return the result of the call (should be an <code>Any</code>)
+ * Dispatches a <code>queryInterface</code> call.
+ *
+ * @return the result of the call (should be an <code>Any</code>).
*/
protected Object dispatch_queryInterface(Type type) {
Class<?> zInterface = type.getTypeDescription().getZClass();
@@ -153,8 +152,10 @@ public class Job {
// _disposeId = null;
}
- // The name of this method is chosen to generate a somewhat self-explanatory
- // stack trace:
+ /**
+ * The name of this method is chosen to generate a somewhat self-explanatory
+ * stack trace.
+ */
private Exception remoteUnoRequestRaisedException(Object exception) {
Exception e = (Exception) exception;
e.fillInStackTrace();
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 c8e246f74eeb..b5e240bc3a0a 100644
--- a/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java
+++ b/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java
@@ -22,13 +22,15 @@ import com.sun.star.lang.DisposedException;
/**
* The <code>JobQueue</code> implements a queue for jobs.
- * For every jobs thread id exists a job queue which is registered
- * at the <code>ThreadPool</code>.
- * A JobQueue is splitted in a sync job queue and an async job queue.
+ *
+ * <p>For every jobs thread id exists a job queue which is registered
+ * at the <code>ThreadPool</code>.</p>
+ *
+ * <p>A JobQueue is splitted in a sync job queue and an async job queue.
* The sync job queue is the registered queue, it delegates async jobs
* (put by <code>putjob</code>) into the async queue, which is only
- * known by the sync queue.
- * <p>
+ * known by the sync queue.</p>
+ *
* @see com.sun.star.lib.uno.environments.remote.ThreadPool
* @see com.sun.star.lib.uno.environments.remote.Job
* @see com.sun.star.lib.uno.environments.remote.ThreadId
@@ -61,7 +63,7 @@ public class JobQueue {
protected JavaThreadPoolFactory _javaThreadPoolFactory;
/**
- * A thread for dispatching jobs
+ * A thread for dispatching jobs.
*/
class JobDispatcher extends Thread {
Object _disposeId;
@@ -81,8 +83,7 @@ public class JobQueue {
try {
enter(2000, _disposeId);
- }
- catch(Throwable throwable) {
+ } catch(Throwable throwable) {
if(_head != null || _active) { // there was a job in progress, so give a stack
System.err.println(getClass().getName() + " - exception occurred:" + throwable);
throwable.printStackTrace(System.err);
@@ -107,10 +108,10 @@ public class JobQueue {
/**
- * Constructs a async job queue with the given thread id
- * which belongs to the given sync job queue.
- * <p>
- * @param threadId the thread id
+ * Constructs a async job queue with the given thread id which belongs to
+ * the given sync job queue.
+ *
+ * @param threadId the thread id.
* @see com.sun.star.lib.uno.environments.remote.ThreadId
*/
JobQueue(JavaThreadPoolFactory javaThreadPoolFactory, ThreadId threadId) {
@@ -135,9 +136,9 @@ public class JobQueue {
/**
* Constructs a sync job queue with the given thread id and the given thread.
- * <p>
- * @param threadId the thread id
- * @param createThread if true, the queue creates a worker thread if needed
+ *
+ * @param threadId the thread id.
+ * @param createThread if true, the queue creates a worker thread if needed.
* @see com.sun.star.lib.uno.environments.remote.ThreadId
*/
JobQueue(JavaThreadPoolFactory javaThreadPoolFactory, ThreadId threadId, boolean createThread){
@@ -150,9 +151,9 @@ public class JobQueue {
}
/**
- * Gives the thread id of this queue
- * <p>
- * @return the thread id
+ * Gives the thread id of this queue.
+ *
+ * @return the thread id.
* @see com.sun.star.lib.uno.environments.remote.ThreadId
*/
ThreadId getThreadId() {
@@ -185,9 +186,9 @@ public class JobQueue {
/**
* Removes a job from the queue.
- * <p>
- * @return a job or null if timed out
- * @param waitTime the maximum amount of time to wait for a job
+ *
+ * @param waitTime the maximum amount of time to wait for a job.
+ * @return a job or null if timed out.
*/
private Job removeJob(int waitTime) {
if(DEBUG) System.err.println("##### " + getClass().getName() + ".removeJob:" + _head + " " + _threadId);
@@ -209,8 +210,7 @@ public class JobQueue {
try {
// wait for new job
wait(waitTime);
- }
- catch(InterruptedException interruptedException) {
+ } catch(InterruptedException interruptedException) {
throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".removeJob - unexpected:" + interruptedException);
}
@@ -246,8 +246,7 @@ public class JobQueue {
try {
_async_jobQueue.wait();
- }
- catch(InterruptedException interruptedException) {
+ } catch(InterruptedException interruptedException) {
throw new com.sun.star.uno.RuntimeException(getClass().getName() + ".removeJob - unexpected:" + interruptedException);
}
}
@@ -259,9 +258,9 @@ public class JobQueue {
/**
* Puts a job into the queue.
- * <p>
- * @param job the job
- * @param disposeId a dispose id
+ *
+ * @param job the job.
+ * @param disposeId a dispose id.
*/
synchronized void putJob(Job job, Object disposeId) {
if(DEBUG) System.err.println("##### " + getClass().getName() + ".putJob todoes: " + " job:" + job);
@@ -287,9 +286,9 @@ public class JobQueue {
/**
* Enters the job queue.
- * <p>
- * @return the result of the final job (reply)
- * @param disposeId a dispose id
+ *
+ * @param disposeId a dispose id.
+ * @return the result of the final job (reply).
*/
Object enter(Object disposeId) throws Throwable {
return enter(0, disposeId); // wait infinitly
@@ -297,10 +296,10 @@ public class JobQueue {
/**
* Enters the job queue.
- * <p>
- * @return the result of the final job (reply)
- * @param waitTime the maximum amount of time to wait for a job (0 means wait infinitly)
- * @param disposeId a dispose id
+ *
+ * @param waitTime the maximum amount of time to wait for a job (0 means wait infinitly).
+ * @param disposeId a dispose id.
+ * @return the result of the final job (reply).
*/
Object enter(int waitTime, Object disposeId) throws Throwable {
if(DEBUG) System.err.println("#####" + getClass().getName() + ".enter: " + _threadId);
@@ -367,10 +366,9 @@ public class JobQueue {
}
/**
- * If the given disposeId is registered,
- * interrups the worker thread.
- * <p>
- * @param disposeId the dispose id
+ * If the given disposeId is registered, interrups the worker thread.
+ *
+ * @param disposeId the dispose id.
*/
synchronized void dispose(Object disposeId, Throwable throwable) {
if(_sync_jobQueue == null) { // dispose only sync queues
diff --git a/jurt/com/sun/star/lib/uno/environments/remote/Message.java b/jurt/com/sun/star/lib/uno/environments/remote/Message.java
index e1fa6a712670..f679d76b41bc 100644
--- a/jurt/com/sun/star/lib/uno/environments/remote/Message.java
+++ b/jurt/com/sun/star/lib/uno/environments/remote/Message.java
@@ -23,8 +23,8 @@ import com.sun.star.uno.ITypeDescription;
import com.sun.star.uno.XCurrentContext;
/**
- A remote request or reply message.
-*/
+ * A remote request or reply message.
+ */
public class Message {
public Message(
ThreadId threadId, boolean request, String objectId,
@@ -45,130 +45,130 @@ public class Message {
}
/**
- Returns the thread ID of the message.
-
- <p>Valid for all kinds of messages.</p>
-
- @return the (non-<code>null</code>) thread ID
- */
+ * Returns the thread ID of the message.
+ *
+ * <p>Valid for all kinds of messages.</p>
+ *
+ * @return the (non-<code>null</code>) thread ID.
+ */
public final ThreadId getThreadId() {
return threadId;
}
/**
- Returns whether the message is a request or a reply.
-
- <p>Valid for all kinds of messages.</p>
-
- @return <code>true</code> for a request, <code>false</code> for a reply
- */
+ * Returns whether the message is a request or a reply.
+ *
+ * <p>Valid for all kinds of messages.</p>
+ *
+ * @return <code>true</code> for a request, <code>false</code> for a reply.
+ */
public final boolean isRequest() {
return request;
}
/**
- Returns the object ID of a request message.
-
- <p>Valid only for request messages.</p>
-
- @return the (non-<code>null</code>) object ID for a request,
- <code>null</code> for a reply
- */
+ * Returns the object ID of a request message.
+ *
+ * <p>Valid only for request messages.</p>
+ *
+ * @return the (non-<code>null</code>) object ID for a request,
+ * <code>null</code> for a reply.
+ */
public final String getObjectId() {
return objectId;
}
/**
- Returns the type of a request message.
-
- <p>Valid only for request messages.</p>
-
- @return the (non-<code>null</code>) type for a request, <code>null</code>
- for a reply
- */
+ * Returns the type of a request message.
+ *
+ * <p>Valid only for request messages.</p>
+ *
+ * @return the (non-<code>null</code>) type for a request, <code>null</code>
+ * for a reply.
+ */
public final ITypeDescription getType() {
return type;
}
/**
- Returns the method description of a request message.
-
- <p>Valid only for request messages. The returned
- <code>IMethodDescription</code> is consistent with the type of the
- message.</p>
-
- @return the (non-<code>null</code>) method description for a request,
- <code>null</code> for a reply
- */
+ * Returns the method description of a request message.
+ *
+ * <p>Valid only for request messages. The returned
+ * <code>IMethodDescription</code> is consistent with the type of the
+ * message.</p>
+ *
+ * @return the (non-<code>null</code>) method description for a request,
+ * <code>null</code> for a reply.
+ */
public final IMethodDescription getMethod() {
return method;
}
/**
- Returns whether the request message is synchronous.
-
- <p>Valid only for request messages.</p>
-
- @return <code>true</code> for a synchronous request, <code>false</code>
- for an asynchronous request or a reply
- */
+ * Returns whether the request message is synchronous.
+ *
+ * <p>Valid only for request messages.</p>
+ *
+ * @return <code>true</code> for a synchronous request, <code>false</code>
+ * for an asynchronous request or a reply.
+ */
public final boolean isSynchronous() {
return synchronous;
}
/**
- Returns the current context of a request message.
-
- <p>Valid only for request messages.</p>
-
- @return the current context (which may be <code>null</code>) for a
- request, <code>null</code> for a reply
- */
+ * Returns the current context of a request message.
+ *
+ * <p>Valid only for request messages.</p>
+ *
+ * @return the current context (which may be <code>null</code>) for a
+ * request, <code>null</code> for a reply.
+ */
public XCurrentContext getCurrentContext() {
return currentContext;
}
/**
- Returns whether the reply message represents abnormal termination.
-
- <p>Valid only for reply messages.</p>
-
- @return <code>true</code> for a reply that represents abnormal
- termination, <code>false</code> for a reply that represents normal
- termination or a request
- */
+ * Returns whether the reply message represents abnormal termination.
+ *
+ * <p>Valid only for reply messages.</p>
+ *
+ * @return <code>true</code> for a reply that represents abnormal
+ * termination, <code>false</code> for a reply that represents normal
+ * termination or a request.
+ */
public final boolean isAbnormalTermination() {
return abnormalTermination;
}
/**
- Returns the result of a reply message.
-
- <p>Valid only for reply messages.</p>
-
- @return any (possibly <code>null</code>) return value for a reply that
- represents normal termination, the (non-<code>null</code>) exception for
- a reply that represents abnormal termination, <code>null</code> for a
- request
- */
+ * Returns the result of a reply message.
+ *
+ * <p>Valid only for reply messages.</p>
+ *
+ * @return any (possibly <code>null</code>) return value for a reply that
+ * represents normal termination, the (non-<code>null</code>) exception for
+ * a reply that represents abnormal termination, <code>null</code> for a
+ * request.
+ */
public final Object getResult() {
return result;
}
/**
- Returns the arguments of a message.
-
- <p>Valid only for request messages and reply messages that represent
- normal termination. Any returned array must not be modified.</p>
-
- @return the in and in&ndash {
- }out arguments for a request (possibly
- <code>null</code> for a paramterless function), the out and in&dash {
- }out
- arguments for a reply that represents normal termination (possibly
- <code>null</code> for a parameterless function), <code>null</code> for a
- reply that represents abnormal termination
- */
+ * Returns the arguments of a message.
+ *
+ * <p>Valid only for request messages and reply messages that represent
+ * normal termination. Any returned array must not be modified.</p>
+ *
+ * @return the in and in&ndash {
+ * }out arguments for a request (possibly
+ * <code>null</code> for a paramterless function), the out and in&dash {
+ * }out
+ * arguments for a reply that represents normal termination (possibly
+ * <code>null</code> for a parameterless function), <code>null</code> for a
+ * reply that represents abnormal termination.
+ */
public final Object[] getArguments() {
return arguments;
}
diff --git a/jurt/com/sun/star/lib/uno/environments/remote/ThreadId.java b/jurt/com/sun/star/lib/uno/environments/remote/ThreadId.java
index 7e2a9ad013f2..b652aaf130c0 100644
--- a/jurt/com/sun/star/lib/uno/environments/remote/ThreadId.java
+++ b/jurt/com/sun/star/lib/uno/environments/remote/ThreadId.java
@@ -41,11 +41,28 @@ public final class ThreadId {
this.id = id;
}
+ /**
+ * Indicates whether some other object is equal to this one.
+ *
+ * @param obj the reference object with which to compare.
+ * @return <code>true</code> if this object is the same as the obj argument;
+ * <code>false</code> otherwise.
+ *
+ * @see java.lang.Object#equals
+ */
+ @Override
public boolean equals(Object obj) {
return obj instanceof ThreadId
&& Arrays.equals(id, ((ThreadId) obj).id);
}
+ /**
+ * Returns a hash code value for the object.
+ *
+ * @return a hash code value for this object.
+ * @see java.lang.Object#hashCode
+ */
+ @Override
public int hashCode() {
int h = hash;
if (h == 0) {
@@ -60,6 +77,13 @@ public final class ThreadId {
return h;
}
+ /**
+ * Returns a string representation of the object.
+ *
+ * @return a string representation of the object.
+ * @see java.lang.Object#toString
+ */
+ @Override
public String toString() {
StringBuffer b = new StringBuffer("[ThreadId:");
for (int i = 0; i < id.length; ++i) {
diff --git a/jurt/com/sun/star/lib/uno/environments/remote/ThreadPoolManager.java b/jurt/com/sun/star/lib/uno/environments/remote/ThreadPoolManager.java
index 45711eaf6e3d..9718264be379 100644
--- a/jurt/com/sun/star/lib/uno/environments/remote/ThreadPoolManager.java
+++ b/jurt/com/sun/star/lib/uno/environments/remote/ThreadPoolManager.java
@@ -39,7 +39,7 @@ public final class ThreadPoolManager {
/**
* Creates a thread pool instance.
*
- * @return a new thread pool instance; will never be <CODE>null</CODE>
+ * @return a new thread pool instance; will never be <CODE>null</CODE>.
*/
public static synchronized IThreadPool create() {
if (useNative) {
@@ -56,7 +56,7 @@ public final class ThreadPoolManager {
* Leads to using the native thread pool factory, unless a Java thread pool
* has already been created.
*
- * @return <CODE>false</CODE> if a Java thread pool has already been created
+ * @return <CODE>false</CODE> if a Java thread pool has already been created.
*/
public static synchronized boolean useNative() {
useNative = javaFactory == null;
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 14affb5bd974..544a06406648 100644
--- a/jurt/com/sun/star/lib/uno/protocols/urp/Cache.java
+++ b/jurt/com/sun/star/lib/uno/protocols/urp/Cache.java
@@ -21,18 +21,18 @@ package com.sun.star.lib.uno.protocols.urp;
import java.util.HashMap;
/**
- An LRU cache for arbitrary objects.
-
- This class is not synchronized, as any necessary synchronization will already
- take place in the client.
-*/
+ * An LRU cache for arbitrary objects.
+ *
+ * <p>This class is not synchronized, as any necessary synchronization will already
+ * take place in the client.</p>
+ */
final class Cache {
/**
- Create a cache.
-
- @param size the maximum cache size, must be between 0, inclusive, and
- NOT_CACHED, exclusive
- */
+ * Create a cache.
+ *
+ * @param size the maximum cache size, must be between 0, inclusive, and
+ * NOT_CACHED, exclusive.
+ */
public Cache(int size) {
maxSize = size;
}
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 aac00536db92..08e7ef3380a2 100644
--- a/jurt/com/sun/star/lib/uno/protocols/urp/urp.java
+++ b/jurt/com/sun/star/lib/uno/protocols/urp/urp.java
@@ -46,10 +46,11 @@ import java.util.ArrayList;
import java.util.Random;
import java.util.StringTokenizer;
-// This class internally relies on the availability of Java UNO type information
-// for the interface type com.sun.star.bridge.XProtocolProperties, even though
-// URP itself does not rely on that type.
-
+/**
+ * This class internally relies on the availability of Java UNO type information
+ * for the interface type <code>com.sun.star.bridge.XProtocolProperties</code>,
+ * even though URP itself does not rely on that type.
+ */
public final class urp implements IProtocol {
public urp(
IBridge bridge, String attributes, InputStream input,
@@ -62,7 +63,10 @@ public final class urp implements IProtocol {
forceSynchronous = parseAttributes(attributes);
}
- // @see IProtocol#init
+ /**
+ *
+ * @see IProtocol#init
+ */
public void init() throws IOException {
synchronized (monitor) {
if (state == STATE_INITIAL0) {
@@ -71,7 +75,10 @@ public final class urp implements IProtocol {
}
}
- // @see IProtocol#terminate
+ /**
+ *
+ * @see IProtocol#terminate
+ */
public void terminate() {
synchronized (monitor) {
state = STATE_TERMINATED;
@@ -80,7 +87,10 @@ public final class urp implements IProtocol {
}
}
- // @see IProtocol#readMessage
+ /**
+ *
+ * @see IProtocol#readMessage
+ */
public Message readMessage() throws IOException {
for (;;) {
if (!unmarshal.hasMore()) {
@@ -108,7 +118,10 @@ public final class urp implements IProtocol {
}
}
- // @see IProtocol#writeRequest
+ /**
+ *
+ * @see IProtocol#writeRequest
+ */
public boolean writeRequest(
String oid, TypeDescription type, String function, ThreadId tid,
Object[] arguments)
@@ -133,7 +146,10 @@ public final class urp implements IProtocol {
}
}
- // @see IProtocol#writeReply
+ /**
+ *
+ * @see IProtocol#writeReply
+ */
public void writeReply(boolean exception, ThreadId tid, Object result)
throws IOException
{