1 | /** |
---|
2 | * @copyright |
---|
3 | * ==================================================================== |
---|
4 | * Copyright (c) 2003-2007 CollabNet. All rights reserved. |
---|
5 | * |
---|
6 | * This software is licensed as described in the file COPYING, which |
---|
7 | * you should have received as part of this distribution. The terms |
---|
8 | * are also available at http://subversion.tigris.org/license-1.html. |
---|
9 | * If newer versions of this license are posted there, you may use a |
---|
10 | * newer version instead, at your option. |
---|
11 | * |
---|
12 | * This software consists of voluntary contributions made by many |
---|
13 | * individuals. For exact contribution history, see the revision |
---|
14 | * history and logs, available at http://subversion.tigris.org/. |
---|
15 | * ==================================================================== |
---|
16 | * @endcopyright |
---|
17 | * |
---|
18 | * @file Pool.cpp |
---|
19 | * @brief Implementation of the class Pool |
---|
20 | */ |
---|
21 | |
---|
22 | #include "Pool.h" |
---|
23 | #include "JNIUtil.h" |
---|
24 | #include "JNIMutex.h" |
---|
25 | #include "JNICriticalSection.h" |
---|
26 | #include "svn_pools.h" |
---|
27 | |
---|
28 | /** |
---|
29 | * Constructor to create one apr pool as the subpool of the global pool |
---|
30 | * store this pool as the request pool. |
---|
31 | */ |
---|
32 | Pool::Pool() |
---|
33 | { |
---|
34 | JNICriticalSection criticalSection(*JNIUtil::getGlobalPoolMutex()); |
---|
35 | m_pool = svn_pool_create(JNIUtil::getPool()); |
---|
36 | JNIUtil::setRequestPool(this); |
---|
37 | } |
---|
38 | |
---|
39 | /** |
---|
40 | * Destructor to destroy the apr pool and to clear the request pool |
---|
41 | * pointer. |
---|
42 | */ |
---|
43 | Pool::~Pool() |
---|
44 | { |
---|
45 | JNICriticalSection criticalSection(*JNIUtil::getGlobalPoolMutex()); |
---|
46 | JNIUtil::setRequestPool(NULL); |
---|
47 | if (m_pool) |
---|
48 | svn_pool_destroy(m_pool); |
---|
49 | } |
---|