Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 126039 Details for
Bug 265324
[jobs] Deadlock with ILocks possible due to improper cleanup of ILocks not released when Job ends
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
Demo of deadlock
Test.java (text/x-java), 1.56 KB, created by
Min Idzelis
on 2009-02-18 11:25:59 EST
(
hide
)
Description:
Demo of deadlock
Filename:
MIME Type:
Creator:
Min Idzelis
Created:
2009-02-18 11:25:59 EST
Size:
1.56 KB
patch
obsolete
>import org.eclipse.core.internal.runtime.RuntimeLog; >import org.eclipse.core.runtime.ILogListener; >import org.eclipse.core.runtime.IProgressMonitor; >import org.eclipse.core.runtime.IStatus; >import org.eclipse.core.runtime.Status; >import org.eclipse.core.runtime.jobs.ILock; >import org.eclipse.core.runtime.jobs.ISchedulingRule; >import org.eclipse.core.runtime.jobs.Job; > >public class Test { > private static ISchedulingRule rule = new ISchedulingRule() { > > @Override > public boolean isConflicting(ISchedulingRule rule) { > return rule == this; > } > > @Override > public boolean contains(ISchedulingRule rule) { > return rule == this; > } > }; > private static ILogListener listener = new ILogListener() { > > @Override > public void logging(IStatus status, String plugin) { > System.out.println(status); > } > }; > > public static void main(String[] args) throws InterruptedException { > RuntimeLog.addLogListener(listener); > Job j = new Job("Test with rule") { > > @Override > protected IStatus run(IProgressMonitor monitor) { > Job.getJobManager().beginRule(rule, monitor); > return Status.OK_STATUS; > } > }; > j.schedule(); > j.join(); > // this will not deadlock > Job.getJobManager().beginRule(rule, null); > final ILock lock = Job.getJobManager().newLock(); > Job j2 = new Job("Test with lock") { > > @Override > protected IStatus run(IProgressMonitor monitor) { > lock.acquire(); > return Status.OK_STATUS; > } > }; > j2.schedule(); > j2.join(); > // this will deadlock. > lock.acquire(); > Thread.sleep(30000); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 265324
: 126039 |
227414