summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-12-19 05:17:53 (EST)
committerEike Stepper2007-12-19 05:17:53 (EST)
commit770c31135140717474bba3c790362a0538b46b5b (patch)
tree9a0707e0d105a9fe199dd46d70d06e9e9b5a42b3
parentbefcf5be6404649485ee3751d2101046ec63a33e (diff)
downloadcdo-770c31135140717474bba3c790362a0538b46b5b.zip
cdo-770c31135140717474bba3c790362a0538b46b5b.tar.gz
cdo-770c31135140717474bba3c790362a0538b46b5b.tar.bz2
[213432] Make commit timeout configurable
https://bugs.eclipse.org/bugs/show_bug.cgi?id=213432
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/preferences/CDOPreferencePage.java31
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransaction.java6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java16
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/OM.java4
4 files changed, 45 insertions, 12 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/preferences/CDOPreferencePage.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/preferences/CDOPreferencePage.java
index c519da9..5fa4413 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/preferences/CDOPreferencePage.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/preferences/CDOPreferencePage.java
@@ -43,6 +43,8 @@ public class CDOPreferencePage extends OMPreferencePage
private Button invalidationNotifications;
+ private TextAndDisable commitTimeout;
+
public CDOPreferencePage()
{
super(org.eclipse.emf.internal.cdo.bundle.OM.PREFS);
@@ -87,6 +89,15 @@ public class CDOPreferencePage extends OMPreferencePage
new Label(viewGroup, SWT.NONE).setText("EMF invalidation notifications:");
invalidationNotifications = new Button(viewGroup, SWT.CHECK);
+ Group transactionGroup = new Group(composite, SWT.NONE);
+ transactionGroup.setLayout(new GridLayout(2, false));
+ transactionGroup.setText("Transaction Defaults");
+ transactionGroup.setLayoutData(UIUtil.createGridData(true, false));
+
+ new Label(transactionGroup, SWT.NONE).setText("Default commit timeout:");
+ commitTimeout = new TextAndDisable(transactionGroup, SWT.BORDER, "0");
+ commitTimeout.setLayoutData(UIUtil.createGridData(true, false));
+
initValues();
return composite;
}
@@ -102,6 +113,8 @@ public class CDOPreferencePage extends OMPreferencePage
.valueOf(org.eclipse.emf.internal.cdo.bundle.OM.PREF_LOAD_REVISION_COLLECTION_CHUNK_SIZE.getValue()));
invalidationNotifications
.setSelection(org.eclipse.emf.internal.cdo.bundle.OM.PREF_ENABLE_INVALIDATION_NOTIFICATIONS.getValue());
+ commitTimeout.setValue(String
+ .valueOf(org.eclipse.emf.internal.cdo.bundle.OM.PREF_DEFAULT_COMMIT_TIMEOUT.getValue()));
}
@Override
@@ -110,16 +123,14 @@ public class CDOPreferencePage extends OMPreferencePage
org.eclipse.emf.internal.cdo.bundle.OM.PREF_REPOSITORY_NAME.setValue(repositoryName.getText());
org.eclipse.emf.internal.cdo.bundle.OM.PREF_USER_NAME.setValue(userName.getText());
org.eclipse.emf.internal.cdo.bundle.OM.PREF_CONNECTOR_DESCRIPTION.setValue(connectorDescription.getText());
-
- int v1 = Integer.parseInt(referenceChunkSize.getValue());
- org.eclipse.emf.internal.cdo.bundle.OM.PREF_REFERENCE_CHUNK_SIZE.setValue(v1);
-
- int v2 = Integer.parseInt(preloadChunkSize.getValue());
- org.eclipse.emf.internal.cdo.bundle.OM.PREF_LOAD_REVISION_COLLECTION_CHUNK_SIZE.setValue(v2);
-
- boolean v3 = invalidationNotifications.getSelection();
- org.eclipse.emf.internal.cdo.bundle.OM.PREF_ENABLE_INVALIDATION_NOTIFICATIONS.setValue(v3);
-
+ org.eclipse.emf.internal.cdo.bundle.OM.PREF_REFERENCE_CHUNK_SIZE.setValue(Integer.parseInt(referenceChunkSize
+ .getValue()));
+ org.eclipse.emf.internal.cdo.bundle.OM.PREF_LOAD_REVISION_COLLECTION_CHUNK_SIZE.setValue(Integer
+ .parseInt(preloadChunkSize.getValue()));
+ org.eclipse.emf.internal.cdo.bundle.OM.PREF_ENABLE_INVALIDATION_NOTIFICATIONS.setValue(invalidationNotifications
+ .getSelection());
+ org.eclipse.emf.internal.cdo.bundle.OM.PREF_DEFAULT_COMMIT_TIMEOUT.setValue(Long
+ .parseLong(commitTimeout.getValue()));
return super.performOk();
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransaction.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransaction.java
index f641012..7d16b1f 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransaction.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOTransaction.java
@@ -31,6 +31,12 @@ import java.util.Map;
*/
public interface CDOTransaction extends CDOView
{
+ public static final long DEFAULT_COMMIT_TIMEOUT = 100000L;
+
+ public long getCommitTimeout();
+
+ public void setCommitTimeout(long timeout);
+
/**
* @see ResourceSet#createResource(URI)
*/
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
index eff78db..ce321d2 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOTransactionImpl.java
@@ -82,9 +82,12 @@ public class CDOTransactionImpl extends CDOViewImpl implements CDOTransaction
private boolean conflict;
+ private long commitTimeout;
+
public CDOTransactionImpl(int id, CDOSessionImpl session)
{
super(id, session);
+ commitTimeout = OM.PREF_DEFAULT_COMMIT_TIMEOUT.getValue();
}
@Override
@@ -136,6 +139,16 @@ public class CDOTransactionImpl extends CDOViewImpl implements CDOTransaction
fireEvent(event);
}
+ public long getCommitTimeout()
+ {
+ return commitTimeout;
+ }
+
+ public void setCommitTimeout(long timeout)
+ {
+ commitTimeout = timeout;
+ }
+
public List<CDOPackage> getNewPackages()
{
return newPackages;
@@ -201,8 +214,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements CDOTransaction
IFailOverStrategy failOverStrategy = session.getFailOverStrategy();
CommitTransactionRequest request = new CommitTransactionRequest(channel, this);
- // TODO Change timeout semantics in Net4j
- CommitTransactionResult result = failOverStrategy.send(request, 100000L);
+ CommitTransactionResult result = failOverStrategy.send(request, commitTimeout);
String rollbackMessage = result.getRollbackMessage();
if (rollbackMessage != null)
{
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/OM.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/OM.java
index 3bd2a1f..0ba97f6 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/OM.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/OM.java
@@ -10,6 +10,7 @@
**************************************************************************/
package org.eclipse.emf.internal.cdo.bundle;
+import org.eclipse.emf.cdo.CDOTransaction;
import org.eclipse.emf.cdo.CDOView;
import org.eclipse.emf.cdo.protocol.revision.CDORevision;
@@ -78,4 +79,7 @@ public abstract class OM
public static final OMPreference<Integer> PREF_LOAD_REVISION_COLLECTION_CHUNK_SIZE = //
PREFS.init("PREF_LOAD_REVISION_COLLECTION_CHUNK_SIZE", CDOView.NO_PRELOAD); //$NON-NLS-1$
+
+ public static final OMPreference<Long> PREF_DEFAULT_COMMIT_TIMEOUT = //
+ PREFS.init("PREF_DEFAULT_COMMIT_TIMEOUT", CDOTransaction.DEFAULT_COMMIT_TIMEOUT); //$NON-NLS-1$
}