Skip to content

Commit

Permalink
Merge pull request #7529 from mdogan/partition-layout
Browse files Browse the repository at this point in the history
Restructure layout of partition package
  • Loading branch information
enesakar committed Feb 18, 2016
2 parents 08dfcb1 + 4bd93d4 commit 02a9f9d
Show file tree
Hide file tree
Showing 174 changed files with 864 additions and 560 deletions.
8 changes: 4 additions & 4 deletions checkstyle/suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,12 @@
<suppress checks="JavadocMethod" files="com/hazelcast/partition/"/>
<suppress checks="JavadocType" files="com/hazelcast/partition/"/>
<suppress checks="JavadocVariable" files="com/hazelcast/partition/"/>
<suppress checks="MethodCount" files="com/hazelcast/partition/InternalPartitionService"/>
<suppress checks="MethodCount|ExecutableStatementCount|FileLengthCheck|MagicNumber"
files="com/hazelcast/partition/impl/InternalPartitionServiceImpl"/>
files="com/hazelcast/internal/partition/impl/InternalPartitionServiceImpl"/>
<suppress checks="ClassFanOutComplexity|ClassDataAbstractionCoupling"
files="com/hazelcast/partition/impl/InternalPartitionServiceImpl"/>
<suppress checks="CyclomaticComplexity|NPathComplexity" files="com/hazelcast/partition/impl/PartitionStateGeneratorImpl"/>
files="com/hazelcast/internal/partition/impl/InternalPartitionServiceImpl"/>
<suppress checks="CyclomaticComplexity|NPathComplexity"
files="com/hazelcast/internal/partition/impl/PartitionStateGeneratorImpl"/>

