private Integer addMapping(ObjectStreamClass desc) throws IOException { SerializableDataKey key = new SerializableDataKey(desc); Integer value = Integer.valueOf(nextMapping++); put(value, key.getSerializedOsc()); put(key, value); /* * We could populate the local cache of ObjectStreamClass descriptors here, it will only help performance on the * first deserialization of the associated class though, and forcing the ObjectStreamClass to go through a * serialization pass helps provide some insurance that everything is working correctly. */ return value; }
private Integer addMapping(ObjectStreamClass desc) throws IOException { SerializableDataKey key = new SerializableDataKey(desc); Integer value = Integer.valueOf(nextMapping++); put(key, value); put(value, key.getSerializedOsc()); /* * We could populate the local cache of ObjectStreamClass descriptors here, * it will only help performance on the first deserialization of the * associated class though, and forcing the ObjectStreamClass to go through * a serialization pass helps provide some insurance that everything is * working correctly. */ return value; }
public int getMappingFor(String className) { Integer value = (Integer) mappings.unsafeGet(className); if (value != null) { return value.intValue(); } if (locked) ManagerUtil.monitorEnter(writeLock, Manager.LOCK_TYPE_WRITE); try { value = (Integer) mappings.get(className); if (value != null) { return value.intValue(); } value = Integer.valueOf(nextMapping++); // insert two-way mapping exploiting the fact that className can never start with a digit put(className, value); put(value.toString(), className); } finally { if (locked) ManagerUtil.monitorExit(writeLock, Manager.LOCK_TYPE_WRITE); } return value.intValue(); }
public int getMappingFor(String className) { Integer value = (Integer) mappings.unsafeGet(className); if (value != null) { return value.intValue(); } if (locked) ManagerUtil.monitorEnter(writeLock, Manager.LOCK_TYPE_WRITE); try { value = (Integer) mappings.get(className); if (value != null) { return value.intValue(); } value = Integer.valueOf(nextMapping++); // insert two-way mapping exploiting the fact that className can never start with a digit put(className, value); put(value.toString(), className); } finally { if (locked) ManagerUtil.monitorExit(writeLock, Manager.LOCK_TYPE_WRITE); } return value.intValue(); }