1 ///////////////////////////////////////////////////////////////////////////// 2 // Copyright (c) 2009-2014 Alan Wright. All rights reserved. 3 // Distributable under the terms of either the Apache License (Version 2.0) 4 // or the GNU Lesser General Public License. 5 ///////////////////////////////////////////////////////////////////////////// 6 7 #include "LuceneInc.h" 8 #include "NoLockFactory.h" 9 #include "_NoLockFactory.h" 10 11 namespace Lucene { 12 ~NoLockFactory()13NoLockFactory::~NoLockFactory() { 14 } 15 getNoLockFactory()16NoLockFactoryPtr NoLockFactory::getNoLockFactory() { 17 static NoLockFactoryPtr singleton; 18 if (!singleton) { 19 singleton = newLucene<NoLockFactory>(); 20 CycleCheck::addStatic(singleton); 21 } 22 return singleton; 23 } 24 getSingletonLock()25NoLockPtr NoLockFactory::getSingletonLock() { 26 // Single instance returned whenever makeLock is called. 27 static NoLockPtr singletonLock; 28 if (!singletonLock) { 29 singletonLock = newLucene<NoLock>(); 30 CycleCheck::addStatic(singletonLock); 31 } 32 return singletonLock; 33 } 34 makeLock(const String & lockName)35LockPtr NoLockFactory::makeLock(const String& lockName) { 36 return getSingletonLock(); 37 } 38 clearLock(const String & lockName)39void NoLockFactory::clearLock(const String& lockName) { 40 } 41 ~NoLock()42NoLock::~NoLock() { 43 } 44 obtain()45bool NoLock::obtain() { 46 return true; 47 } 48 release()49void NoLock::release() { 50 } 51 isLocked()52bool NoLock::isLocked() { 53 return false; 54 } 55 toString()56String NoLock::toString() { 57 return getClassName(); 58 } 59 60 } 61