Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mac m1] Added a bndrun file for the m1 #5347

Merged
merged 1 commit into from Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions biz.aQute.bndlib/src/aQute/bnd/build/WorkspaceLock.java
Expand Up @@ -5,9 +5,11 @@
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.Callable;
import java.util.concurrent.CancellationException;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicInteger;
Expand All @@ -29,6 +31,7 @@ final class WorkspaceLock extends ReentrantReadWriteLock {
private static final long serialVersionUID = 1L;
private static final Logger logger = LoggerFactory.getLogger(WorkspaceLock.class);
private final AtomicInteger progress = new AtomicInteger();
private final List<Thread> readHolders = new CopyOnWriteArrayList<>();

WorkspaceLock(boolean fair) {
super(fair);
Expand Down Expand Up @@ -130,7 +133,16 @@ <T, U> T writeReadLocked(final long timeoutInMs, final Callable<U> underWrite,

<T> T locked(final Lock lock, final long timeoutInMs, final Callable<T> callable, final BooleanSupplier canceled)
throws Exception {
Thread thread = Thread.currentThread();
boolean interrupted = Thread.interrupted();
boolean write = lock == writeLock();
if (write) {
if (readHolders.contains(thread))
throw new IllegalStateException("About to enter a deadlock situation. The thread " + thread
+ " that already holds a read lock attempts to acquire the workspace write lock.");
} else
readHolders.add(thread);

trace("Enter", lock);
try {
int startingProgress = progress.get();
Expand Down Expand Up @@ -169,6 +181,7 @@ <T> T locked(final Lock lock, final long timeoutInMs, final Callable<T> callable
throw timeout(lock);
} finally {
trace("Exit", lock);
readHolders.remove(thread);
if (interrupted) {
Thread.currentThread()
.interrupt();
Expand Down
Expand Up @@ -26,6 +26,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
Expand Down Expand Up @@ -305,9 +306,12 @@ protected IProject[] build(int kind, Map<String, String> args, IProgressMonitor
processor.close();
});
if (model.isCnf()) {
model.getWorkspace()
Job job = Job.create("refresh workspace", (m) -> {
model.getWorkspace()
.refresh(); // this is for bnd plugins built in
// cnf
// cnf
});
job.schedule(10);
}
return null;
}, monitor);
Expand Down