<!-- Topic -->
<suppress checks="VisibilityModifier" files="com/hazelcast/topic/impl/TopicEvent"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.hazelcast.client.test.TestHazelcastFactory;
import com.hazelcast.config.CacheConfig;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.partition.InternalPartitionLostEvent;
import com.hazelcast.partition.IPartitionLostEvent;
import com.hazelcast.spi.EventRegistration;
import com.hazelcast.spi.impl.eventservice.InternalEventService;
import com.hazelcast.test.AssertTask;
Expand Down Expand Up @@ -95,7 +95,7 @@ public void test_cachePartitionLostListener_invoked() {

final CacheService cacheService = getNode(instance).getNodeEngine().getService(CacheService.SERVICE_NAME);
final int partitionId = 5;
cacheService.onPartitionLost(new InternalPartitionLostEvent(partitionId, 0, null));
cacheService.onPartitionLost(new IPartitionLostEvent(partitionId, 0, null));

assertCachePartitionLostEventEventually(listener, partitionId);
}
Expand Down Expand Up @@ -129,8 +129,8 @@ public void test_cachePartitionLostListener_invoked_fromOtherNode() {
final CacheService cacheService1 = getNode(instance1).getNodeEngine().getService(CacheService.SERVICE_NAME);
final CacheService cacheService2 = getNode(instance2).getNodeEngine().getService(CacheService.SERVICE_NAME);
final int partitionId = 5;
cacheService1.onPartitionLost(new InternalPartitionLostEvent(partitionId, 0, null));
cacheService2.onPartitionLost(new InternalPartitionLostEvent(partitionId, 0, null));
cacheService1.onPartitionLost(new IPartitionLostEvent(partitionId, 0, null));
cacheService2.onPartitionLost(new IPartitionLostEvent(partitionId, 0, null));

assertCachePartitionLostEventEventually(listener, partitionId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.hazelcast.map.impl.MapService;
import com.hazelcast.map.listener.MapPartitionLostListener;
import com.hazelcast.nio.Address;
import com.hazelcast.partition.InternalPartitionLostEvent;
import com.hazelcast.partition.IPartitionLostEvent;
import com.hazelcast.spi.EventRegistration;
import com.hazelcast.spi.impl.eventservice.InternalEventService;
import com.hazelcast.test.AssertTask;
Expand Down Expand Up @@ -92,7 +92,7 @@ public void test_mapPartitionLostListener_invoked() {

final MapService mapService = getNode(instance).getNodeEngine().getService(MapService.SERVICE_NAME);
final int partitionId = 5;
mapService.onPartitionLost(new InternalPartitionLostEvent(partitionId, 0, null));
mapService.onPartitionLost(new IPartitionLostEvent(partitionId, 0, null));

assertMapPartitionLostEventEventually(listener, partitionId);
}
Expand Down Expand Up @@ -140,7 +140,7 @@ public void test_mapPartitionLostListener_invoked_fromOtherNode() {

final MapService mapService = getNode(other).getNodeEngine().getService(SERVICE_NAME);
final int partitionId = 5;
mapService.onPartitionLost(new InternalPartitionLostEvent(partitionId, 0, null));
mapService.onPartitionLost(new IPartitionLostEvent(partitionId, 0, null));

assertMapPartitionLostEventEventually(listener, partitionId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
import com.hazelcast.nio.ObjectDataOutput;
import com.hazelcast.nio.serialization.PortableReader;
import com.hazelcast.nio.serialization.PortableWriter;
import com.hazelcast.partition.InternalPartitionLostEvent;
import com.hazelcast.partition.IPartitionLostEvent;
import com.hazelcast.partition.PartitionLostEvent;
import com.hazelcast.partition.PartitionLostListener;
import com.hazelcast.partition.PartitionLostListenerStressTest.EventCollectingPartitionLostListener;
import com.hazelcast.partition.impl.InternalPartitionServiceImpl;
import com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl;
import com.hazelcast.spi.EventRegistration;
import com.hazelcast.spi.impl.PortablePartitionLostEvent;
import com.hazelcast.spi.impl.eventservice.InternalEventService;
Expand All @@ -31,8 +31,8 @@
import java.util.List;

import static com.hazelcast.client.impl.ClientTestUtil.getHazelcastClientInstanceImpl;
import static com.hazelcast.partition.InternalPartitionService.PARTITION_LOST_EVENT_TOPIC;
import static com.hazelcast.partition.InternalPartitionService.SERVICE_NAME;
import static com.hazelcast.internal.partition.InternalPartitionService.PARTITION_LOST_EVENT_TOPIC;
import static com.hazelcast.internal.partition.InternalPartitionService.SERVICE_NAME;
import static com.hazelcast.test.HazelcastTestSupport.assertTrueEventually;
import static com.hazelcast.test.HazelcastTestSupport.getAddress;
import static com.hazelcast.test.HazelcastTestSupport.getNode;
Expand Down Expand Up @@ -90,7 +90,7 @@ public void test_partitionLostListener_invoked() {

final InternalPartitionServiceImpl partitionService = getNode(instance).getNodeEngine().getService(SERVICE_NAME);
final int partitionId = 5;
partitionService.onPartitionLost(new InternalPartitionLostEvent(partitionId, 0, null));
partitionService.onPartitionLost(new IPartitionLostEvent(partitionId, 0, null));

assertPartitionLostEventEventually(listener, partitionId);
}
Expand All @@ -117,7 +117,7 @@ public void test_partitionLostListener_invoked_fromOtherNode() {

final InternalPartitionServiceImpl partitionService = getNode(other).getNodeEngine().getService(SERVICE_NAME);
final int partitionId = 5;
partitionService.onPartitionLost(new InternalPartitionLostEvent(partitionId, 0, null));
partitionService.onPartitionLost(new IPartitionLostEvent(partitionId, 0, null));

assertPartitionLostEventEventually(listener, partitionId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@

import com.hazelcast.config.CacheConfig;
import com.hazelcast.core.ICompletableFuture;
import com.hazelcast.internal.serialization.SerializationService;
import com.hazelcast.map.impl.MapEntries;
import com.hazelcast.nio.serialization.Data;
import com.hazelcast.internal.serialization.SerializationService;
import com.hazelcast.partition.InternalPartitionService;
import com.hazelcast.partition.IPartitionService;
import com.hazelcast.spi.InternalCompletableFuture;
import com.hazelcast.spi.NodeEngine;
import com.hazelcast.spi.Operation;
Expand Down Expand Up @@ -361,7 +361,7 @@ public int size() {
}

private Set<Integer> getPartitionsForKeys(Set<Data> keys) {
final InternalPartitionService partitionService = getNodeEngine().getPartitionService();
final IPartitionService partitionService = getNodeEngine().getPartitionService();
final int partitions = partitionService.getPartitionCount();
final int capacity = Math.min(partitions, keys.size());
final Set<Integer> partitionIds = new HashSet<Integer>(capacity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import com.hazelcast.logging.ILogger;
import com.hazelcast.nio.Address;
import com.hazelcast.nio.serialization.Data;
import com.hazelcast.partition.InternalPartitionService;
import com.hazelcast.partition.IPartitionService;
import com.hazelcast.spi.ExecutionService;
import com.hazelcast.spi.InternalCompletableFuture;
import com.hazelcast.spi.NodeEngine;
Expand Down Expand Up @@ -69,7 +69,7 @@ abstract class AbstractCacheProxyBase<K, V> {
protected final ICacheService cacheService;
protected final SerializationService serializationService;
protected final CacheOperationProvider operationProvider;
protected final InternalPartitionService partitionService;
protected final IPartitionService partitionService;

private final NodeEngine nodeEngine;
private final CopyOnWriteArrayList<Future> loadAllTasks = new CopyOnWriteArrayList<Future>();
Expand Down Expand Up @@ -217,7 +217,7 @@ public void run() {
OperationService operationService = getNodeEngine().getOperationService();
OperationFactory operationFactory;

InternalPartitionService partitionService = getNodeEngine().getPartitionService();
IPartitionService partitionService = getNodeEngine().getPartitionService();
Map<Address, List<Integer>> memberPartitionsMap = partitionService.getMemberPartitionsMap();
Map<Integer, Object> results = new HashMap<Integer, Object>();

Expand Down Expand Up @@ -249,7 +249,7 @@ public void run() {
}
}

private Set<Data> filterOwnerKeys(InternalPartitionService partitionService, Set<Integer> partitions) {
private Set<Data> filterOwnerKeys(IPartitionService partitionService, Set<Integer> partitions) {
Set<Data> ownerKeys = new HashSet<Data>();
for (Data key: keysData) {
int keyPartitionId = partitionService.getPartitionId(key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
import com.hazelcast.map.impl.MapEntries;
import com.hazelcast.nio.Address;
import com.hazelcast.nio.serialization.Data;
import com.hazelcast.partition.InternalPartition;
import com.hazelcast.partition.InternalPartitionService;
import com.hazelcast.partition.IPartition;
import com.hazelcast.partition.IPartitionService;
import com.hazelcast.spi.EventRegistration;
import com.hazelcast.spi.NodeEngine;
import com.hazelcast.spi.impl.eventservice.InternalEventService;
Expand Down Expand Up @@ -164,8 +164,8 @@ public AbstractCacheRecordStore(final String name, final int partitionId, final
//CHECKSTYLE:ON

private boolean isPrimary() {
InternalPartitionService partitionService = nodeEngine.getPartitionService();
InternalPartition partition = partitionService.getPartition(partitionId, false);
IPartitionService partitionService = nodeEngine.getPartitionService();
IPartition partition = partitionService.getPartition(partitionId, false);
Address owner = partition.getOwnerOrNull();
Address thisAddress = nodeEngine.getThisAddress();
return owner != null && owner.equals(thisAddress);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import com.hazelcast.core.Member;
import com.hazelcast.nio.IOUtil;
import com.hazelcast.nio.serialization.Data;
import com.hazelcast.partition.InternalPartitionLostEvent;
import com.hazelcast.partition.IPartitionLostEvent;
import com.hazelcast.partition.MigrationEndpoint;
import com.hazelcast.spi.EventFilter;
import com.hazelcast.spi.EventRegistration;
Expand Down Expand Up @@ -528,7 +528,7 @@ Collection<EventRegistration> getRegistrations(String cacheName) {
}

@Override
public void onPartitionLost(InternalPartitionLostEvent partitionLostEvent) {
public void onPartitionLost(IPartitionLostEvent partitionLostEvent) {
final int partitionId = partitionLostEvent.getPartitionId();
for (CacheConfig config : getCacheConfigs()) {
final String cacheName = config.getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import com.hazelcast.logging.ILogger;
import com.hazelcast.nio.Address;
import com.hazelcast.nio.serialization.Data;
import com.hazelcast.partition.InternalPartitionService;
import com.hazelcast.partition.IPartitionService;
import com.hazelcast.spi.NodeEngine;
import com.hazelcast.util.ExceptionUtil;

Expand Down Expand Up @@ -58,7 +58,7 @@ class CacheSplitBrainHandler {

Runnable prepareMergeRunnable() {
final Map<String, Map<Data, CacheRecord>> recordMap = new HashMap<String, Map<Data, CacheRecord>>(configs.size());
final InternalPartitionService partitionService = nodeEngine.getPartitionService();
final IPartitionService partitionService = nodeEngine.getPartitionService();
final int partitionCount = partitionService.getPartitionCount();
final Address thisAddress = nodeEngine.getClusterService().getThisAddress();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import com.hazelcast.nio.ObjectDataOutput;
import com.hazelcast.nio.serialization.Data;
import com.hazelcast.nio.serialization.IdentifiedDataSerializable;
import com.hazelcast.partition.InternalPartitionService;
import com.hazelcast.partition.IPartitionService;
import com.hazelcast.spi.BackupAwareOperation;
import com.hazelcast.spi.Operation;
import com.hazelcast.spi.PartitionAwareOperation;
Expand Down Expand Up @@ -71,7 +71,7 @@ public CacheLoadAllOperation() {
public void run()
throws Exception {
int partitionId = getPartitionId();
InternalPartitionService partitionService = getNodeEngine().getPartitionService();
IPartitionService partitionService = getNodeEngine().getPartitionService();

Set<Data> filteredKeys = null;
if (keys != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import com.hazelcast.nio.ObjectDataInput;
import com.hazelcast.nio.ObjectDataOutput;
import com.hazelcast.nio.serialization.Data;
import com.hazelcast.partition.InternalPartitionService;
import com.hazelcast.partition.IPartitionService;
import com.hazelcast.spi.BackupAwareOperation;
import com.hazelcast.spi.Operation;
import com.hazelcast.spi.impl.MutatingOperation;
Expand Down Expand Up @@ -91,7 +91,7 @@ private void filterKeys() {
if (keys == null) {
return;
}
InternalPartitionService partitionService = getNodeEngine().getPartitionService();
IPartitionService partitionService = getNodeEngine().getPartitionService();
for (Data k : keys) {
if (partitionService.getPartitionId(k) == getPartitionId()) {
filteredKeys.add(k);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@

package com.hazelcast.client;

import com.hazelcast.internal.cluster.ClusterService;
import com.hazelcast.config.Config;
import com.hazelcast.core.ClientType;
import com.hazelcast.instance.MemberImpl;
import com.hazelcast.internal.cluster.ClusterService;
import com.hazelcast.internal.serialization.SerializationService;
import com.hazelcast.logging.ILogger;
import com.hazelcast.nio.Address;
import com.hazelcast.internal.serialization.SerializationService;
import com.hazelcast.partition.InternalPartitionService;
import com.hazelcast.partition.IPartitionService;
import com.hazelcast.security.SecurityContext;
import com.hazelcast.spi.EventService;
import com.hazelcast.spi.ProxyService;
Expand All @@ -39,7 +39,7 @@ public interface ClientEngine {

int getClientEndpointCount();

InternalPartitionService getPartitionService();
IPartitionService getPartitionService();

ClusterService getClusterService();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import com.hazelcast.client.impl.protocol.ClientMessage;
import com.hazelcast.client.impl.protocol.MessageTaskFactory;
import com.hazelcast.client.impl.protocol.task.MessageTask;
import com.hazelcast.internal.cluster.ClusterService;
import com.hazelcast.config.Config;
import com.hazelcast.core.Client;
import com.hazelcast.core.ClientListener;
Expand All @@ -37,14 +36,15 @@
import com.hazelcast.instance.GroupProperty;
import com.hazelcast.instance.MemberImpl;
import com.hazelcast.instance.Node;
import com.hazelcast.internal.cluster.ClusterService;
import com.hazelcast.internal.serialization.SerializationService;
import com.hazelcast.logging.ILogger;
import com.hazelcast.nio.Address;
import com.hazelcast.nio.ClassLoaderUtil;
import com.hazelcast.nio.Connection;
import com.hazelcast.nio.ConnectionListener;
import com.hazelcast.nio.tcp.TcpIpConnection;
import com.hazelcast.partition.InternalPartitionService;
import com.hazelcast.partition.IPartitionService;
import com.hazelcast.security.SecurityContext;
import com.hazelcast.spi.CoreService;
import com.hazelcast.spi.EventPublishingService;
Expand Down Expand Up @@ -173,7 +173,7 @@ public void handleClientMessage(ClientMessage clientMessage, Connection connecti
}

@Override
public InternalPartitionService getPartitionService() {
public IPartitionService getPartitionService() {
return nodeEngine.getPartitionService();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
import com.hazelcast.client.impl.protocol.codec.ClientAddPartitionLostListenerCodec;
import com.hazelcast.instance.Node;
import com.hazelcast.nio.Connection;
import com.hazelcast.partition.InternalPartitionService;
import com.hazelcast.partition.IPartitionService;
import com.hazelcast.partition.PartitionLostEvent;
import com.hazelcast.partition.PartitionLostListener;

import java.security.Permission;

import static com.hazelcast.partition.InternalPartitionService.PARTITION_LOST_EVENT_TOPIC;
import static com.hazelcast.internal.partition.InternalPartitionService.PARTITION_LOST_EVENT_TOPIC;

public class AddPartitionLostListenerMessageTask
extends AbstractCallableMessageTask<ClientAddPartitionLostListenerCodec.RequestParameters> {
Expand All @@ -37,7 +37,7 @@ public AddPartitionLostListenerMessageTask(ClientMessage clientMessage, Node nod

@Override
protected Object call() throws Exception {
final InternalPartitionService partitionService = getService(getServiceName());
final IPartitionService partitionService = getService(getServiceName());

final PartitionLostListener listener = new PartitionLostListener() {
@Override
Expand Down Expand Up @@ -74,7 +74,7 @@ protected ClientMessage encodeResponse(Object response) {

@Override
public String getServiceName() {
return InternalPartitionService.SERVICE_NAME;
return IPartitionService.SERVICE_NAME;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import com.hazelcast.instance.Node;
import com.hazelcast.nio.Address;
import com.hazelcast.nio.Connection;
import com.hazelcast.partition.InternalPartition;
import com.hazelcast.partition.InternalPartitionService;
import com.hazelcast.partition.IPartition;
import com.hazelcast.internal.partition.InternalPartitionService;

import java.security.Permission;
import java.util.HashMap;
Expand All @@ -43,7 +43,7 @@ protected Object call() {

Map<Address, List<Integer>> partitionsMap = new HashMap<Address, List<Integer>>();

for (InternalPartition partition : service.getPartitions()) {
for (IPartition partition : service.getPartitions()) {
Address owner = partition.getOwnerOrNull();
if (owner == null) {
partitionsMap.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import com.hazelcast.client.impl.protocol.codec.ClientRemovePartitionLostListenerCodec;
import com.hazelcast.instance.Node;
import com.hazelcast.nio.Connection;
import com.hazelcast.partition.InternalPartitionService;
import com.hazelcast.internal.partition.InternalPartitionService;

import java.security.Permission;

Expand Down
Loading

0 comments on commit 02a9f9d

Please sign in to comment.