Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 333507 - Various Coordinator API changes
Summary: Various Coordinator API changes
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Compendium (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.7 M6   Edit
Assignee: John Ross CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-04 14:55 EST by John Ross CLA
Modified: 2011-02-09 02:07 EST (History)
4 users (show)

See Also:


Attachments
Contains the changes discussed to date. (148.95 KB, patch)
2011-01-21 08:56 EST, John Ross CLA
no flags Details | Diff
Condensed Patch (107.23 KB, patch)
2011-02-07 09:23 EST, John Ross CLA
tjwatson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Ross CLA 2011-01-04 14:55:12 EST
Build Identifier: 

The Coordinator.join(long) method should throw an IllegalArgumentException if the provided timeout is negative.

Reproducible: Always
Comment 1 John Ross CLA 2011-01-04 15:10:49 EST
I'll provide a patch as soon as I can figure out why my environment is creating patches that indicate every line of code within the Java file has changed.

To fix this, the first three lines within the join() method simply need to be removed.

		// Treat negative arguments as if they were zero.
		if (timeInMillis < 0)
			timeInMillis = 0;
Comment 2 John Ross CLA 2011-01-10 17:59:10 EST
In addition to the IAE for the Coordination.join() method, the following changes need to be made.

Type int has changed to long for all timeout related arguments.

Support for the new Coordination.RELEASED exception.

Within Coordination.extendTimeout(), simply returning 0 if the timer task could not be cancelled is against the spec. Needs to be changed to call Coordination.join() then throw the appropriate exception once it returns.

New Coordination.getBundle() method added.

New CoordinationException.WRONG_THREAD type in conjunction with new requirement on Coordination.end() which mandates that a coordination can only be ended by the same thread that pushed it onto the thread local stack.

Coordination.fail() should not remove the coordination from the thread local stack.

New requirement to unwind the thread local stack if a coordination that's not at the top of the stack is ended.

New Coordination.getEnclosingCoordination() method.
Comment 3 John Ross CLA 2011-01-11 19:38:25 EST
This will also include updates for changes to CoordinationPermission.
Comment 4 John Ross CLA 2011-01-11 19:40:31 EST
We can try to get the weak references to coordinations on thread local stacks in here as well, but that may take longer than is desired in order to get these other changes in.
Comment 5 John Ross CLA 2011-01-12 17:28:05 EST
(In reply to comment #4)
> We can try to get the weak references to coordinations on thread local stacks
> in here as well, but that may take longer than is desired in order to get these
> other changes in.

This patch will include converting to using ThreadLocal, as opposed to Map<Thread, LinkedList<Coordination>>, now that failing a coordination from other threads no longer requires removal from the thread local stack.

It will also include the use of WeakReference for coordinations on the stack.
Comment 6 Thomas Watson CLA 2011-01-13 08:38:19 EST
We should try to get this in for M5.
Comment 7 John Ross CLA 2011-01-20 19:29:41 EST
Also included will be the new security exceptions that must be thrown from various methods.
Comment 8 John Ross CLA 2011-01-21 08:56:45 EST
Created attachment 187283 [details]
Contains the changes discussed to date.

I'm attaching a bloated patch containing the changes discussed so far in case of a catastrophic failure.
Comment 9 John Ross CLA 2011-02-07 09:23:25 EST
Created attachment 188437 [details]
Condensed Patch

Here's a patch showing only what really changed.
Comment 10 Thomas Watson CLA 2011-02-07 17:08:23 EST
patch released.
Comment 11 Dani Megert CLA 2011-02-08 01:41:18 EST
This causes a compile warning in the official build:
http://download.eclipse.org/eclipse/downloads/drops/N20110207-2000/compilelogs/plugins/org.eclipse.equinox.coordinator_1.0.0.N20110207-2000/@dot.html

Please
1. set up your project(s) so that you see such warnings in the workspace
2. make sure to fix those warnings before committing to HEAD

Thanks!
Comment 12 Thomas Watson CLA 2011-02-08 08:36:52 EST
(In reply to comment #11)
> This causes a compile warning in the official build:
> http://download.eclipse.org/eclipse/downloads/drops/N20110207-2000/compilelogs/plugins/org.eclipse.equinox.coordinator_1.0.0.N20110207-2000/@dot.html
> 
> Please
> 1. set up your project(s) so that you see such warnings in the workspace
> 2. make sure to fix those warnings before committing to HEAD
> 
> Thanks!


1. WARNING in /src/org/osgi/service/coordinator/CoordinationPermission.java
 (at line 804)
permissions = (HashMap<String, CoordinationPermission>) gfields.get( "permissions", null);
Type safety: Unchecked cast from Object to HashMap<String,CoordinationPermission>

This is OSGi API for which we will have to go back to OSGi to get a source code change.  In the mean time it looks like we have to add the following to the build.properties.  Not sure if OSGi can make a source code change to add an annotation since they want the source to be able to compile against J2SE-1.4 libraries with jsr14 option.

javacWarnings..=-unchecked
Comment 13 Thomas Watson CLA 2011-02-08 08:42:34 EST
I released an update to the build.properties for now.
Comment 14 BJ Hargrave CLA 2011-02-08 09:25:58 EST
(In reply to comment #12)
> 1. WARNING in /src/org/osgi/service/coordinator/CoordinationPermission.java
>  (at line 804)
> permissions = (HashMap<String, CoordinationPermission>) gfields.get(
> "permissions", null);
> Type safety: Unchecked cast from Object to
> HashMap<String,CoordinationPermission>
> 
> This is OSGi API for which we will have to go back to OSGi to get a source code
> change.  In the mean time it looks like we have to add the following to the
> build.properties.  Not sure if OSGi can make a source code change to add an
> annotation since they want the source to be able to compile against J2SE-1.4
> libraries with jsr14 option.
> 
> javacWarnings..=-unchecked

All the OSGi permission classes have this "problem". OSGi can't use annotations since they are not in ee.minimum. So you will need to externally suppress the warning or live with it.
Comment 15 Dani Megert CLA 2011-02-09 02:07:40 EST
(In reply to comment #11)
> This causes a compile warning in the official build:
> http://download.eclipse.org/eclipse/downloads/drops/N20110207-2000/compilelogs/plugins/org.eclipse.equinox.coordinator_1.0.0.N20110207-2000/@dot.html
Verified in N20110208-2000 that the warning is gone.