mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Great refactoring
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
package net.openhft.chronicle.map;
|
||||
|
||||
import net.openhft.chronicle.hash.replication.ThrottlingConfig;
|
||||
import net.openhft.chronicle.map.ReplicatedChronicleMap.BytesReplicatedContextFactory;
|
||||
import net.openhft.lang.io.ByteBufferBytes;
|
||||
import net.openhft.lang.io.Bytes;
|
||||
import net.openhft.lang.thread.NamedThreadFactory;
|
||||
@@ -75,8 +76,7 @@ abstract class AbstractChannelReplicator implements Closeable {
|
||||
private final Throttler throttler;
|
||||
|
||||
volatile boolean isClosed = false;
|
||||
ThreadLocalCopies copies;
|
||||
VanillaChronicleMap.SegmentState segmentState;
|
||||
ReplicatedChronicleMap.BytesReplicatedContext context;
|
||||
|
||||
AbstractChannelReplicator(String name, ThrottlingConfig throttlingConfig)
|
||||
throws IOException {
|
||||
@@ -215,8 +215,7 @@ abstract class AbstractChannelReplicator implements Closeable {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
copies = VanillaChronicleMap.SegmentState.getCopies(null);
|
||||
segmentState = VanillaChronicleMap.SegmentState.get(copies);
|
||||
context = VanillaContext.get(BytesReplicatedContextFactory.INSTANCE);
|
||||
processEvent();
|
||||
} catch (Exception e) {
|
||||
LOG.error("", e);
|
||||
@@ -259,10 +258,10 @@ abstract class AbstractChannelReplicator implements Closeable {
|
||||
|
||||
public void closeResources() {
|
||||
isClosed = true;
|
||||
// context.close();
|
||||
executorService.shutdown();
|
||||
closeables.closeQuietly();
|
||||
if (segmentState != null)
|
||||
segmentState.close();
|
||||
|
||||
}
|
||||
|
||||
private void dumpThreadStackTrace(long start) {
|
||||
@@ -438,6 +437,7 @@ abstract class AbstractChannelReplicator implements Closeable {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Bytes resizeBuffer(int size) {
|
||||
|
||||
if (LOG.isDebugEnabled())
|
||||
@@ -466,6 +466,7 @@ abstract class AbstractChannelReplicator implements Closeable {
|
||||
return in;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBeIgnored(final Bytes entry, final int chronicleId) {
|
||||
return !externalizable.identifierCheck(entry, chronicleId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user