@Override protected void applyPhysicalAction(final PhysicalAction action, final ObjectID objectID, final ApplyTransactionInfo info) { final String fieldName = action.getFieldName(); if (LOCK_TYPE_FIELDNAME.equals(fieldName)) { this.dsoLockType = (Integer)action.getObject(); } else if (MAX_TTI_SECONDS_FIELDNAME.equals(fieldName)) { this.maxTTISeconds = (Integer)action.getObject(); } else if (MAX_TTL_SECONDS_FIELDNAME.equals(fieldName)) { this.maxTTLSeconds = (Integer)action.getObject(); } else if (MAX_COUNT_IN_CLUSTER_FIELDNAME.equals(fieldName)) { this.targetMaxTotalCount = (Integer)action.getObject(); } else if (INVALIDATE_ON_CHANGE_FIELDNAME.equals(fieldName)) { this.invalidateOnChange = (Boolean)action.getObject(); } else if (fieldName.equals(CACHE_NAME_FIELDNAME)) { Object value = action.getObject(); this.cacheName = asString(value); } else if (LOCAL_CACHE_ENABLED_FIELDNAME.equals(fieldName)) { this.localCacheEnabled = (Boolean)action.getObject(); } else if (COMPRESSION_ENABLED_FIELDNAME.equals(fieldName)) { this.compressionEnabled = (Boolean)action.getObject(); } else if (COPY_ON_READ_ENABLED_FIELDNAME.equals(fieldName)) { this.copyOnReadEnabled = (Boolean)action.getObject(); } else if (EVICTION_ENABLED_FIELDNAME.equals(fieldName)) { this.evictionEnabled = (Boolean)action.getObject(); } else { throw new AssertionError("unexpected field name: " + fieldName); } }
private void writePhysicalAction(final DNAWriter dnaWriter, final PhysicalAction action) { if (action.isTruePhysical()) { dnaWriter.addPhysicalAction(action.getFieldName(), action.getObject(), action.isReference()); } else if (action.isArrayElement()) { dnaWriter.addArrayElementAction(action.getArrayIndex(), action.getObject()); } else if (action.isEntireArray()) { dnaWriter.setArrayLength(Array.getLength(action.getObject())); dnaWriter.addEntireArray(action.getObject()); } else if (action.isSubArray()) { dnaWriter.addSubArrayAction(action.getArrayIndex(), action.getObject(), Array.getLength(action.getObject())); } else { throw new AssertionError("Unknown Physical Action : " + action); } }
public void hydrate(final ApplicatorObjectManager objectManager, final TCObjectExternal tco, final DNA dna, final Object pojo) throws IOException, ClassNotFoundException { DNACursor cursor = dna.getCursor(); while (cursor.next(encoding)) { PhysicalAction a = cursor.getPhysicalAction(); if (a.isEntireArray()) { tco.setValue(VALUE_FIELD, a.getObject()); } else { tco.setValue(a.getFieldName(), a.getObject()); } } } }
public void hydrate(final ApplicatorObjectManager objectManager, final TCObjectExternal tco, final DNA dna, final Object pojo) throws IOException, ClassNotFoundException { DNACursor cursor = dna.getCursor(); while (cursor.next(encoding)) { PhysicalAction a = cursor.getPhysicalAction(); if (a.isEntireArray()) { tco.setValue(VALUE_FIELD, a.getObject()); } else { tco.setValue(a.getFieldName(), a.getObject()); } } } }
public void hydrate(final ApplicatorObjectManager objectManager, final TCObjectExternal tco, final DNA dna, final Object pojo) throws IOException, ClassNotFoundException { DNACursor cursor = dna.getCursor(); while (cursor.next(encoding)) { PhysicalAction a = cursor.getPhysicalAction(); if (a.isEntireArray()) { tco.setValue(VALUE_FIELD, a.getObject()); } else { tco.setValue(a.getFieldName(), a.getObject()); } } } }
public void hydrate(final ClientObjectManager objMgr, final TCObject tco, final DNA dna, final Object pojo) throws IOException, ClassNotFoundException { DNACursor cursor = dna.getCursor(); while (cursor.next(encoding)) { PhysicalAction a = cursor.getPhysicalAction(); if (a.isEntireArray()) { tco.setValue(VALUE_FIELD, a.getObject()); } else { tco.setValue(a.getFieldName(), a.getObject()); } } } }
@Override public void apply(final ObjectID objectID, final DNACursor cursor, final ApplyTransactionInfo includeIDs) throws IOException { while (cursor.next()) { Object action = cursor.getAction(); if (action instanceof PhysicalAction) { final PhysicalAction pa = (PhysicalAction) action; if (pa.isEntireArray()) { this.componentObjects = (Object[]) pa.getObject(); } else { configMap.put(pa.getFieldName(), pa.getObject()); } } else { final LogicalAction logicalAction = (LogicalAction) action; final int method = logicalAction.getMethod(); final Object[] params = logicalAction.getParameters(); applyMethod(objectID, method, params); } } }
@Override protected void applyPhysicalAction(final PhysicalAction action, final ObjectID objectID, final ApplyTransactionInfo info) { final String fieldName = action.getFieldName(); final Object value = action.getObject(); if (TAKE_LOCK_FIELD_NAME.equals(fieldName)) { takeLockField = (ObjectID) value; getListener().changed(objectID, null, takeLockField); info.addBackReference(takeLockField, objectID); } else if (PUT_LOCK_FIELD_NAME.equals(fieldName)) { putLockField = (ObjectID) value; getListener().changed(objectID, null, putLockField); info.addBackReference(putLockField, objectID); } else if (CAPACITY_FIELD_NAME.equals(fieldName)) { capacityField = value; } }
public Object getNewInstance(ApplicatorObjectManager objectManager, DNA dna) throws IOException, ClassNotFoundException { DNACursor cursor = dna.getCursor(); Assert.assertEquals(3, cursor.getActionCount()); cursor.next(encoding); PhysicalAction a = cursor.getPhysicalAction(); String className = (String) a.getObject(); cursor.next(encoding); a = cursor.getPhysicalAction(); Class target = (Class) a.getObject(); cursor.next(encoding); a = cursor.getPhysicalAction(); Object propertyNames = a.getObject(); propertyNames = objectManager.lookupObject((ObjectID) propertyNames); return create(target, className, propertyNames); }
@Override public Object getNewInstance(ApplicatorObjectManager objectManager, DNA dna) { try { final DNACursor cursor = dna.getCursor(); Assert.assertTrue("DNA missing physical action", cursor.next()); PhysicalAction physicalAction = cursor.getPhysicalAction(); final Object lockType = physicalAction.getObject(); Assert.assertTrue("DNA missing physical action", cursor.next()); physicalAction = cursor.getPhysicalAction(); Object lockStrategy = objectManager.lookupObject((ObjectID) physicalAction.getObject()); /* * This trickery is necessary to avoid getting an instance of class loaded by the wrong classloader. Otherwise we * get ClassCastExceptions when we try and store the result in the ConcurrentDistributedMap instance. */ Class cdmClazz = objectManager.getClassFor(CDM_DSO, LoaderDescription.fromString(dna .getDefiningLoaderDescription())); final Method newCDM = cdmClazz.getMethod("newCDM", NEW_CDM_ARGS); newCDM.setAccessible(true); return newCDM.invoke(null, lockType, lockStrategy); } catch (final Exception e) { throw new RuntimeException(e); } }
@Override public Object getNewInstance(ApplicatorObjectManager objectManager, DNA dna) { try { final DNACursor cursor = dna.getCursor(); Assert.assertTrue("DNA missing physical action", cursor.next()); PhysicalAction physicalAction = cursor.getPhysicalAction(); final Object lockType = physicalAction.getObject(); Assert.assertTrue("DNA missing physical action", cursor.next()); physicalAction = cursor.getPhysicalAction(); Object lockStrategy = objectManager.lookupObject((ObjectID) physicalAction.getObject()); /* * This trickery is necessary to avoid getting an instance of class loaded by the wrong classloader. Otherwise we * get ClassCastExceptions when we try and store the result in the ConcurrentDistributedMap instance. */ Class cdmClazz = objectManager.getClassFor(CDM_DSO, LoaderDescription.fromString(dna .getDefiningLoaderDescription())); final Method newCDM = cdmClazz.getMethod("newCDM", NEW_CDM_ARGS); newCDM.setAccessible(true); return newCDM.invoke(null, lockType, lockStrategy); } catch (final Exception e) { throw new RuntimeException(e); } }
@Override public Object getNewInstance(ApplicatorObjectManager objectManager, DNA dna) { try { final DNACursor cursor = dna.getCursor(); Assert.assertTrue("DNA missing physical action", cursor.next()); PhysicalAction physicalAction = cursor.getPhysicalAction(); final Object lockType = physicalAction.getObject(); Assert.assertTrue("DNA missing physical action", cursor.next()); physicalAction = cursor.getPhysicalAction(); Object lockStrategy = objectManager.lookupObject((ObjectID) physicalAction.getObject()); /* * This trickery is necessary to avoid getting an instance of class loaded by the wrong classloader. Otherwise we * get ClassCastExceptions when we try and store the result in the ConcurrentDistributedMap instance. */ Class cdmClazz = objectManager.getClassFor(CDM_DSO, LoaderDescription.fromString(dna .getDefiningLoaderDescription())); final Method newCDM = cdmClazz.getMethod("newCDM", NEW_CDM_ARGS); newCDM.setAccessible(true); return newCDM.invoke(null, lockType, lockStrategy); } catch (final Exception e) { throw new RuntimeException(e); } }
Class persistenceClass = (Class) a.getObject(); String entityName = (String) a.getObject(); Object[] interfacesObj = (Object[]) a.getObject(); Class[] interfaces = new Class[interfacesObj.length]; System.arraycopy(interfacesObj, 0, interfaces, 0, interfacesObj.length); Serializable id = (Serializable) a.getObject(); ObjectID targetId = (ObjectID) a.getObject(); Object target = objectManager.lookupObject(targetId); ObjectID getIdentifierId = (ObjectID) a.getObject(); Method getIdentifierMethod = (Method) objectManager.lookupObject(getIdentifierId); ObjectID setIdentifierId = (ObjectID) a.getObject(); Method setIdentifierMethod = (Method) objectManager.lookupObject(setIdentifierId); ObjectID componentIdTypeId = (ObjectID) a.getObject(); Object componentIdType = objectManager.lookupObject(componentIdTypeId);
final Object lockType = physicalAction.getObject(); final Object lockStrategy = objectManager.lookupObject((ObjectID) physicalAction.getObject()); final Object maxTTISeconds = physicalAction.getObject(); final Object maxTTLSeconds = physicalAction.getObject(); final Object targetMaxInMemoryCount = physicalAction.getObject(); final Object targetMaxTotalCount = physicalAction.getObject(); final Object invalidateOnChange = physicalAction.getObject(); final String cacheName = ((UTF8ByteDataHolder) physicalAction.getObject()).asString();
@Override public void hydrate(ClientObjectManager objectManager, TCObject tcObject, DNA dna, Object po) throws IOException, IllegalArgumentException, ClassNotFoundException { DNACursor cursor = dna.getCursor(); while (cursor.next(encoding)) { PhysicalAction a = cursor.getPhysicalAction(); if (a.isArrayElement()) { setArrayElement(a.getArrayIndex(), a.getObject(), tcObject, po); } else if (a.isEntireArray() || a.isSubArray()) { Object array = a.getObject(); int offset = a.isEntireArray() ? 0 : a.getArrayIndex(); if (ClassUtils.isPrimitiveArray(array)) { System.arraycopy(array, 0, po, offset, Array.getLength(array)); } else { hydrateNonPrimitiveArray((Object[]) array, tcObject, po, offset); } } else { throw Assert.failure("Invalid physical action for array"); } } }
@Override public void hydrate(ClientObjectManager objectManager, TCObject tcObject, DNA dna, Object po) throws IOException, IllegalArgumentException, ClassNotFoundException { DNACursor cursor = dna.getCursor(); while (cursor.next(encoding)) { PhysicalAction a = cursor.getPhysicalAction(); if (a.isArrayElement()) { setArrayElement(a.getArrayIndex(), a.getObject(), tcObject, po); } else if (a.isEntireArray() || a.isSubArray()) { Object array = a.getObject(); int offset = a.isEntireArray() ? 0 : a.getArrayIndex(); if (ClassUtils.isPrimitiveArray(array)) { System.arraycopy(array, 0, po, offset, Array.getLength(array)); } else { hydrateNonPrimitiveArray((Object[]) array, tcObject, po, offset); } } else { throw Assert.failure("Invalid physical action for array"); } } }
@Override public void hydrate(ClientObjectManager objectManager, TCObject tcObject, DNA dna, Object po) throws IOException, ClassNotFoundException { DNACursor cursor = dna.getCursor(); String fieldName; Object fieldValue; while (cursor.next(encoding)) { PhysicalAction a = cursor.getPhysicalAction(); Assert.eval(a.isTruePhysical()); fieldName = a.getFieldName(); fieldValue = a.getObject(); tcObject.setValue(fieldName, fieldValue); } }
@Override public void hydrate(ClientObjectManager objectManager, TCObject tcObject, DNA dna, Object po) throws IOException, ClassNotFoundException { DNACursor cursor = dna.getCursor(); String fieldName; Object fieldValue; while (cursor.next(encoding)) { PhysicalAction a = cursor.getPhysicalAction(); Assert.eval(a.isTruePhysical()); fieldName = a.getFieldName(); fieldValue = a.getObject(); tcObject.setValue(fieldName, fieldValue); } }
@Override public void apply(final ObjectID objectID, final DNACursor cursor, final ApplyTransactionInfo includeIDs) throws IOException { while (cursor.next()) { final PhysicalAction pa = cursor.getPhysicalAction(); if (pa.isEntireArray()) { final Object array = pa.getObject(); if (array instanceof byte[]) { value = (byte[]) array; includeIDs.getServerEventRecorder().recordEventValue(objectID, value); } else { final String type = safeTypeName(array); logger.error("received array of type " + type + " -- ignoring it"); } } else { logger.error("received physical action: " + pa + " -- ignoring it"); } Preconditions.checkState(!cursor.next(), "Only one iteration expected"); } }
Assert.eval(physicalAction.isTruePhysical()); String fieldName = physicalAction.getFieldName(); Object value = physicalAction.getObject();