com.openharbor.beck.map
Class SharedMapToXML

java.lang.Object
  extended bycom.openharbor.beck.map.SharedMapToXML
All Implemented Interfaces:
MapToXML.Source

public class SharedMapToXML
extends java.lang.Object
implements MapToXML.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
SharedMapToXML(MapToXML shared)
           
 
Method Summary
 MapToXML allocateMapToXML()
          Obtain a current mapper.
 void pollSoon()
          Check for a change in the configuration next time allocateMapToXML() is called, regardless of the currently acceptable staleness.
 void releaseMapToXML(MapToXML released)
          Make a mapper available for use by other threads.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SharedMapToXML

public SharedMapToXML(MapToXML shared)
Method Detail

allocateMapToXML

public MapToXML allocateMapToXML()
Description copied from interface: MapToXML.Source
Obtain a current mapper. For best performance, the caller should pass the allocated mapper to MapToXML.Source.releaseMapToXML(com.openharbor.beck.map.MapToXML) 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:
allocateMapToXML in interface MapToXML.Source

releaseMapToXML

public void releaseMapToXML(MapToXML released)
Description copied from interface: MapToXML.Source
Make a mapper available for use by other threads. The caller must not use this mapper subsequently (unless the same mapper is returned from another call to MapToXML.Source.allocateMapToXML()). This source may allocate the mapper to another thread, which might result in erroneous concurrent use of the mapper by both threads.

Specified by:
releaseMapToXML in interface MapToXML.Source

pollSoon

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

Specified by:
pollSoon in interface MapToXML.Source