Author: shawkins
Date: 2011-12-06 10:31:53 -0500 (Tue, 06 Dec 2011)
New Revision: 3719
Added:
trunk/engine/src/main/java/org/teiid/common/buffer/TupleBufferCache.java
Modified:
trunk/engine/src/main/java/org/teiid/cache/Cachable.java
trunk/engine/src/main/java/org/teiid/common/buffer/BufferManager.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/PreparedPlan.java
trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
trunk/engine/src/main/java/org/teiid/dqp/service/BufferService.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
trunk/engine/src/test/java/org/teiid/dqp/service/FakeBufferService.java
trunk/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java
trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
trunk/engine/src/test/java/org/teiid/query/processor/TestTempTables.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/BufferManagerService.java
trunk/jboss-integration/src/main/java/org/teiid/jboss/CacheService.java
trunk/runtime/src/main/java/org/teiid/services/BufferServiceImpl.java
trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
Log:
TEIID-1720 limiting the scope of the buffermanger replication proxy
Modified: trunk/engine/src/main/java/org/teiid/cache/Cachable.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/cache/Cachable.java 2011-12-05 19:12:03 UTC (rev
3718)
+++ trunk/engine/src/main/java/org/teiid/cache/Cachable.java 2011-12-06 15:31:53 UTC (rev
3719)
@@ -21,14 +21,14 @@
*/
package org.teiid.cache;
-import org.teiid.common.buffer.BufferManager;
+import org.teiid.common.buffer.TupleBufferCache;
import org.teiid.dqp.internal.process.AccessInfo;
public interface Cachable {
- boolean prepare(BufferManager bufferManager);
+ boolean prepare(TupleBufferCache bufferManager);
- boolean restore(BufferManager bufferManager);
+ boolean restore(TupleBufferCache bufferManager);
AccessInfo getAccessInfo();
}
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/BufferManager.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/BufferManager.java 2011-12-05
19:12:03 UTC (rev 3718)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/BufferManager.java 2011-12-06
15:31:53 UTC (rev 3719)
@@ -24,8 +24,6 @@
import java.util.List;
-import org.teiid.Replicated;
-import org.teiid.Replicated.ReplicationMode;
import org.teiid.core.TeiidComponentException;
import org.teiid.query.sql.symbol.Expression;
@@ -38,7 +36,7 @@
* how to store data. The buffer manager should also be aware of memory
* management issues.
*/
-public interface BufferManager extends StorageManager {
+public interface BufferManager extends StorageManager, TupleBufferCache {
public enum TupleSourceType {
/**
@@ -127,9 +125,6 @@
void addTupleBuffer(TupleBuffer tb);
- @Replicated(replicateState=ReplicationMode.PULL)
- TupleBuffer getTupleBuffer(String id);
-
/**
* Set the maxActivePlans as a hint at determining the maxProcessing
* @param maxActivePlans
@@ -142,6 +137,4 @@
* @return
*/
int reserveAdditionalBuffers(int additional);
-
- void distributeTupleBuffer(String uuid, TupleBuffer tb);
}
Added: trunk/engine/src/main/java/org/teiid/common/buffer/TupleBufferCache.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/TupleBufferCache.java
(rev 0)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/TupleBufferCache.java 2011-12-06
15:31:53 UTC (rev 3719)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.common.buffer;
+
+import org.teiid.Replicated;
+import org.teiid.Replicated.ReplicationMode;
+
+public interface TupleBufferCache {
+
+ @Replicated(replicateState=ReplicationMode.PULL)
+ TupleBuffer getTupleBuffer(String id);
+
+ void distributeTupleBuffer(String uuid, TupleBuffer tb);
+
+}
Property changes on:
trunk/engine/src/main/java/org/teiid/common/buffer/TupleBufferCache.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java
===================================================================
---
trunk/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java 2011-12-05
19:12:03 UTC (rev 3718)
+++
trunk/engine/src/main/java/org/teiid/dqp/internal/process/CachedResults.java 2011-12-06
15:31:53 UTC (rev 3719)
@@ -27,8 +27,8 @@
import org.teiid.api.exception.query.QueryParserException;
import org.teiid.api.exception.query.QueryResolverException;
import org.teiid.cache.Cachable;
-import org.teiid.common.buffer.BufferManager;
import org.teiid.common.buffer.TupleBuffer;
+import org.teiid.common.buffer.TupleBufferCache;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidException;
import org.teiid.core.util.Assertion;
@@ -93,14 +93,14 @@
}
@Override
- public boolean prepare(BufferManager bufferManager) {
+ public boolean prepare(TupleBufferCache bufferManager) {
Assertion.assertTrue(!this.results.isForwardOnly());
bufferManager.distributeTupleBuffer(this.results.getId(), results);
return true;
}
@Override
- public synchronized boolean restore(BufferManager bufferManager) {
+ public synchronized boolean restore(TupleBufferCache bufferManager) {
if (this.results == null) {
if (this.hasLobs) {
return false; //the lob store is local only and not distributed
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/PreparedPlan.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/PreparedPlan.java 2011-12-05
19:12:03 UTC (rev 3718)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/PreparedPlan.java 2011-12-06
15:31:53 UTC (rev 3719)
@@ -25,7 +25,7 @@
import java.util.List;
import org.teiid.cache.Cachable;
-import org.teiid.common.buffer.BufferManager;
+import org.teiid.common.buffer.TupleBufferCache;
import org.teiid.query.analysis.AnalysisRecord;
import org.teiid.query.processor.ProcessorPlan;
import org.teiid.query.processor.relational.AccessNode;
@@ -114,12 +114,12 @@
}
@Override
- public boolean prepare(BufferManager bufferManager) {
+ public boolean prepare(TupleBufferCache bufferManager) {
return true; //no remotable actions
}
@Override
- public boolean restore(BufferManager bufferManager) {
+ public boolean restore(TupleBufferCache bufferManager) {
return true; //no remotable actions
}
Modified:
trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java
===================================================================
---
trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2011-12-05
19:12:03 UTC (rev 3718)
+++
trunk/engine/src/main/java/org/teiid/dqp/internal/process/SessionAwareCache.java 2011-12-06
15:31:53 UTC (rev 3719)
@@ -37,7 +37,7 @@
import org.teiid.cache.DefaultCache;
import org.teiid.cache.DefaultCacheFactory;
import org.teiid.cache.CacheConfiguration.Policy;
-import org.teiid.common.buffer.BufferManager;
+import org.teiid.common.buffer.TupleBufferCache;
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.util.Assertion;
import org.teiid.core.util.EquivalenceUtil;
@@ -69,7 +69,7 @@
private AtomicInteger cacheHit = new AtomicInteger();
private AtomicInteger totalRequests = new AtomicInteger();
- private BufferManager bufferManager;
+ private TupleBufferCache bufferManager;
public SessionAwareCache(){
this(DEFAULT_MAX_SIZE_TOTAL);
@@ -318,7 +318,7 @@
return maxSize;
}
- public void setBufferManager(BufferManager bufferManager) {
+ public void setTupleBufferCache(TupleBufferCache bufferManager) {
this.bufferManager = bufferManager;
}
Modified: trunk/engine/src/main/java/org/teiid/dqp/service/BufferService.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/service/BufferService.java 2011-12-05
19:12:03 UTC (rev 3718)
+++ trunk/engine/src/main/java/org/teiid/dqp/service/BufferService.java 2011-12-06
15:31:53 UTC (rev 3719)
@@ -23,9 +23,11 @@
package org.teiid.dqp.service;
import org.teiid.common.buffer.BufferManager;
+import org.teiid.common.buffer.TupleBufferCache;
public interface BufferService {
BufferManager getBufferManager();
+ TupleBufferCache getTupleBufferCache();
}
Modified:
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java
===================================================================
---
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java 2011-12-05
19:12:03 UTC (rev 3718)
+++
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestCachedResults.java 2011-12-06
15:31:53 UTC (rev 3719)
@@ -21,9 +21,7 @@
*/
package org.teiid.dqp.internal.process;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
import java.util.Arrays;
import java.util.List;
@@ -32,12 +30,13 @@
import org.teiid.cache.Cache;
import org.teiid.cache.DefaultCache;
import org.teiid.common.buffer.BufferManager;
-import org.teiid.common.buffer.BufferManager.TupleSourceType;
import org.teiid.common.buffer.BufferManagerFactory;
import org.teiid.common.buffer.TupleBuffer;
+import org.teiid.common.buffer.BufferManager.TupleSourceType;
import org.teiid.core.types.DataTypeManager;
import org.teiid.core.util.UnitTestUtil;
import org.teiid.dqp.service.BufferService;
+import org.teiid.dqp.service.FakeBufferService;
import org.teiid.metadata.Table;
import org.teiid.query.processor.FakeProcessorPlan;
import org.teiid.query.processor.ProcessorPlan;
@@ -51,12 +50,7 @@
@Test
public void testCaching() throws Exception {
- BufferService fbs = new BufferService() {
- @Override
- public BufferManager getBufferManager() {
- return BufferManagerFactory.getStandaloneBufferManager();
- }
- };
+ BufferService fbs = new FakeBufferService(true);
ElementSymbol x = new ElementSymbol("x"); //$NON-NLS-1$
x.setType(DataTypeManager.DefaultDataClasses.INTEGER);
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2011-12-05
19:12:03 UTC (rev 3718)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2011-12-06
15:31:53 UTC (rev 3719)
@@ -46,7 +46,6 @@
import org.teiid.client.RequestMessage.StatementType;
import org.teiid.client.lob.LobChunk;
import org.teiid.client.util.ResultsFuture;
-import org.teiid.common.buffer.BufferManager;
import org.teiid.common.buffer.BufferManagerFactory;
import org.teiid.common.buffer.impl.BufferManagerImpl;
import org.teiid.core.TeiidProcessingException;
@@ -56,6 +55,7 @@
import org.teiid.dqp.internal.process.AbstractWorkItem.ThreadState;
import org.teiid.dqp.service.AutoGenDataService;
import org.teiid.dqp.service.BufferService;
+import org.teiid.dqp.service.FakeBufferService;
import org.teiid.query.optimizer.TestOptimizer;
import org.teiid.query.optimizer.capabilities.BasicSourceCapabilities;
import org.teiid.query.optimizer.capabilities.SourceCapabilities.Capability;
@@ -114,15 +114,9 @@
ConnectorManagerRepository repo =
Mockito.mock(ConnectorManagerRepository.class);
context.getVDB().addAttchment(ConnectorManagerRepository.class, repo);
Mockito.stub(repo.getConnectorManager(Mockito.anyString())).toReturn(agds);
- BufferService bs = new BufferService() {
-
- @Override
- public BufferManager getBufferManager() {
- BufferManagerImpl bm = BufferManagerFactory.createBufferManager();
- bm.setInlineLobs(false);
- return bm;
- }
- };
+ BufferManagerImpl bm = BufferManagerFactory.createBufferManager();
+ bm.setInlineLobs(false);
+ BufferService bs = new FakeBufferService(bm, bm);
core = new DQPCore();
core.setBufferService(bs);
core.setResultsetCache(new SessionAwareCache<CachedResults>(new
DefaultCacheFactory(), SessionAwareCache.Type.RESULTSET, new CacheConfiguration()));
@@ -137,7 +131,7 @@
config.setAuthorizationValidator(daa);
core.start(config);
core.getPrepPlanCache().setModTime(1);
- core.getRsCache().setBufferManager(bs.getBufferManager());
+ core.getRsCache().setTupleBufferCache(bs.getBufferManager());
}
@After public void tearDown() throws Exception {
Modified: trunk/engine/src/test/java/org/teiid/dqp/service/FakeBufferService.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/service/FakeBufferService.java 2011-12-05
19:12:03 UTC (rev 3718)
+++ trunk/engine/src/test/java/org/teiid/dqp/service/FakeBufferService.java 2011-12-06
15:31:53 UTC (rev 3719)
@@ -24,19 +24,38 @@
import org.teiid.common.buffer.BufferManager;
import org.teiid.common.buffer.BufferManagerFactory;
+import org.teiid.common.buffer.TupleBufferCache;
public class FakeBufferService implements BufferService {
private BufferManager bufferMgr;
+ private TupleBufferCache tupleBufferCache;
public FakeBufferService() {
- super();
-
- bufferMgr = BufferManagerFactory.getStandaloneBufferManager();
+ this(true);
}
+
+ public FakeBufferService(boolean shared) {
+ if (shared) {
+ bufferMgr = BufferManagerFactory.getStandaloneBufferManager();
+ } else {
+ bufferMgr = BufferManagerFactory.createBufferManager();
+ }
+ this.tupleBufferCache = bufferMgr;
+ }
+
+ public FakeBufferService(BufferManager buffManager, TupleBufferCache
tupleBufferCache) {
+ this.bufferMgr = buffManager;
+ this.tupleBufferCache = tupleBufferCache;
+ }
public BufferManager getBufferManager() {
return bufferMgr;
}
+
+ @Override
+ public TupleBufferCache getTupleBufferCache() {
+ return tupleBufferCache;
+ }
}
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java
===================================================================
---
trunk/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java 2011-12-05
19:12:03 UTC (rev 3718)
+++
trunk/engine/src/test/java/org/teiid/query/processor/TestMaterialization.java 2011-12-06
15:31:53 UTC (rev 3719)
@@ -74,7 +74,7 @@
hdm.addData("SELECT mattable.info.e2, mattable.info.e1 FROM mattable.info",
new List[] {Arrays.asList(1, "a"), Arrays.asList(2, "a")});
SessionAwareCache<CachedResults> cache = new
SessionAwareCache<CachedResults>();
- cache.setBufferManager(bm);
+ cache.setTupleBufferCache(bm);
dataManager = new TempTableDataManager(hdm, bm, ExecutorUtils.getDirectExecutor(),
cache);
}
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java 2011-12-05
19:12:03 UTC (rev 3718)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestProcessor.java 2011-12-06
15:31:53 UTC (rev 3719)
@@ -245,7 +245,7 @@
}
if (!(dataManager instanceof TempTableDataManager)) {
SessionAwareCache<CachedResults> cache = new
SessionAwareCache<CachedResults>();
- cache.setBufferManager(bufferMgr);
+ cache.setTupleBufferCache(bufferMgr);
dataManager = new TempTableDataManager(dataManager, bufferMgr,
ExecutorUtils.getDirectExecutor(), cache);
}
if (context.getQueryProcessorFactory() == null) {
Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestTempTables.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestTempTables.java 2011-12-05
19:12:03 UTC (rev 3718)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestTempTables.java 2011-12-06
15:31:53 UTC (rev 3719)
@@ -93,7 +93,7 @@
TestProcessor.sampleData1(fdm);
BufferManager bm = BufferManagerFactory.getStandaloneBufferManager();
SessionAwareCache<CachedResults> cache = new
SessionAwareCache<CachedResults>();
- cache.setBufferManager(bm);
+ cache.setTupleBufferCache(bm);
dataManager = new TempTableDataManager(fdm, bm, ExecutorUtils.getDirectExecutor(),
cache);
}
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/BufferManagerService.java
===================================================================
---
trunk/jboss-integration/src/main/java/org/teiid/jboss/BufferManagerService.java 2011-12-05
19:12:03 UTC (rev 3718)
+++
trunk/jboss-integration/src/main/java/org/teiid/jboss/BufferManagerService.java 2011-12-06
15:31:53 UTC (rev 3719)
@@ -27,6 +27,7 @@
import org.jboss.msc.service.StopContext;
import org.jboss.msc.value.InjectedValue;
import org.teiid.common.buffer.BufferManager;
+import org.teiid.common.buffer.TupleBufferCache;
import org.teiid.dqp.service.BufferService;
import org.teiid.query.ObjectReplicator;
import org.teiid.services.BufferServiceImpl;
@@ -37,6 +38,7 @@
public final InjectedValue<String> pathInjector = new
InjectedValue<String>();
public final InjectedValue<ObjectReplicator> replicatorInjector = new
InjectedValue<ObjectReplicator>();
private BufferManager manager;
+ private TupleBufferCache tupleBufferCache;
public BufferManagerService(BufferServiceImpl buffer) {
this.bufferService = buffer;
@@ -47,10 +49,11 @@
bufferService.setDiskDirectory(pathInjector.getValue());
bufferService.start();
manager = bufferService.getBufferManager();
+ tupleBufferCache = manager;
if (replicatorInjector.getValue() != null) {
try {
//use a mux name that will not conflict with any vdb
- manager = this.replicatorInjector.getValue().replicate("$BM$",
BufferManager.class, this.manager, 0); //$NON-NLS-1$
+ tupleBufferCache = this.replicatorInjector.getValue().replicate("$BM$",
TupleBufferCache.class, this.manager, 0); //$NON-NLS-1$
} catch (Exception e) {
throw new StartException(e);
}
@@ -69,6 +72,11 @@
public BufferManager getBufferManager() {
return manager;
}
+
+ @Override
+ public TupleBufferCache getTupleBufferCache() {
+ return tupleBufferCache;
+ }
@Override
public BufferService getValue() throws IllegalStateException,IllegalArgumentException {
Modified: trunk/jboss-integration/src/main/java/org/teiid/jboss/CacheService.java
===================================================================
--- trunk/jboss-integration/src/main/java/org/teiid/jboss/CacheService.java 2011-12-05
19:12:03 UTC (rev 3718)
+++ trunk/jboss-integration/src/main/java/org/teiid/jboss/CacheService.java 2011-12-06
15:31:53 UTC (rev 3719)
@@ -39,7 +39,7 @@
@Override
public void start(StartContext context) throws StartException {
- this.cache.setBufferManager(this.bufferMgrInjector.getValue().getBufferManager());
+ this.cache.setTupleBufferCache(this.bufferMgrInjector.getValue().getTupleBufferCache());
}
@Override
Modified: trunk/runtime/src/main/java/org/teiid/services/BufferServiceImpl.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/services/BufferServiceImpl.java 2011-12-05
19:12:03 UTC (rev 3718)
+++ trunk/runtime/src/main/java/org/teiid/services/BufferServiceImpl.java 2011-12-06
15:31:53 UTC (rev 3719)
@@ -27,6 +27,7 @@
import java.io.Serializable;
import org.teiid.common.buffer.BufferManager;
+import org.teiid.common.buffer.TupleBufferCache;
import org.teiid.common.buffer.impl.BufferFrontedFileStoreCache;
import org.teiid.common.buffer.impl.BufferManagerImpl;
import org.teiid.common.buffer.impl.FileStorageManager;
@@ -147,6 +148,11 @@
public BufferManagerImpl getBufferManager() {
return this.bufferMgr;
}
+
+ @Override
+ public TupleBufferCache getTupleBufferCache() {
+ return this.bufferMgr;
+ }
public void setUseDisk(boolean flag) {
this.useDisk = flag;
Modified: trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2011-12-05
19:12:03 UTC (rev 3718)
+++ trunk/test-integration/common/src/test/java/org/teiid/jdbc/FakeServer.java 2011-12-06
15:31:53 UTC (rev 3719)
@@ -52,8 +52,7 @@
import org.teiid.cache.CacheConfiguration.Policy;
import org.teiid.client.DQP;
import org.teiid.client.security.ILogon;
-import org.teiid.common.buffer.BufferManager;
-import org.teiid.common.buffer.BufferManagerFactory;
+import org.teiid.common.buffer.TupleBufferCache;
import org.teiid.core.TeiidRuntimeException;
import org.teiid.core.util.UnitTestUtil;
import org.teiid.deployers.CompositeVDB;
@@ -71,6 +70,7 @@
import org.teiid.dqp.internal.process.PreparedPlan;
import org.teiid.dqp.internal.process.SessionAwareCache;
import org.teiid.dqp.service.BufferService;
+import org.teiid.dqp.service.FakeBufferService;
import org.teiid.metadata.FunctionMethod;
import org.teiid.metadata.MetadataRepository;
import org.teiid.metadata.MetadataStore;
@@ -269,13 +269,7 @@
this.sessionService.setVDBRepository(repo);
BufferService bs = null;
if (!realBufferMangaer) {
- bs = new BufferService() {
-
- @Override
- public BufferManager getBufferManager() {
- return BufferManagerFactory.createBufferManager();
- }
- };
+ bs = new FakeBufferService(false);
} else {
BufferServiceImpl bsi = new BufferServiceImpl();
bsi.setDiskDirectory(UnitTestUtil.getTestScratchPath());
@@ -284,14 +278,8 @@
}
if (replicator != null) {
try {
- final BufferManager bm = replicator.replicate("$BM$", BufferManager.class,
bs.getBufferManager(), 0);
- bs = new BufferService() {
-
- @Override
- public BufferManager getBufferManager() {
- return bm;
- }
- };
+ final TupleBufferCache tbc = replicator.replicate("$BM$",
TupleBufferCache.class, bs.getBufferManager(), 0);
+ bs = new FakeBufferService(bs.getBufferManager(), tbc);
} catch (Exception e) {
throw new TeiidRuntimeException(e);
}
@@ -320,10 +308,10 @@
};
SessionAwareCache rs = new SessionAwareCache<CachedResults>(dcf,
SessionAwareCache.Type.RESULTSET, new CacheConfiguration(Policy.LRU, 60, 250,
"resultsetcache"));
SessionAwareCache ppc = new SessionAwareCache<PreparedPlan>(dcf,
SessionAwareCache.Type.PREPAREDPLAN, new CacheConfiguration());
- rs.setBufferManager(this.dqp.getBufferManager());
+ rs.setTupleBufferCache(bs.getTupleBufferCache());
this.dqp.setResultsetCache(rs);
- ppc.setBufferManager(this.dqp.getBufferManager());
+ ppc.setTupleBufferCache(bs.getTupleBufferCache());
this.dqp.setPreparedPlanCache(ppc);
this.dqp.setTransactionService(new FakeTransactionService());