/** * Acquires the given workspace. If necessary, this method blocks until it's made available. * * @return * The same {@link FilePath} as given to this method. */ public synchronized Lease acquire(@Nonnull FilePath p) throws InterruptedException { return acquire(p,false); }
/** * See {@link #acquire(FilePath)} * * @param quick * If true, indicates that the acquired workspace will be returned quickly. * This makes other calls to {@link #allocate(FilePath)} to wait for the release of this workspace. */ public synchronized Lease acquire(@Nonnull FilePath p, boolean quick) throws InterruptedException { return acquire(p,quick,new Object()); }
/** * See {@link #allocate(FilePath)} * * @param context * Threads that share the same context can re-acquire the same lock (which will just increment the lock count.) * This allows related executors to share the same workspace. */ public synchronized Lease allocate(@Nonnull FilePath base, Object context) throws InterruptedException { for (int i=1; ; i++) { FilePath candidate = i==1 ? base : base.withSuffix(COMBINATOR+i); Entry e = inUse.get(candidate); if(e!=null && !e.quick && e.context!=context) continue; return acquire(candidate,false,context); } }
private PollingResult pollWithWorkspace(TaskListener listener, SCM scm, R lb, @Nonnull FilePath ws, WorkspaceList l) throws InterruptedException, IOException { // if doing non-concurrent build, acquire a workspace in a way that causes builds to block for this workspace. // this prevents multiple workspaces of the same job --- the behavior of Hudson < 1.319. // // OTOH, if a concurrent build is chosen, the user is willing to create a multiple workspace, // so better throughput is achieved over time (modulo the initial cost of creating that many workspaces) // by having multiple workspaces Node node = lb.getBuiltOn(); Launcher launcher = ws.createLauncher(listener).decorateByEnv(getEnvironment(node,listener)); WorkspaceList.Lease lease = l.acquire(ws, !concurrentBuild); try { String nodeName = node != null ? node.getSelfLabel().getName() : "[node_unavailable]"; listener.getLogger().println("Polling SCM changes on " + nodeName); LOGGER.fine("Polling SCM changes of " + getName()); if (pollingBaseline==null) // see NOTE-NO-BASELINE above calcPollingBaseline(lb,launcher,listener); PollingResult r = scm.poll(this, launcher, ws, listener, pollingBaseline); pollingBaseline = r.remote; return r; } finally { lease.release(); } }
/** * Acquires the given workspace. If necessary, this method blocks until it's * made available. * * @return The same {@link FilePath} as given to this method. */ public synchronized Lease acquire(FilePath p) throws InterruptedException { return acquire(p, false); }
/** * Acquires the given workspace. If necessary, this method blocks until it's made available. * * @return * The same {@link FilePath} as given to this method. */ public synchronized Lease acquire(FilePath p) throws InterruptedException { return acquire(p,false); }
/** * Acquires the given workspace. If necessary, this method blocks until it's made available. * * @return * The same {@link FilePath} as given to this method. */ public synchronized Lease acquire(FilePath p) throws InterruptedException { return acquire(p,false); }
/** * Acquires the given workspace. If necessary, this method blocks until it's made available. * * @return * The same {@link FilePath} as given to this method. */ public synchronized Lease acquire(FilePath p) throws InterruptedException { return acquire(p,false); }
/** * Acquires the given workspace. If necessary, this method blocks until it's made available. * * @return * The same {@link FilePath} as given to this method. */ public synchronized Lease acquire(@Nonnull FilePath p) throws InterruptedException { return acquire(p,false); }
/** * See {@link #acquire(FilePath)} * * @param quick * If true, indicates that the acquired workspace will be returned quickly. * This makes other calls to {@link #allocate(FilePath)} to wait for the release of this workspace. */ public synchronized Lease acquire(@Nonnull FilePath p, boolean quick) throws InterruptedException { return acquire(p,quick,new Object()); }
/** * Allocates a workspace by adding some variation to the given base to make it unique. */ public synchronized Lease allocate(FilePath base) throws InterruptedException { for (int i=1; ; i++) { //Workspace suffix was changed from @ to _, because of some issues with SCMs. //see http://issues.hudson-ci.org/browse/HUDSON-4791 FilePath candidate = i==1 ? base : base.withSuffix(WORKSPACE_NAME_SUFFIX + i); Entry e = inUse.get(candidate); if(e!=null && !e.quick) continue; return acquire(candidate); } }
/** * Allocates a workspace by adding some variation to the given base to make it unique. */ public synchronized Lease allocate(FilePath base) throws InterruptedException { for (int i=1; ; i++) { //Workspace suffix was changed from @ to _, because of some issues with SCMs. //see http://issues.hudson-ci.org/browse/HUDSON-4791 FilePath candidate = i==1 ? base : base.withSuffix(WORKSPACE_NAME_SUFFIX + i); Entry e = inUse.get(candidate); if(e!=null && !e.quick) continue; return acquire(candidate); } }
/** * Allocates a workspace by adding some variation to the given base to make it unique. */ public synchronized Lease allocate(FilePath base) throws InterruptedException { for (int i=1; ; i++) { //Workspace suffix was changed from @ to _, because of some issues with SCMs. //see http://issues.hudson-ci.org/browse/HUDSON-4791 FilePath candidate = i==1 ? base : base.withSuffix(WORKSPACE_NAME_SUFFIX + i); Entry e = inUse.get(candidate); if(e!=null && !e.quick) continue; return acquire(candidate); } }
/** * See {@link #allocate(FilePath)} * * @param context * Threads that share the same context can re-acquire the same lock (which will just increment the lock count.) * This allows related executors to share the same workspace. */ public synchronized Lease allocate(@Nonnull FilePath base, Object context) throws InterruptedException { for (int i=1; ; i++) { FilePath candidate = i==1 ? base : base.withSuffix(COMBINATOR+i); Entry e = inUse.get(candidate); if(e!=null && !e.quick && e.context!=context) continue; return acquire(candidate,false,context); } }
/** * Allocates a workspace by adding some variation to the given base to make * it unique. */ public synchronized Lease allocate(FilePath base) throws InterruptedException { for (int i = 1;; i++) { //Workspace suffix was changed from @ to _, because of some issues with SCMs. //see http://issues.hudson-ci.org/browse/HUDSON-4791 FilePath candidate = i == 1 ? base : base.withSuffix(WORKSPACE_NAME_SUFFIX + i); Entry e = inUse.get(candidate); if (e != null && !e.quick) { continue; } return acquire(candidate); } }
private PollingResult pollWithWorkspace(TaskListener listener, SCM scm, R lb, @Nonnull FilePath ws, WorkspaceList l) throws InterruptedException, IOException { // if doing non-concurrent build, acquire a workspace in a way that causes builds to block for this workspace. // this prevents multiple workspaces of the same job --- the behavior of Hudson < 1.319. // // OTOH, if a concurrent build is chosen, the user is willing to create a multiple workspace, // so better throughput is achieved over time (modulo the initial cost of creating that many workspaces) // by having multiple workspaces Node node = lb.getBuiltOn(); Launcher launcher = ws.createLauncher(listener).decorateByEnv(getEnvironment(node,listener)); WorkspaceList.Lease lease = l.acquire(ws, !concurrentBuild); try { String nodeName = node != null ? node.getSelfLabel().getName() : "[node_unavailable]"; listener.getLogger().println("Polling SCM changes on " + nodeName); LOGGER.fine("Polling SCM changes of " + getName()); if (pollingBaseline==null) // see NOTE-NO-BASELINE above calcPollingBaseline(lb,launcher,listener); PollingResult r = scm.poll(this, launcher, ws, listener, pollingBaseline); pollingBaseline = r.remote; return r; } finally { lease.release(); } }
lease = c.getWorkspaceList().acquire(workspace, !isConcurrentBuild()); } else { workspace = null;
WorkspaceList.Lease lease = l.acquire(ws, !concurrentBuild); Launcher launcher = ws.createLauncher(listener); try {
delegate.setChangelog(true); FilePath acquiredDir; try (WorkspaceList.Lease lease = computer.getWorkspaceList().acquire(dir)) { for (int retryCount = Jenkins.get().getScmCheckoutRetryCount(); retryCount >= 0; retryCount--) { try {
try (WorkspaceList.Lease lease = computer.getWorkspaceList().acquire(dir)) { SCMStep delegate = new GenericSCMStep(standaloneSCM); delegate.setPoll(true); } else { listener.getLogger().println("Checking out " + head.getName() + " to read " + step.path); try (WorkspaceList.Lease lease = computer.getWorkspaceList().acquire(dir)) { if (trustCheck) { SCMStep delegate = new GenericSCMStep(scmSource.build(head, tip));