DESCRIPTION

Tmf: Use an abstract class for request scheduler

Now we can have many scheduler and chose between them

Change-Id: I56f413d868944d8d3c9324a2be92fc7c732c1890
Signed-off-by: Kelsie Blackwell xxx@xxx.xxx

COMMENTS

author: Kelsie Blackwell
date: 2013-08-16 16:53:31.000000000

Uploaded patch set 2.

-------------------------------------
author: Brenden Conley
date: 2013-08-16 16:54:11.000000000

Patch Set 2:

Build Started https://hudson.eclipse.org/sandbox/job/linuxtools/3212/

-------------------------------------
author: Brenden Conley
date: 2013-08-16 17:11:31.000000000

Patch Set 2: Verified+1

Build Successful 

https://hudson.eclipse.org/sandbox/job/linuxtools/3212/ : SUCCESS

-------------------------------------
author: Braxton Mccarthy
date: 2013-08-16 19:05:50.000000000

Patch Set 2: Code-Review-1

(8 comments)

Looking good, some comments.

Line:9, /COMMIT_MSG -> schedulers

choose (present tense)

period at the end

Line:41, lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/request/TmfRequestExecutorTest.java -> wrap this line (ctrl+shift+f)

Line:76, lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/request/TmfRequestExecutorTest.java -> You should move @Before and @After in the TmfSchedulerTest class. Eventually, when we are able to switch which scheduler is used programmatically, we will use xxx@xxx.xxx methods in each sub-class.

'fixture' should probably remain in here, but the fields that are specific to the sub-class can go in there.

Line:34, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/request/TmfRequestScheduler.java xxx@xxx.xxx is pretty much useless, don't add it for new files

Line:43, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/request/TmfRequestScheduler.java -> give some javadoc to these variables, since they are relatively important to how the scheduler works. Just so a dev looking at this knows what they mean.

Line:129, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/request/TmfRequestScheduler.java -> this could be private. This is only called by internal classes/methods.

I'm not super comfortable with keeping the synchronized keyword in that case. 'synchronized' is usually more for external entities that want to get a lock on the complete object. Since this seems to be for internal uses only, it should be a separate lock (or we might end up with deadlocks).

You can do it the "proper" way, with a ReentrantLock for example. Or you can do it the quick-and-dirty way:

  private final Object schedulingLock = new Object();
  ...
  public void scheduleNext() {
    synchronized(schedulingLock) {
      <stuff goes here>
    }
  }

So basically you spawn a dummy Object only to use its monitor, and this uses the oh-so-familiar synchronized keyword.

Line:240, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/request/TmfRequestScheduler.java -> This could be private too.

Line:44, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/request/TmfOSRequestScheduler.java -> log it ;)

tmf.core.Activator.logError(...)

-------------------------------------
