3366
3367 /**
3368 * Assigns next available handle to given object, and returns assigned
3369 * handle. Once object has been completely deserialized (and all
3370 * dependencies on other objects identified), the handle should be
3371 * "closed" by passing it to finish().
3372 */
3373 int assign(Object obj) {
3374 if (size >= entries.length) {
3375 grow();
3376 }
3377 status[size] = STATUS_UNKNOWN;
3378 entries[size] = obj;
3379 return size++;
3380 }
3381
3382 /**
3383 * Registers a dependency (in exception status) of one handle on
3384 * another. The dependent handle must be "open" (i.e., assigned, but
3385 * not finished yet). No action is taken if either dependent or target
3386 * handle is NULL_HANDLE.
3387 */
3388 void markDependency(int dependent, int target) {
3389 if (dependent == NULL_HANDLE || target == NULL_HANDLE) {
3390 return;
3391 }
3392 switch (status[dependent]) {
3393
3394 case STATUS_UNKNOWN:
3395 switch (status[target]) {
3396 case STATUS_OK:
3397 // ignore dependencies on objs with no exception
3398 break;
3399
3400 case STATUS_EXCEPTION:
3401 // eagerly propagate exception
3402 markException(dependent,
3403 (ClassNotFoundException) entries[target]);
3404 break;
3405
3406 case STATUS_UNKNOWN:
3407 // add to dependency list of target
3408 if (deps[target] == null) {
3409 deps[target] = new HandleList();
|
3366
3367 /**
3368 * Assigns next available handle to given object, and returns assigned
3369 * handle. Once object has been completely deserialized (and all
3370 * dependencies on other objects identified), the handle should be
3371 * "closed" by passing it to finish().
3372 */
3373 int assign(Object obj) {
3374 if (size >= entries.length) {
3375 grow();
3376 }
3377 status[size] = STATUS_UNKNOWN;
3378 entries[size] = obj;
3379 return size++;
3380 }
3381
3382 /**
3383 * Registers a dependency (in exception status) of one handle on
3384 * another. The dependent handle must be "open" (i.e., assigned, but
3385 * not finished yet). No action is taken if either dependent or target
3386 * handle is NULL_HANDLE. Additionally, no action is taken if the
3387 * dependent and target are the same.
3388 */
3389 void markDependency(int dependent, int target) {
3390 if (dependent == target || dependent == NULL_HANDLE || target == NULL_HANDLE) {
3391 return;
3392 }
3393 switch (status[dependent]) {
3394
3395 case STATUS_UNKNOWN:
3396 switch (status[target]) {
3397 case STATUS_OK:
3398 // ignore dependencies on objs with no exception
3399 break;
3400
3401 case STATUS_EXCEPTION:
3402 // eagerly propagate exception
3403 markException(dependent,
3404 (ClassNotFoundException) entries[target]);
3405 break;
3406
3407 case STATUS_UNKNOWN:
3408 // add to dependency list of target
3409 if (deps[target] == null) {
3410 deps[target] = new HandleList();
|