You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by da...@apache.org on 2017/09/16 08:27:31 UTC
svn commit: r1808517 [2/2] - in /openoffice/trunk/main:
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/
connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/comphelper/
connectivity/java/sdbc_postgresql/src...
Modified: openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxTableDescriptor.java
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxTableDescriptor.java?rev=1808517&r1=1808516&r2=1808517&view=diff
==============================================================================
--- openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxTableDescriptor.java (original)
+++ openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/sdbcx/descriptors/SdbcxTableDescriptor.java Sat Sep 16 08:27:31 2017
@@ -40,16 +40,15 @@ public class SdbcxTableDescriptor extend
private OContainer columns;
private OContainer keys;
- protected SdbcxTableDescriptor(Object lock, boolean isCaseSensitive) {
- super(lock, "", isCaseSensitive, false);
- columns = new SdbcxColumnDescriptorContainer(this.lock, isCaseSensitive());
- keys = new SdbcxKeyDescriptorContainer(this.lock, isCaseSensitive());
+ protected SdbcxTableDescriptor(boolean isCaseSensitive) {
+ super("", isCaseSensitive, false);
+ columns = new SdbcxColumnDescriptorContainer(this, isCaseSensitive());
+ keys = new SdbcxKeyDescriptorContainer(this, isCaseSensitive());
registerProperties();
}
public static SdbcxTableDescriptor create(boolean isCaseSensitive) {
- final Object lock = new Object();
- return new SdbcxTableDescriptor(lock, isCaseSensitive);
+ return new SdbcxTableDescriptor(isCaseSensitive);
}
private void registerProperties() {
Modified: openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/DatabaseMetaDataResultSet.java
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/DatabaseMetaDataResultSet.java?rev=1808517&r1=1808516&r2=1808517&view=diff
==============================================================================
--- openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/DatabaseMetaDataResultSet.java (original)
+++ openoffice/trunk/main/connectivity/java/sdbc_postgresql/src/com/sun/star/sdbcx/comp/postgresql/util/DatabaseMetaDataResultSet.java Sat Sep 16 08:27:31 2017
@@ -22,7 +22,6 @@
package com.sun.star.sdbcx.comp.postgresql.util;
import java.util.ArrayList;
-import java.util.concurrent.atomic.AtomicBoolean;
import com.sun.star.beans.PropertyVetoException;
import com.sun.star.beans.UnknownPropertyException;
@@ -32,7 +31,6 @@ import com.sun.star.beans.XPropertySetIn
import com.sun.star.beans.XVetoableChangeListener;
import com.sun.star.container.XNameAccess;
import com.sun.star.io.XInputStream;
-import com.sun.star.lang.DisposedException;
import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.lang.WrappedTargetException;
import com.sun.star.lib.uno.helper.ComponentBase;
@@ -66,7 +64,6 @@ public class DatabaseMetaDataResultSet e
private XPropertySet implPropertySet;
private XColumnsSupplier implColumnSupplier;
private ArrayList<ORowSetValue[]> rows;
- private AtomicBoolean isDisposed = new AtomicBoolean(false);
/// 0-based:
private int currentRow = -1;
/// 1-based:
@@ -84,19 +81,12 @@ public class DatabaseMetaDataResultSet e
// XComponent:
@Override
protected void postDisposing() {
- isDisposed.set(true);
try {
implCloseable.close();
} catch (SQLException sqlException) {
}
}
- private void checkDisposed() throws DisposedException {
- if (isDisposed.get()) {
- throw new DisposedException();
- }
- }
-
// XCloseable:
public void close() throws SQLException {
@@ -156,7 +146,7 @@ public class DatabaseMetaDataResultSet e
return currentRow + 1;
}
- public Object getStatement() throws SQLException {
+ public synchronized Object getStatement() throws SQLException {
checkDisposed();
return null;
}
@@ -203,7 +193,7 @@ public class DatabaseMetaDataResultSet e
return currentRow > -1;
}
- public void refreshRow() throws SQLException {
+ public synchronized void refreshRow() throws SQLException {
checkDisposed();
}
@@ -221,41 +211,41 @@ public class DatabaseMetaDataResultSet e
return true;
}
- public boolean rowDeleted() throws SQLException {
+ public synchronized boolean rowDeleted() throws SQLException {
checkDisposed();
return false;
}
- public boolean rowInserted() throws SQLException {
+ public synchronized boolean rowInserted() throws SQLException {
checkDisposed();
return false;
}
- public boolean rowUpdated() throws SQLException {
+ public synchronized boolean rowUpdated() throws SQLException {
checkDisposed();
return false;
}
// XResultSetMetaDataSupplier:
- public XResultSetMetaData getMetaData() throws SQLException {
+ public synchronized XResultSetMetaData getMetaData() throws SQLException {
checkDisposed();
return new PostgresqlResultSetMetaData(implResultSetMetaDataSupplier.getMetaData());
}
// XRow:
- public XArray getArray(int columnIndex) throws SQLException {
+ public synchronized XArray getArray(int columnIndex) throws SQLException {
checkDisposed();
return null;
}
- public XInputStream getBinaryStream(int columnIndex) throws SQLException {
+ public synchronized XInputStream getBinaryStream(int columnIndex) throws SQLException {
checkDisposed();
return null;
}
- public XBlob getBlob(int columnIndex) throws SQLException {
+ public synchronized XBlob getBlob(int columnIndex) throws SQLException {
checkDisposed();
return null;
}
@@ -278,12 +268,12 @@ public class DatabaseMetaDataResultSet e
return field.getSequence();
}
- public XInputStream getCharacterStream(int columnIndex) throws SQLException {
+ public synchronized XInputStream getCharacterStream(int columnIndex) throws SQLException {
checkDisposed();
return null;
}
- public XClob getClob(int columnIndex) throws SQLException {
+ public synchronized XClob getClob(int columnIndex) throws SQLException {
checkDisposed();
return null;
}
@@ -324,7 +314,7 @@ public class DatabaseMetaDataResultSet e
return field.makeAny();
}
- public XRef getRef(int columnIndex) throws SQLException {
+ public synchronized XRef getRef(int columnIndex) throws SQLException {
checkDisposed();
return null;
}
@@ -361,44 +351,44 @@ public class DatabaseMetaDataResultSet e
// XColumnLocate:
- public int findColumn(String arg0) throws SQLException {
+ public synchronized int findColumn(String arg0) throws SQLException {
checkDisposed();
return implColumnLocate.findColumn(arg0);
}
// XPropertySet:
- public void addPropertyChangeListener(String arg0, XPropertyChangeListener arg1) throws UnknownPropertyException, WrappedTargetException {
+ public synchronized void addPropertyChangeListener(String arg0, XPropertyChangeListener arg1) throws UnknownPropertyException, WrappedTargetException {
checkDisposed();
implPropertySet.addPropertyChangeListener(arg0, arg1);
}
- public void addVetoableChangeListener(String arg0, XVetoableChangeListener arg1) throws UnknownPropertyException, WrappedTargetException {
+ public synchronized void addVetoableChangeListener(String arg0, XVetoableChangeListener arg1) throws UnknownPropertyException, WrappedTargetException {
checkDisposed();
implPropertySet.addVetoableChangeListener(arg0, arg1);
}
- public XPropertySetInfo getPropertySetInfo() {
+ public synchronized XPropertySetInfo getPropertySetInfo() {
checkDisposed();
return implPropertySet.getPropertySetInfo();
}
- public Object getPropertyValue(String arg0) throws UnknownPropertyException, WrappedTargetException {
+ public synchronized Object getPropertyValue(String arg0) throws UnknownPropertyException, WrappedTargetException {
checkDisposed();
return implPropertySet.getPropertyValue(arg0);
}
- public void removePropertyChangeListener(String arg0, XPropertyChangeListener arg1) throws UnknownPropertyException, WrappedTargetException {
+ public synchronized void removePropertyChangeListener(String arg0, XPropertyChangeListener arg1) throws UnknownPropertyException, WrappedTargetException {
checkDisposed();
implPropertySet.removePropertyChangeListener(arg0, arg1);
}
- public void removeVetoableChangeListener(String arg0, XVetoableChangeListener arg1) throws UnknownPropertyException, WrappedTargetException {
+ public synchronized void removeVetoableChangeListener(String arg0, XVetoableChangeListener arg1) throws UnknownPropertyException, WrappedTargetException {
checkDisposed();
implPropertySet.removeVetoableChangeListener(arg0, arg1);
}
- public void setPropertyValue(String arg0, Object arg1)
+ public synchronized void setPropertyValue(String arg0, Object arg1)
throws UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException {
checkDisposed();
implPropertySet.setPropertyValue(arg0, arg1);
@@ -406,7 +396,7 @@ public class DatabaseMetaDataResultSet e
// XRowLocate:
- public int compareBookmarks(Object arg0, Object arg1) throws SQLException {
+ public synchronized int compareBookmarks(Object arg0, Object arg1) throws SQLException {
checkDisposed();
int bookmark1, bookmark2;
@@ -426,17 +416,17 @@ public class DatabaseMetaDataResultSet e
}
}
- public Object getBookmark() throws SQLException {
+ public synchronized Object getBookmark() throws SQLException {
checkDisposed();
return currentRow;
}
- public boolean hasOrderedBookmarks() throws SQLException {
+ public synchronized boolean hasOrderedBookmarks() throws SQLException {
checkDisposed();
return true;
}
- public int hashBookmark(Object arg0) throws SQLException {
+ public synchronized int hashBookmark(Object arg0) throws SQLException {
checkDisposed();
int bookmark;
try {
@@ -447,7 +437,7 @@ public class DatabaseMetaDataResultSet e
return bookmark;
}
- public boolean moveRelativeToBookmark(Object arg0, int arg1) throws SQLException {
+ public synchronized boolean moveRelativeToBookmark(Object arg0, int arg1) throws SQLException {
checkDisposed();
int bookmark;
boolean moved = false;
@@ -465,7 +455,7 @@ public class DatabaseMetaDataResultSet e
return moved;
}
- public boolean moveToBookmark(Object arg0) throws SQLException {
+ public synchronized boolean moveToBookmark(Object arg0) throws SQLException {
checkDisposed();
int bookmark;
boolean moved = false;
@@ -482,7 +472,7 @@ public class DatabaseMetaDataResultSet e
// XColumnSupplier:
- public XNameAccess getColumns() {
+ public synchronized XNameAccess getColumns() {
checkDisposed();
return implColumnSupplier.getColumns();
}
Modified: openoffice/trunk/main/javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java?rev=1808517&r1=1808516&r2=1808517&view=diff
==============================================================================
--- openoffice/trunk/main/javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java (original)
+++ openoffice/trunk/main/javaunohelper/com/sun/star/lib/uno/helper/ComponentBase.java Sat Sep 16 08:27:31 2017
@@ -22,6 +22,7 @@
package com.sun.star.lib.uno.helper;
+import com.sun.star.lang.DisposedException;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XEventListener;
import com.sun.star.lang.EventObject;
@@ -45,6 +46,20 @@ public class ComponentBase extends WeakB
super();
listenerContainer= new MultiTypeInterfaceContainer();
}
+
+ /** Checks whether this component (which you should have locked, prior to this call, and until you are done using) is disposed.
+ * @return whether this component is disposed
+ */
+ protected synchronized final boolean isDisposed() {
+ return bInDispose || bDisposed;
+ }
+
+ /** Checks whether this component (which you should have locked, prior to this call, and until you are done using) is disposed, throwing DisposedException if it is. */
+ protected synchronized final void checkDisposed() {
+ if (bInDispose || bDisposed) {
+ throw new DisposedException();
+ }
+ }
/** Override to perform extra clean-up work. Provided for subclasses. It is
called during dispose()