hudson.slaves
Class WorkspaceList

java.lang.Object
  extended by hudson.slaves.WorkspaceList

public final class WorkspaceList
extends Object

Used by Computer to keep track of workspaces that are actively in use.

Since:
1.319
Author:
Kohsuke Kawaguchi
See Also:
Computer.getWorkspaceList()

Nested Class Summary
static class WorkspaceList.Entry
          Book keeping for workspace allocation.
static class WorkspaceList.Lease
          Represents a leased workspace that needs to be returned later.
 
Constructor Summary
WorkspaceList()
           
 
Method Summary
 WorkspaceList.Lease acquire(FilePath p)
          Acquires the given workspace.
 WorkspaceList.Lease acquire(FilePath p, boolean quick)
          See acquire(FilePath)
 WorkspaceList.Lease acquire(FilePath p, boolean quick, Object context)
          See acquire(FilePath,boolean)
 WorkspaceList.Lease allocate(FilePath base)
          Allocates a workspace by adding some variation to the given base to make it unique.
 WorkspaceList.Lease allocate(FilePath base, Object context)
          See allocate(FilePath)
 WorkspaceList.Lease record(FilePath p)
          Just record that this workspace is being used, without paying any attention to the synchronization support.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkspaceList

public WorkspaceList()
Method Detail

allocate

public WorkspaceList.Lease allocate(FilePath base)
                             throws InterruptedException
Allocates a workspace by adding some variation to the given base to make it unique.

This method doesn't block prolonged amount of time. Whenever a desired workspace is in use, the unique variation is added.

Throws:
InterruptedException

allocate

public WorkspaceList.Lease allocate(FilePath base,
                                    Object context)
                             throws InterruptedException
See allocate(FilePath)

Parameters:
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.
Throws:
InterruptedException

record

public WorkspaceList.Lease record(FilePath p)
Just record that this workspace is being used, without paying any attention to the synchronization support.


acquire

public WorkspaceList.Lease acquire(FilePath p)
                            throws InterruptedException
Acquires the given workspace. If necessary, this method blocks until it's made available.

Returns:
The same FilePath as given to this method.
Throws:
InterruptedException

acquire

public WorkspaceList.Lease acquire(FilePath p,
                                   boolean quick)
                            throws InterruptedException
See acquire(FilePath)

Parameters:
quick - If true, indicates that the acquired workspace will be returned quickly. This makes other calls to allocate(FilePath) to wait for the release of this workspace.
Throws:
InterruptedException

acquire

public WorkspaceList.Lease acquire(FilePath p,
                                   boolean quick,
                                   Object context)
                            throws InterruptedException
See acquire(FilePath,boolean)

Parameters:
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.
Throws:
InterruptedException


Copyright © 2004-2013. All Rights Reserved.