提交 23ca27d9 编写于 作者: J jurgen

H2 driver update

Attached jobs model
上级 921c71b3
......@@ -2,6 +2,6 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: H2 driver
Bundle-SymbolicName: org.jkiss.dbeaver.resources.h2;singleton:=true
Bundle-Version: 1.3.173
Bundle-Version: 1.4.185
Bundle-Vendor: H2
Bundle-ActivationPolicy: lazy
source.. =
bin.includes = .,plugin.xml,META-INF/,drivers/h2/LICENSE.txt,drivers/h2/h2-1.3.173.jar
bin.includes = .,plugin.xml,META-INF/,drivers/h2/LICENSE.txt,drivers/h2/h2-1.4.185.jar
src.includes =
......@@ -2,6 +2,6 @@
<plugin>
<extension point="org.jkiss.dbeaver.resources">
<resource name="drivers/h2/LICENSE.txt"/>
<resource name="drivers/h2/h2-1.3.173.jar"/>
<resource name="drivers/h2/h2-1.4.185.jar"/>
</extension>
</plugin>
\ No newline at end of file
......@@ -256,12 +256,14 @@ public abstract class JDBCDataSource
}
@Override
public synchronized void initialize(DBRProgressMonitor monitor)
public void initialize(DBRProgressMonitor monitor)
throws DBException
{
if (!isEmbeddedDataSource() && container.getPreferenceStore().getBoolean(DBeaverPreferences.META_SEPARATE_CONNECTION)) {
this.metaContext = new JDBCExecutionContext(this, "Metadata reader", false);
this.metaContext.connect(monitor, true, null);
synchronized (this) {
this.metaContext = new JDBCExecutionContext(this, "Metadata reader", false);
this.metaContext.connect(monitor, true, null);
}
}
JDBCSession session = openSession(monitor, DBCExecutionPurpose.META, CoreMessages.model_html_read_database_meta_data);
try {
......
......@@ -41,6 +41,11 @@ public abstract class AbstractJob extends Job
private volatile boolean finished = false;
private volatile boolean blockCanceled = false;
private int cancelTimeout = TIMEOUT_BEFORE_BLOCK_CANCEL;
private AbstractJob attachedJob = null;
// Attached job may be used to "overwrite" current job.
// It happens if some other AbstractJob runs in sync mode
protected final static ThreadLocal<AbstractJob> CURRENT_JOB = new ThreadLocal<AbstractJob>();
protected AbstractJob(String name)
{
......@@ -63,6 +68,10 @@ public abstract class AbstractJob extends Job
return thread == null ? Thread.currentThread() : thread;
}
public void setAttachedJob(AbstractJob attachedJob) {
this.attachedJob = attachedJob;
}
public final IStatus runDirectly(DBRProgressMonitor monitor)
{
progressMonitor = monitor;
......@@ -86,10 +95,12 @@ public abstract class AbstractJob extends Job
{
progressMonitor = RuntimeUtils.makeMonitor(monitor);
blockCanceled = false;
CURRENT_JOB.set(this);
try {
finished = false;
return this.run(progressMonitor);
} finally {
CURRENT_JOB.remove();
finished = true;
}
}
......@@ -100,6 +111,10 @@ public abstract class AbstractJob extends Job
@Override
protected void canceling()
{
if (attachedJob != null) {
attachedJob.canceling();
return;
}
// Run canceling job
if (!blockCanceled) {
Job cancelJob = new Job("Cancel block") { //$NON-N LS-1$
......
......@@ -25,12 +25,15 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.progress.IProgressConstants;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.core.CoreMessages;
import org.jkiss.dbeaver.core.DBeaverCore;
import org.jkiss.dbeaver.model.DBPConnectionEventType;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.registry.DataSourceDescriptor;
import org.jkiss.dbeaver.runtime.AbstractJob;
import org.jkiss.dbeaver.runtime.RuntimeUtils;
import org.jkiss.dbeaver.runtime.VoidProgressMonitor;
/**
* ConnectJob
......@@ -88,9 +91,19 @@ public class ConnectJob extends EventProcessorJob
public IStatus runSync(DBRProgressMonitor monitor)
{
setThread(Thread.currentThread());
reflect = false;
return run(monitor);
AbstractJob curJob = CURRENT_JOB.get();
if (curJob != null) {
curJob.setAttachedJob(this);
}
try {
setThread(Thread.currentThread());
reflect = false;
return run(monitor);
} finally {
if (curJob != null) {
curJob.setAttachedJob(null);
}
}
}
@Override
......
......@@ -320,7 +320,7 @@
defaultPort="9092"
webURL="http://www.h2database.com/"
description="H2 Server">
<file type="jar" path="drivers/h2/h2-1.3.173.jar" url="*"/>
<file type="jar" path="drivers/h2/h2-1.4.185.jar" url="*"/>
<file type="license" path="drivers/h2/LICENSE.txt" url="*"/>
</driver>
<driver
......@@ -332,7 +332,7 @@
webURL="http://www.h2database.com/"
description="H2 Embedded">
<parameter name="embedded" value="true"/>
<file type="jar" path="drivers/h2/h2-1.3.173.jar" url="*"/>
<file type="jar" path="drivers/h2/h2-1.4.185.jar" url="*"/>
<file type="license" path="drivers/h2/LICENSE.txt" url="*"/>
</driver>
<driver
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册