org.jhotdraw.contrib.html
Class ETSLADisposalStrategy

java.lang.Object
  extended by org.jhotdraw.contrib.html.ETSLADisposalStrategy
All Implemented Interfaces:
ResourceDisposabilityStrategy

public class ETSLADisposalStrategy
extends java.lang.Object
implements ResourceDisposabilityStrategy

ETSLADisposalStrategy implements an Ellapsed Time Since Last Access disposal strategy. It checks the last time a resource was accessed and if greater than the resource's disposalDelay it disposes of the resource so that it can be GCed.
Disposal activity must be explicitely started using the startDisposing method

Version:
1.0
Author:
Eduardo Francos - InContext

Constructor Summary
ETSLADisposalStrategy()
          Constructor for the ETSLADisposalStrategy object
ETSLADisposalStrategy(DisposableResourceManager newManager, long newPeriodicity)
          Constructor for the ETSLADisposalStrategy object
ETSLADisposalStrategy(long periodicity)
          Constructor for the ETSLADisposalStrategy object
 
Method Summary
 DisposableResourceManager getManager()
          Gets the manager holding the resources for this strategy
 long getPeriodicity()
          Gets the periodicity attribute of the ETSLADisposalStrategy object
 void setManager(DisposableResourceManager newManager)
          Sets the manager holding the resources for this strategy
 void setPeriodicity(long newPeriodicity)
          Sets the periodicity attribute of the ETSLADisposalStrategy object
 void startDisposing()
          Activates the strategy which starts disposing of resources as fitted
 void stopDisposing(long millis)
          Deactivates the strategy that stops automatic disposal of resources.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ETSLADisposalStrategy

public ETSLADisposalStrategy()
Constructor for the ETSLADisposalStrategy object


ETSLADisposalStrategy

public ETSLADisposalStrategy(long periodicity)
Constructor for the ETSLADisposalStrategy object

Parameters:
periodicity - the periodicity at which to check for disposable resources

ETSLADisposalStrategy

public ETSLADisposalStrategy(DisposableResourceManager newManager,
                             long newPeriodicity)
Constructor for the ETSLADisposalStrategy object

Parameters:
manager - the manager
periodicity - the periodicity at which to check for disposable resources
Method Detail

setManager

public void setManager(DisposableResourceManager newManager)
Sets the manager holding the resources for this strategy

Specified by:
setManager in interface ResourceDisposabilityStrategy
Parameters:
manager - The new manager value

getManager

public DisposableResourceManager getManager()
Gets the manager holding the resources for this strategy

Specified by:
getManager in interface ResourceDisposabilityStrategy
Returns:
The manager value

startDisposing

public void startDisposing()
                    throws ResourceManagerNotSetException
Activates the strategy which starts disposing of resources as fitted

Specified by:
startDisposing in interface ResourceDisposabilityStrategy
Throws:
ResourceManagerNotSetException - thrown if the manager has not been set, so impossible to run

stopDisposing

public void stopDisposing(long millis)
Deactivates the strategy that stops automatic disposal of resources.
The millis parameters specifies in milliseconds the time to wait for the disposal to stop. After this time the method returns, but the deactivation request remains active.

Specified by:
stopDisposing in interface ResourceDisposabilityStrategy
Parameters:
millis - time to wait for disposal to stop

getPeriodicity

public long getPeriodicity()
Gets the periodicity attribute of the ETSLADisposalStrategy object

Returns:
The periodicity value

setPeriodicity

public void setPeriodicity(long newPeriodicity)
Sets the periodicity attribute of the ETSLADisposalStrategy object

Parameters:
newPeriodicity - The new periodicity value