Skip to main content

Unreachable codes after fixing IT207 - Remove DVR dependencies from HN code

4 replies [Last post]
sivakumaran
Offline
Joined: 2006-05-05
Points: 0

As part of IT207, the SharedResourceUsageImpl was modified to implement from org.ocap.resource.SharedResourceUsage interface. So always the SharedResourceUsage object created will be of type org.ocap.resource.SharedResourceUsage. If we look out the below code in RecordingRezMgr, it checks against org.ocap.dvr.SharedResourceUsage and print the details of the resource usages. This if condition will never be pass and it fail to log the details.

public void logResourceUsage(int index, int subIndex, ResourceUsage item) {

super.logResourceUsage(index, subIndex, item);

if (item instanceof org.ocap.dvr.SharedResourceUsage) {

ResourceUsage[] array = ((SharedResourceUsage) item).getResourceUsages();

for (subIndex = 0; subIndex < array.length; subIndex++) {

logResourceUsage(index, subIndex + 1, array[subIndex]);

}

}

}

Please correct me if i am wrong.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
csweeney
Offline
Joined: 2009-04-11
Points: 0

As far as I can tell, this code snippet is not part of CableLabs RI codebase - it appears to be a derived class (from RezMgr).
The call to super.logResource will result in "standard" logging (which is similar to the above snippet):

<pre>

public void logResourceUsage(int index, int subIndex, ResourceUsage item)
{
if (log.isInfoEnabled())
{
log.info(" " + (index + 1) + "." + subIndex + " " + item.toString());
}

if (item instanceof SharedResourceUsage)
{
ResourceUsage[] array = ((SharedResourceUsage) item).getResourceUsages();
for (subIndex = 0; subIndex < array.length; subIndex++)
{
logResourceUsage(index, subIndex + 1, array[subIndex]);
}
}
}

</pre>

I believe that the submitted snippet would result in duplicate log output for items that implement (or are derived from a class that implements) org.ocap.dvr.SharedResourceUsage.

sivakumaran
Offline
Joined: 2006-05-05
Points: 0

Thanks for your reply.

The code snippet is part of CableLabs RI.

RezMgr:

public void logResourceUsage(int index, int subIndex, ResourceUsage item) {

if (log.isInfoEnabled()) {

log.info(" " + (index + 1) + "." + subIndex + " " + item.toString());

}

RecordingRezMgr:

public void logResourceUsage(int index, int subIndex, ResourceUsage item) {

super.logResourceUsage(index, subIndex, item);

if (item instanceof org.ocap.dvr.SharedResourceUsage) {

ResourceUsage[] array = ((SharedResourceUsage) item).getResourceUsages();

for (subIndex = 0; subIndex < array.length; subIndex++) {

logResourceUsage(index, subIndex + 1, array[subIndex]);

}

}

}

If you see the above codes, the shared resource usages are logged only in RecordingRezMgr. There is no code in RezMgr to log the resoure usages in a shared resource usage.

jbernatik
Offline
Joined: 2010-09-13
Points: 0

Small clarification as to where the confusion may be coming from - RecordingRezMgr.java was deleted in CL_trunk branch (1.2.1), revision 27137.

sivakumaran
Offline
Joined: 2006-05-05
Points: 0

Thanks for the clarification jan.