hudson.model
Class Resource

java.lang.Object
  extended by hudson.model.Resource

public final class Resource
extends Object

Represents things that Queue.Executable uses while running.

This is used in Queue to support basic mutual exclusion/locks. If two Queue.Tasks require the same Resource, they will not be run at the same time.

Resources are compared by using their names, and need not have the "same object" semantics.

Since:
1.121

Field Summary
 String displayName
          Human-readable name of this resource.
 int numConcurrentWrite
          Maximum number of concurrent write.
 Resource parent
          Parent resource.
 
Constructor Summary
Resource(Resource parent, String displayName)
           
Resource(Resource parent, String displayName, int numConcurrentWrite)
           
Resource(String displayName)
           
 
Method Summary
 boolean equals(Object o)
           
 int hashCode()
           
 boolean isCollidingWith(Resource that, int count)
          Checks the resource collision.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

displayName

public final String displayName
Human-readable name of this resource. Used for rendering HTML.


parent

public final Resource parent
Parent resource.

A child resource is considered a part of the parent resource, so acquiring the parent resource always imply acquiring all the child resources.


numConcurrentWrite

public final int numConcurrentWrite
Maximum number of concurrent write.

Constructor Detail

Resource

public Resource(Resource parent,
                String displayName)

Resource

public Resource(Resource parent,
                String displayName,
                int numConcurrentWrite)
Since:
1.155

Resource

public Resource(String displayName)
Method Detail

isCollidingWith

public boolean isCollidingWith(Resource that,
                               int count)
Checks the resource collision.

Parameters:
count - If we are testing W/W conflict, total # of write counts. For R/W conflict test, this value should be set to Integer.MAX_VALUE.

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2004-2013. All Rights Reserved.