/** * INTERNAL: * Return the changes to be applied */ public UnitOfWorkChangeSet getChangeSet(AbstractSession session) { if ((changeSet == null) && (changeSetBytes != null)) { try { changeSet = new UnitOfWorkChangeSet(changeSetBytes, session); } catch (java.io.IOException exception) { throw CommunicationException.unableToPropagateChanges(getServiceId().toString(), exception); } catch (ClassNotFoundException exception) { throw CommunicationException.unableToPropagateChanges(getServiceId().toString(), exception); } } return changeSet; }
/** * ADVANCED: * Set an object to be invalid in the cache. * @param invalidateCluster if true the invalidation will be broadcast to each server in the cluster. */ public void invalidateObject(Vector primaryKey, Class theClass, boolean invalidateCluster) { ClassDescriptor descriptor = getSession().getDescriptor(theClass); //forward the call to getCacheKeyForObject locally in case subclasses overload CacheKey key = this.getCacheKeyForObjectForLock(primaryKey, theClass, descriptor); if (key != null) { key.setInvalidationState(CacheKey.CACHE_KEY_INVALID); } if (invalidateCluster) { CommandManager rcm = getSession().getCommandManager(); if (rcm != null) { UnitOfWorkChangeSet changeSet = new UnitOfWorkChangeSet(getSession()); ObjectChangeSet objectChangeSet = new ObjectChangeSet(primaryKey, descriptor, null, changeSet, false); objectChangeSet.setSynchronizationType(ClassDescriptor.INVALIDATE_CHANGED_OBJECTS); changeSet.getAllChangeSets().put(objectChangeSet, objectChangeSet); MergeChangeSetCommand command = new MergeChangeSetCommand(); command.setChangeSet(changeSet); try { command.convertChangeSetToByteArray(getSession()); } catch (java.io.IOException exception) { throw CommunicationException.unableToPropagateChanges(command.getServiceId().getId(), exception); } rcm.propagateCommand(command); } } }
hasData = command.convertChangeSetToByteArray(this); } catch (java.io.IOException exception) { throw CommunicationException.unableToPropagateChanges("", exception);