Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 257381 - [Discovery] Reduce BREE to Java 1.4
Summary: [Discovery] Reduce BREE to Java 1.4
Status: RESOLVED FIXED
Alias: None
Product: ECF
Classification: RT
Component: ecf.ui (show other bugs)
Version: 3.0.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Markus Kuppe CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 256603
  Show dependency tree
 
Reported: 2008-12-03 10:07 EST by Markus Kuppe CLA
Modified: 2009-01-22 02:44 EST (History)
1 user (show)

See Also:


Attachments
mylyn/context/zip (36.21 KB, application/octet-stream)
2009-01-20 07:38 EST, Markus Kuppe CLA
no flags Details
org.eclipse.core.runtime.jobs.ILock instead of java.util.concurrent.Lock (8.68 KB, patch)
2009-01-21 04:04 EST, Markus Kuppe CLA
no flags Details | Diff
mylyn/context/zip (12.83 KB, application/octet-stream)
2009-01-22 02:44 EST, Markus Kuppe CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Kuppe CLA 2008-12-03 10:07:24 EST
The new discovery ui currently requires Java5 (because of generated EMF code as well as the new java.util.concurrent). This dependency should be reduced to Java 1.4.
Comment 1 Markus Kuppe CLA 2008-12-05 05:41:09 EST
Released the EMF change to HEAD (caused a couple of edit classes to move). However org.eclipse.ecf.discovery.model remains Java5 since the dependency towards  java.util.concurrent.locks.Lock and java.util.concurrent.locks.ReentrantLock still exists. Though the current backport [1] works we need to file a CQ for it first.

[1] http://backport-jsr166.sourceforge.net/
Comment 3 Markus Kuppe CLA 2009-01-20 07:38:01 EST
Released to HEAD
Comment 4 Markus Kuppe CLA 2009-01-20 07:38:07 EST
Created attachment 123070 [details]
mylyn/context/zip
Comment 5 Markus Kuppe CLA 2009-01-21 03:36:36 EST
Scott Lewis wrote [1]:
> Hi Markus,
> 
> I saw that you added the emory backport of the concurrent API to the ECF 
> build and project set files.  AFAICT, it seems to be for use in the 
> discovery ui ServiceResource class...i.e. it references the Lock and 
> ReentrantLock classes from the concurrent API (maybe others, but I 
> haven't found them).
> 
> I haven't looked at this yet, but is it possible that this could use 
> some other mechanism?...e.g. the jobs API's ILock instead?  It seems to 
> me like a lot of additional code, build/deploy difficulties, and 
> dependencies to just use a Lock class (even ReentrantLock).
> 
> If we have to include it obviously we can (given the timely IP 
> approval)...but if we can avoid it that would be good also.
> 
> Thanks,
> 
> Scott
> 
> http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/runtime_jobs_locks.htm 

[1] http://dev.eclipse.org/mhonarc/lists/ecf-dev/msg02027.html
Comment 6 Markus Kuppe CLA 2009-01-21 04:04:11 EST
Created attachment 123183 [details]
org.eclipse.core.runtime.jobs.ILock instead of java.util.concurrent.Lock

I agree that emory is a heavy weight dependency just to use one interface and a class. However, I am not entirely sure org.eclipse.core.runtime.jobs.ILock fits the requirements. org.eclipse.core.runtime.jobs.IJobManager.newLock() nowhere states that consumers get a fair [1] lock. Though the backing implementation org.eclipse.core.internal.jobs.OrderedLock appears to guarantee fairness, it's nothing to be certain of. And (correct) order of discovery events (discovery/undiscovery) is a must in org.eclipse.ecf.discovery.ui.model.resource.ServiceResource.ServiceDiscoveryListener.

Anyway, here's a patch that uses org.eclipse.core.runtime.jobs.ILock instead. 

[1] http://osdir.com/ml/java.jsr.166-concurrency/2007-07/msg00027.html
Comment 7 Scott Lewis CLA 2009-01-21 11:01:39 EST
(In reply to comment #6)
> Created an attachment (id=123183) [details]
> org.eclipse.core.runtime.jobs.ILock instead of java.util.concurrent.Lock
> 
> I agree that emory is a heavy weight dependency just to use one interface and a
> class. However, I am not entirely sure org.eclipse.core.runtime.jobs.ILock fits
> the requirements. org.eclipse.core.runtime.jobs.IJobManager.newLock() nowhere
> states that consumers get a fair [1] lock. Though the backing implementation
> org.eclipse.core.internal.jobs.OrderedLock appears to guarantee fairness, it's
> nothing to be certain of. And (correct) order of discovery events
> (discovery/undiscovery) is a must in
> org.eclipse.ecf.discovery.ui.model.resource.ServiceResource.ServiceDiscoveryListener.
> 
> Anyway, here's a patch that uses org.eclipse.core.runtime.jobs.ILock instead. 
> 
> [1] http://osdir.com/ml/java.jsr.166-concurrency/2007-07/msg00027.html
> 

Why don't you ask John A about the lock guarantees of OrderedLock?  And if it doesn't fit/isn't enough then we can work out something else.

Comment 8 Markus Kuppe CLA 2009-01-21 15:46:32 EST
<rcjsuen> +yjob: <lemmy> Anybody else knows if JobManager.newLock guarantees to return a fair lock?
<yjob> +From ILock class comment: Successive acquire attempts by different threads are queued and serviced on
<yjob> + * a first come, first served basis.
<yjob> +So "yes"
<yjob> +ISchedulingRule isn't fair though
<lemmy> yjob: so ILock is comparable to java.util.concurrent.ReentrantLock(true)?
<yjob> lemmy: I guess so, with fair=true
<yjob> ILock is implemented with a simple queue
<yjob> I don't know how ReentrantLock is implemented, but I suspect it's similar
Comment 9 Scott Lewis CLA 2009-01-21 17:15:01 EST
(In reply to comment #8)
> <rcjsuen> +yjob: <lemmy> Anybody else knows if JobManager.newLock guarantees to
> return a fair lock?
> <yjob> +From ILock class comment: Successive acquire attempts by different
> threads are queued and serviced on
> <yjob> + * a first come, first served basis.
> <yjob> +So "yes"
> <yjob> +ISchedulingRule isn't fair though
> <lemmy> yjob: so ILock is comparable to
> java.util.concurrent.ReentrantLock(true)?
> <yjob> lemmy: I guess so, with fair=true
> <yjob> ILock is implemented with a simple queue
> <yjob> I don't know how ReentrantLock is implemented, but I suspect it's
> similar
> 

So this sounds like ILock IJobManager.createLock() could probably be used?

Comment 10 Markus Kuppe CLA 2009-01-22 02:44:33 EST
Patch has been applied to HEAD. Emory dependency is gone and replaced by ILock.
Comment 11 Markus Kuppe CLA 2009-01-22 02:44:39 EST
Created attachment 123334 [details]
mylyn/context/zip