com.openharbor.beck.map
Class SharedMapFromXML

java.lang.Object
  extended bycom.openharbor.beck.map.SharedMapFromXML
All Implemented Interfaces:
MapFromXML.Source

public class SharedMapFromXML
extends java.lang.Object
implements MapFromXML.Source

A source of mappers that simply allocates the same mapper to all callers. This strategy is fast and cheap but not thread-safe. DefaultMapperPool is a thread-safe alternative.


Constructor Summary
SharedMapFromXML(MapFromXML shared)
           
 
Method Summary
 MapFromXML allocateMapFromXML()
          Obtain a current mapper.
 void pollSoon()
          Check for a change in the configuration next time allocateMapFromXML() is called, regardless of the currently acceptable staleness.
 void releaseMapFromXML(MapFromXML released)
          Make a mapper available for re-use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SharedMapFromXML

public SharedMapFromXML(MapFromXML shared)
Method Detail

allocateMapFromXML

public MapFromXML allocateMapFromXML()
Description copied from interface: MapFromXML.Source
Obtain a current mapper. For best performance, the caller should pass the allocated mapper to MapFromXML.Source.releaseMapFromXML(com.openharbor.beck.map.MapFromXML) after the caller has done using it. For best performance, this method should return the same object repeatedly, switching to a new object only when necessary (e.g. when the old object is intolerably stale).

Specified by:
allocateMapFromXML in interface MapFromXML.Source

releaseMapFromXML

public void releaseMapFromXML(MapFromXML released)
Description copied from interface: MapFromXML.Source
Make a mapper available for re-use. The caller must not use this mapper subsequently (unless the same mapper is returned from another call to MapFromXML.Source.allocateMapFromXML()). This Source may allocate the mapper to another thread, which might result in erroneous concurrent use of the mapper by both threads if a previous releaser cheats.

Specified by:
releaseMapFromXML in interface MapFromXML.Source

pollSoon

public void pollSoon()
Description copied from interface: MapFromXML.Source
Check for a change in the configuration next time MapFromXML.Source.allocateMapFromXML() is called, regardless of the currently acceptable staleness.

Specified by:
pollSoon in interface MapFromXML.Source