|
|
Re: [CDO] Rollback problem [message #985771 is a reply to message #985269] |
Fri, 16 November 2012 05:31 |
|
Am 15.11.2012 15:03, schrieb Emin M.:
> Hello,
>
> i have a problem with the rollback feature of CDO. I have a treeviewer and some editing fields under this
> treeviewer(Textfields and ComboViewers). If an element in this treeviewer was selected, this elements properties will
> be bind via EMF DataBinding. If the fields were edited, the model will be changed, this part is ok. But if i select
> another Element without clicking the save button, the values should be undone.
> Part of the SelectionListener of my treeviewer:
>
> bindingContext.dispose();
> if (transaction != null) {
> transaction.getLastSavepoint().rollback();
transaction.rollback() should do it, if you don't care about save points in other places.
> }
> transaction.setSavepoint();
And then you don't need this either.
> The SelectionListener of the Save Button.
>
> @Override
> public void widgetSelected(SelectionEvent e) {
> if (transaction == null) {
> return;
> }
> try {
> transaction.commit();
> } catch (CommitException e1) {
> e1.printStackTrace();
If you don't use explicit/pessimistic locks you usually cannot just ignore this in a multi-user setup. You must handle
commit conflict here, e.g., by rolling back the transaction and replaying your changes and committing again.
> }
> }
>
>
> But it doesn't work like i thought.
So, how does it behave. In case of exceptions don't forget to share the full stack trace!
> Is this a bug,
What??
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
> or do i have to realize this in other way?
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
Re: [CDO] Rollback problem [message #985821 is a reply to message #985814] |
Fri, 16 November 2012 09:43 |
|
Am 16.11.2012 10:20, schrieb Emin M.:
> Thank you for the fast replies.
>
>
> Ok, i understood the following:
>
> - Lock the Container Object.
Who said that?
> - The user can select an TreeViewer element, the user can edit the element and if another element was selected without
> clicking the save button the transition will be rolled back. (Without using savepoints)
>
> - Unlock the Container Object.
>
> So, i've tried to lock the container object:
> transaction = session.openTransaction();
> buchung.cdoWriteLock();
That would be rather:
CDOLock myLock = buchung.cdoWriteLock();
myLock.lock(millis);
But the main problem seems to be that your "buchung" object is in state TRANSIENT. You can't lock it in this state
because neither the server nor even the local transaction already know about it.
> The buchung object is the Container Element. I get the following Exception:
>
>
> !ENTRY org.eclipse.e4.ui.workbench 4 0 2012-11-16 10:01:24.183
> !MESSAGE !STACK 0
> java.lang.IllegalStateException: Call CDOView.lockObjects() for transient object Buchung?
See above.
> at org.eclipse.emf.internal.cdo.CDOObjectImpl.createLock(CDOObjectImpl.java:1089)
> at org.eclipse.emf.internal.cdo.CDOObjectImpl.cdoWriteLock(CDOObjectImpl.java:196)
> at de.emin.bachelorarbeit.traveloffice.maintool.buchungpages.FlugBuchungPage.<init>(FlugBuchungPage.java:100)
> at de.emin.bachelorarbeit.traveloffice.maintool.views.BuchungsEditorView.createControlPart(BuchungsEditorView.java:87)
> at
> de.emin.bachelorarbeit.traveloffice.maintool.views.AbstractTravelOfficeView.createPartControl(AbstractTravelOfficeView.java:23)
> at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPartControl(CompatibilityPart.java:129)
> at org.eclipse.ui.internal.e4.compatibility.CompatibilityView.createPartControl(CompatibilityView.java:155)
> at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:300)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:601)
> at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
> at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:859)
> at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:839)
> at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:111)
> at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:319)
> at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:240)
> at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:161)
> at
> org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:102)
> at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:71)
> at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:53)
> at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:141)
> at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:896)
> at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:630)
> at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$6.run(PartRenderingEngine.java:518)
> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
> at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:503)
> at org.eclipse.e4.ui.workbench.renderers.swt.ElementReferenceRenderer.createWidget(ElementReferenceRenderer.java:74)
> at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:896)
> at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:630)
> at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:732)
> at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:703)
> at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:697)
> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
> at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:682)
> at org.eclipse.e4.ui.internal.workbench.PartServiceImpl$1.handleEvent(PartServiceImpl.java:96)
> at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:41)
> at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180)
> at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
> at org.eclipse.swt.widgets.Display.syncExec(Display.java:4687)
> at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:187)
> at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38)
> at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197)
> at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197)
> at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
> at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
> at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
> at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135)
> at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)
> at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)
> at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:81)
> at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:58)
> at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
> at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:171)
> at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:418)
> at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:385)
> at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.delegateBringToTop(PartServiceImpl.java:579)
> at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:558)
> at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:532)
> at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:521)
> at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:978)
> at org.eclipse.ui.internal.WorkbenchPage.showPart(WorkbenchPage.java:1203)
> at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:1169)
> at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.java:3774)
> at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
> at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3771)
> at
> de.emin.bachelorarbeit.traveloffice.maintool.intro.ApplicationActionBarAdvisor$1.run(ApplicationActionBarAdvisor.java:31)
> at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
> at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
> at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
> at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
> at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1029)
> at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
> at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:923)
> at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
> at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
> at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
> at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
> at de.emin.bachelorarbeit.traveloffice.maintool.intro.Application.start(Application.java:20)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:601)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
>
>
> So, i've tried it with CDOView.lockObjects() (buchung.cdoView().lockObjects(objects, lockType, timeout)), but i've got
> an NullPointerException.
That can't work either, for the same reason. But an NPE is odd. Can you please submit a bugzilla, so that I can revisit
the exception/message?
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: [CDO] Rollback problem [message #985829 is a reply to message #985821] |
Fri, 16 November 2012 10:03 |
Mehmet Karaman Messages: 63 Registered: November 2012 Location: Berlin |
Member |
|
|
Ok, i've filed a bug and attached the stacktrace to it.
The problem starts maybe here:
Buchung buchung = TravelofficedatamodelFactory.eINSTANCE.createBuchung();
setPartName(buchung.toString() + " Buchungseditor");
pages.add(new FlugBuchungPage(buchung));
For experimental things i've not added the Buchung to the Resource.. So its maybe normal that the local transaction nor the server doesn't knows about it. So maybe this wasn't a bug? If so, sorry about this misstake.
Thank you again for your help.
EDIT: This was not an bug. After adding the "Buchung" to the Resource i've got DanglingReferenceExceptions.
[Updated on: Fri, 16 November 2012 10:05] Report message to a moderator
|
|
|
|
|
Re: [CDO] Rollback problem [message #985992 is a reply to message #985943] |
Sat, 17 November 2012 04:19 |
|
Am 16.11.2012 20:12, schrieb Emin M.:
> The DanglingReference Exception was thrown because the is Containment Property of the ECore Diagram wasn't set. Now
> this was fixed.
>
> But the rollback isn't working and its also not throwing an exception.
Because of our tests it's highly likely that something in CDO is totally broken. There may be smaller bugs, in what case
I'd need to be able to reproduce your problem. To that point I must assume that you're simply using CDO wrongly. For
example, if you set a save point explicitely after your last changes and then, a little later, try to rollback to that
save point it's clear that nothing will happen.
> Why it doesn't work or what preconditions does the rollback feature need?
Please have a look at our tests. They are very simple to write. Are you able to write such a test case that reproduces
your problem?
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Powered by
FUDForum. Page generated in 0.04468 seconds