org.baswell.routes
Class DefaultRouteInstancePool

java.lang.Object
  extended by org.baswell.routes.DefaultRouteInstancePool
All Implemented Interfaces:
RouteInstancePool

public class DefaultRouteInstancePool
extends java.lang.Object
implements RouteInstancePool

Create a new route object each time using the default constructor and discards the object after use.


Constructor Summary
DefaultRouteInstancePool()
           
 
Method Summary
 java.lang.Object borrowRouteInstance(java.lang.Class routeClass)
          Called when a route match has been made to a method in the given class and an instance is needed to process the request.
 void returnRouteInstance(java.lang.Object routeInstance)
          The Routes engine is done using this route instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultRouteInstancePool

public DefaultRouteInstancePool()
Method Detail

borrowRouteInstance

public java.lang.Object borrowRouteInstance(java.lang.Class routeClass)
                                     throws RouteInstanceBorrowException
Description copied from interface: RouteInstancePool
Called when a route match has been made to a method in the given class and an instance is needed to process the request. If the route class is not thread safe then once an instance is returned from this method it should not be used again until it's put back in the pool (returnRouteInstance).

Specified by:
borrowRouteInstance in interface RouteInstancePool
Parameters:
routeClass - A route class that was added to the RoutingTable.
Returns:
A instance of the given route class this is ready to process an HTTP request.
Throws:
RouteInstanceBorrowException - If a route instance cannot be borrowed for any reason.

returnRouteInstance

public void returnRouteInstance(java.lang.Object routeInstance)
Description copied from interface: RouteInstancePool
The Routes engine is done using this route instance.

Specified by:
returnRouteInstance in interface RouteInstancePool
Parameters:
routeInstance - A route object previous retrieved from borrowRouteInstance.