Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] ClassCastException when removing one entry from the model
[CDO] ClassCastException when removing one entry from the model [message #989023] Tue, 04 December 2012 10:48 Go to next message
Silvestre Martins is currently offline Silvestre MartinsFriend
Messages: 84
Registered: July 2009
Member
I have a simple test, where I get the resource and try to remove the last entry from the contents list:

CDOResource resource = tx.getOrCreateResource(RESOURCE_NAME);
EList<EObject> contents = resource.getContents();
int size = contents.size();
    		
contents.remove(size-1);
    			
tx.commit();


The list contains 200.000 entries.
If I run the test just after starting the CDO server, then I get this exception when committing:

java.lang.ClassCastException: org.eclipse.emf.cdo.internal.server.TransactionCommitContext$DeltaLockWrapper$ForID cannot be cast to org.eclipse.emf.cdo.spi.common.id.AbstractCDOID
	at org.eclipse.emf.cdo.common.id.CDOIDUtil.write(CDOIDUtil.java:501)
	at org.eclipse.emf.cdo.spi.common.protocol.CDODataOutputImpl.writeCDOID(CDODataOutputImpl.java:343)
	at org.eclipse.emf.cdo.spi.common.protocol.CDODataOutputImpl.writeCDOLockState(CDODataOutputImpl.java:294)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.UnlockObjectsIndication.responding(UnlockObjectsIndication.java:83)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndication.responding(CDOServerIndication.java:134)
	at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedOutput(IndicationWithResponse.java:98)
	at org.eclipse.net4j.signal.Signal.doOutput(Signal.java:298)
	at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:67)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerWriteIndication.execute(CDOServerWriteIndication.java:39)

java.lang.IllegalMonitorStateException
	at org.eclipse.net4j.util.concurrent.RWOLockManager.unlock2(RWOLockManager.java:187)
	at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.unlockObjects(TransactionCommitContext.java:1026)
	at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.rollback(TransactionCommitContext.java:1155)
	at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.handleException(TransactionCommitContext.java:583)
	at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.write(TransactionCommitContext.java:532)
	at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:46)
	at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:1)
	at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(ProgressDistributor.java:96)
	at org.eclipse.emf.cdo.internal.server.Repository.commitUnsynced(Repository.java:917)
	at org.eclipse.emf.cdo.internal.server.Repository.commit(Repository.java:910)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicatingCommit(CommitTransactionIndication.java:295)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:97)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.indicating(CDOServerIndicationWithMonitoring.java:109)
	at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating(IndicationWithMonitoring.java:86)


If I rerun the test without restarting the CDO server, then the test succeeds.

Am I doing something wrong?
Or is there other more efficient way to remove entries?

Might it be due to the huge amount of entries in the list? I was expecting that the number of entries in this case was not relevant, because it should remove directly from the index, without iterating over all the list, right?
However, is not in the remove that is takes too long to execute, but during the commit.


--
Silvestre

[Updated on: Tue, 04 December 2012 10:49]

Report message to a moderator

Re: [CDO] ClassCastException when removing one entry from the model [message #989113 is a reply to message #989023] Tue, 04 December 2012 16:33 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 04.12.2012 11:48, schrieb Silvestre Martins:
> I have a simple test, where I get the resource and try to remove the last entry from the contents list:
>
> CDOResource resource = tx.getOrCreateResource(RESOURCE_NAME);
> EList<EObject> contents = resource.getContents();
> int size = contents.size();
>
> contents.remove(size-1);
>
> tx.commit();
>
> The list contains 200.000 entries.
> If I run the test just after starting the CDO server, then I get this exception when committing:
>
> java.lang.ClassCastException: org.eclipse.emf.cdo.internal.server.TransactionCommitContext$DeltaLockWrapper$ForID
> cannot be cast to org.eclipse.emf.cdo.spi.common.id.AbstractCDOID
> at org.eclipse.emf.cdo.common.id.CDOIDUtil.write(CDOIDUtil.java:501)
I think that's a bug that noone has uncovered before. Should be easy to fix by letting DeltaLockWrapper extend
AbstractCDOID. Please submit a bugzilla.

> at org.eclipse.emf.cdo.spi.common.protocol.CDODataOutputImpl.writeCDOID(CDODataOutputImpl.java:343)
> at org.eclipse.emf.cdo.spi.common.protocol.CDODataOutputImpl.writeCDOLockState(CDODataOutputImpl.java:294)
> at
> org.eclipse.emf.cdo.server.internal.net4j.protocol.UnlockObjectsIndication.responding(UnlockObjectsIndication.java:83)
> at org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndication.responding(CDOServerIndication.java:134)
> at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedOutput(IndicationWithResponse.java:98)
> at org.eclipse.net4j.signal.Signal.doOutput(Signal.java:298)
> at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:67)
> at
> org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerWriteIndication.execute(CDOServerWriteIndication.java:39)
>
> java.lang.IllegalMonitorStateException
> at org.eclipse.net4j.util.concurrent.RWOLockManager.unlock2(RWOLockManager.java:187)
> at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.unlockObjects(TransactionCommitContext.java:1026)
> at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.rollback(TransactionCommitContext.java:1155)
> at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.handleException(TransactionCommitContext.java:583)
> at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.write(TransactionCommitContext.java:532)
> at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:46)
> at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:1)
> at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(ProgressDistributor.java:96)
> at org.eclipse.emf.cdo.internal.server.Repository.commitUnsynced(Repository.java:917)
> at org.eclipse.emf.cdo.internal.server.Repository.commit(Repository.java:910)
> at
> org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicatingCommit(CommitTransactionIndication.java:295)
> at
> org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:97)
> at
> org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.indicating(CDOServerIndicationWithMonitoring.java:109)
> at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating(IndicationWithMonitoring.java:86)
>
>
> If I rerun the test without restarting the CDO server, then the test succeeds.
>
> Am I doing something wrong?
> Or is there other more efficient way to remove entries?
>
> Might it be due to the huge amount of entries in the list? I was expecting that the number of entries in this case was
> not relevant, because it should remove directly from the index, without iterating over all the list, right?
I can currently not judge whether this is a follow-up problem of the one above. Let's address that one first.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: [CDO] ClassCastException when removing one entry from the model [message #989119 is a reply to message #989113] Tue, 04 December 2012 16:55 Go to previous messageGo to next message
Silvestre Martins is currently offline Silvestre MartinsFriend
Messages: 84
Registered: July 2009
Member
Bugzilla created:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=395736
Re: [CDO] ClassCastException when removing one entry from the model [message #989127 is a reply to message #989119] Tue, 04 December 2012 17:45 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 04.12.2012 17:55, schrieb Silvestre Martins:
> Bugzilla created:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=395736
And resloved: commit bccf2d8a11ec27fcab9768fa5a921411dcc33970

Please try again...

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Previous Topic:[CDO] OCL Query to sql
Next Topic:[CDO] launch error with offline example
Goto Forum:
  


Current Time: Thu Apr 25 06:07:48 GMT 2024

Powered by FUDForum. Page generated in 0.02967 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top