@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); } }
public void dehydrate(ApplicatorObjectManager objectManager, TCObjectExternal tcObject, DNAWriter writer, Object pojo) { List items = (List) pojo; for (int i = 0; i < items.size(); i++) { Object value = items.get(i); if (!objectManager.isPortableInstance(value)) { continue; } final Object addValue = getDehydratableObject(value, objectManager); if (addValue == null) { continue; } writer.addLogicalAction(SerializationUtil.ADD, new Object[] { addValue }); } }
public void hydrate(ApplicatorObjectManager objectManager, TCObjectExternal tcObject, DNA dna, Object pojo) throws IOException, ClassNotFoundException { List items = (List) pojo; DNACursor cursor = dna.getCursor(); while (cursor.next(encoding)) { LogicalAction action = cursor.getLogicalAction(); int method = action.getMethod(); Object[] params = action.getParameters(); for (int i = 0, n = params.length; i < n; i++) { Object param = params[i]; if (param instanceof ObjectID) { params[i] = objectManager.lookupObject((ObjectID) param); } } try { apply(items, method, params); } catch (IndexOutOfBoundsException ioobe) { logger.error("Error applying update to " + pojo, ioobe); } } }
takeLock = objectManager.lookupObject((ObjectID) value); } else if (fieldName.equals(PUT_LOCK_FIELD_NAME)) { putLock = objectManager.lookupObject((ObjectID) value); } else if (fieldName.equals(CAPACITY_FIELD_NAME)) { capacity = value;
@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); } }
takeLock = objectManager.lookupObject((ObjectID) value); } else if (fieldName.equals(PUT_LOCK_FIELD_NAME)) { putLock = objectManager.lookupObject((ObjectID) value); } else if (fieldName.equals(CAPACITY_FIELD_NAME)) { capacity = value;
private void dehydrateMembers(ApplicatorObjectManager objectManager, TCObjectExternal tcObject, DNAWriter writer, Object pojo) { Queue queue = (Queue) pojo; for (Iterator i = queue.iterator(); i.hasNext();) { Object value = i.next(); if (!(value instanceof ObjectID)) { if (!objectManager.isPortableInstance(value)) { continue; } value = getDehydratableObject(value, objectManager); } if (value == null) { continue; } writer.addLogicalAction(SerializationUtil.PUT, new Object[] { value }); } }
@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); } }
takeLock = objectManager.lookupObject((ObjectID) value); } else if (fieldName.equals(PUT_LOCK_FIELD_NAME)) { putLock = objectManager.lookupObject((ObjectID) value); } else if (fieldName.equals(CAPACITY_FIELD_NAME)) { capacity = value;
private void dehydrateMembers(ApplicatorObjectManager objectManager, TCObjectExternal tcObject, DNAWriter writer, Object pojo) { Queue queue = (Queue) pojo; for (Iterator i = queue.iterator(); i.hasNext();) { Object value = i.next(); if (!(value instanceof ObjectID)) { if (!objectManager.isPortableInstance(value)) { continue; } value = getDehydratableObject(value, objectManager); } if (value == null) { continue; } writer.addLogicalAction(SerializationUtil.PUT, new Object[] { value }); } }
final Object lockStrategy = objectManager.lookupObject((ObjectID) physicalAction.getObject()); .getClassFor(CDSM_DSO_CLASSNAME, LoaderDescription.fromString(dna.getDefiningLoaderDescription())); final Method newCDM = cdmClazz.getMethod("newCDSM", NEW_CDM_ARGS); newCDM.setAccessible(true);
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); }
private void dehydrateMembers(ApplicatorObjectManager objectManager, TCObjectExternal tcObject, DNAWriter writer, Object pojo) { Queue queue = (Queue) pojo; for (Iterator i = queue.iterator(); i.hasNext();) { Object value = i.next(); if (!(value instanceof ObjectID)) { if (!objectManager.isPortableInstance(value)) { continue; } value = getDehydratableObject(value, objectManager); } if (value == null) { continue; } writer.addLogicalAction(SerializationUtil.PUT, new Object[] { value }); } }
final Object lockStrategy = objectManager.lookupObject((ObjectID) physicalAction.getObject()); .getClassFor(CDSM_DSO_CLASSNAME, LoaderDescription.fromString(dna.getDefiningLoaderDescription())); final Method newCDM = cdmClazz.getMethod("newCDSM", NEW_CDM_ARGS); newCDM.setAccessible(true);