public static void closeSession ( String wrapper ) { Session session = map . get ( wrapper ) ; if ( session != null ) { Method method ; try { method = session . getClass ( ) . getDeclaredMethod ( "protectedClose" ) ; method . setAccessible ( true ) ; method . invoke ( session ) ; } catch ( InvocationTargetException e ) { throw new RiverException ( e . getCause ( ) . getMessage ( ) , e ) ; } catch ( Exception e ) { throw new RiverException ( e ) ; } map . remove ( wrapper ) ; } }
Calls the Session close method to free resources memory etc . Also it will remove it from its internal table .