"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "dso-l2/src/main/java/com/tc/objectserver/entity/EntityManagerImpl.java" between
terracotta-core-5.7.0.tar.gz and terracotta-core-5.7.1.tar.gz

About: Terracotta - Clustering technology for Java ("Network Attached Memory", "Distributed Cache"). Source code of the server (5.x) core components.

EntityManagerImpl.java  (terracotta-core-5.7.0):EntityManagerImpl.java  (terracotta-core-5.7.1)
skipping to change at line 160 skipping to change at line 160
processorPipeline.enterActiveState(); processorPipeline.enterActiveState();
return reconnectDone; return reconnectDone;
} finally { } finally {
snapshotLock.release(); snapshotLock.release();
} }
} }
@Override @Override
public ManagedEntity createEntity(EntityID id, long version, long consumerID, boolean canDelete) throws ServerException { public ManagedEntity createEntity(EntityID id, long version, long consumerID, boolean canDelete) throws ServerException {
// Valid entity versions start at 1. // Valid entity versions start at 1.
Assert.assertTrue(version > 0);
EntityServerService service = getVersionCheckedService(id, version); EntityServerService service = getVersionCheckedService(id, version);
snapshotLock.acquireUninterruptibly(); snapshotLock.acquireUninterruptibly();
try { try {
// if active, reuse the managed entity if it is mapped to an id. if passiv e, MUST map the id to the index of the managed entity // if active, reuse the managed entity if it is mapped to an id. if passiv e, MUST map the id to the index of the managed entity
FetchID current = entities.compute(id, (eid, fetch)-> shouldCreateActiveEn tities ? Optional.ofNullable(fetch).orElse(new FetchID(consumerID)) : new FetchI D(consumerID)); FetchID current = entities.compute(id, (eid, fetch)-> shouldCreateActiveEn tities ? Optional.ofNullable(fetch).orElse(new FetchID(consumerID)) : new FetchI D(consumerID));
ManagedEntity temp = entityIndex.computeIfAbsent(current, (fetch)-> ManagedEntity temp = entityIndex.computeIfAbsent(current, (fetch)->
new ManagedEntityImpl(id, version, consumerID, flushLocalPipeline, servi ceRegistry.subRegistry(consumerID), new ManagedEntityImpl(id, version, consumerID, flushLocalPipeline, servi ceRegistry.subRegistry(consumerID),
clientEntityStateManager, eventCollector, this.messageSelf, processorP ipeline, service, shouldCreateActiveEntities, canDelete)); clientEntityStateManager, eventCollector, this.messageSelf, processorP ipeline, service, shouldCreateActiveEntities, canDelete));
skipping to change at line 280 skipping to change at line 279
} finally { } finally {
snapshotLock.release(); snapshotLock.release();
if (runFirst != null) { if (runFirst != null) {
runFirst.accept(sortingList); runFirst.accept(sortingList);
} }
} }
} }
private EntityServerService<EntityMessage, EntityResponse> getVersionCheckedSe rvice(EntityID entityID, long version) throws ServerException { private EntityServerService<EntityMessage, EntityResponse> getVersionCheckedSe rvice(EntityID entityID, long version) throws ServerException {
// Valid entity versions start at 1. // Valid entity versions start at 1.
Assert.assertTrue(version > 0);
String typeName = entityID.getClassName(); String typeName = entityID.getClassName();
EntityServerService<EntityMessage, EntityResponse> service = entityServices. get(typeName); EntityServerService<EntityMessage, EntityResponse> service = entityServices. get(typeName);
if (service == null) { if (service == null) {
try { try {
service = (EntityServerService)this.creationLoader.getService(typeName); service = (EntityServerService)this.creationLoader.getService(typeName);
} catch (ClassNotFoundException notfound) { } catch (ClassNotFoundException notfound) {
throw ServerException.createEntityNotProvided(entityID); throw ServerException.createEntityNotProvided(entityID);
} }
// getService only fails to resolve by throwing. // getService only fails to resolve by throwing.
Assert.assertNotNull(service); Assert.assertNotNull(service);
Object oldService = entityServices.putIfAbsent(typeName, service); Object oldService = entityServices.putIfAbsent(typeName, service);
// This needs to be null or else there was some kind of unexpected concurr ent access which would have caused failure or a duplicate entry. // This needs to be null or else there was some kind of unexpected concurr ent access which would have caused failure or a duplicate entry.
Assert.assertNull(oldService); Assert.assertNull(oldService);
} }
// We must have a service by now or we would have thrown. // We must have a service by now or we would have thrown.
Assert.assertNotNull(service); Assert.assertNotNull(service);
long serviceVersion = service.getVersion(); long serviceVersion = service.getVersion();
if (serviceVersion != version) { if (version > 0 && serviceVersion != version) {
throw ServerException.createEntityVersionMismatch(entityID, serviceVersi on + " does not match " + version); throw ServerException.createEntityVersionMismatch(entityID, serviceVersi on + " does not match " + version);
} }
return service; return service;
} }
@Override @Override
public void resetReferences() { public void resetReferences() {
clientEntityStateManager.clearClientReferences(); clientEntityStateManager.clearClientReferences();
for (ManagedEntity me : entityIndex.values()) { for (ManagedEntity me : entityIndex.values()) {
me.resetReferences(0); me.resetReferences(0);
 End of changes. 3 change blocks. 
3 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)