rename EndPoint classes -> Endpoint, part 2.

patch by Erick Tryzelaar; reviewed by jbellis for CASSANDRA-994

git-svn-id: https://svn.apache.org/repos/asf/cassandra/trunk@935717 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Ellis 2010-04-19 19:58:10 +00:00
parent a5fa451c2b
commit 7a4a7090cb
21 changed files with 69 additions and 69 deletions

View File

@ -49,8 +49,8 @@
~ EndpointSnitch: Setting this to the class that implements
~ AbstractEndpointSnitch, which lets Cassandra know enough
~ about your network topology to route requests efficiently.
~ Out of the box, Cassandra provides org.apache.cassandra.locator.EndPointSnitch,
~ and PropertyFileEndPointSnitch is available in contrib/.
~ Out of the box, Cassandra provides org.apache.cassandra.locator.EndpointSnitch,
~ and PropertyFileEndpointSnitch is available in contrib/.
-->
<EndpointSnitch>org.apache.cassandra.locator.EndpointSnitch</EndpointSnitch>

View File

@ -133,7 +133,7 @@
~ Out of the box, Cassandra provides org.apache.cassandra.locator.EndpointSnitch,
~ and PropertyFileEndpointSnitch is available in contrib/.
-->
<EndpointSnitch>org.apache.cassandra.locator.EndPointSnitch</EndpointSnitch>
<EndpointSnitch>org.apache.cassandra.locator.EndpointSnitch</EndpointSnitch>
</Keyspace>
</Keyspaces>

View File

@ -1,15 +1,15 @@
PropertyFileEndPointSnitch
PropertyFileEndpointSnitch
==========================
Cassandra's RackAwareStrategy can be used to have replication take
data-center and/or rack location into account when placing replicas. The
ProperyFileEndPointSnitch allows you to make use of RackAwareStrategy by
ProperyFileEndpointSnitch allows you to make use of RackAwareStrategy by
specifying node locations in a standard key/value properties file.
Properties File
---------------
The EndPointSnitch expects to find a file on the classapth named
The EndpointSnitch expects to find a file on the classapth named
cassandra-rack.properties in the following format:
<node IP>\:<port>=<data center name>:<rack name>
@ -28,8 +28,8 @@ Installing
* Copy build/cassandra-propsnitch.jar to your Cassandra lib/
directory, or otherwise add it to the CLASSPATH
(see http://wiki.apache.org/cassandra/RunningCassandra)
* Edit the EndPointSnitch element of storage-conf.xml to use
org.apache.cassandra.locator.PropertyFileEndPointSnitch
* Edit the EndpointSnitch element of storage-conf.xml to use
org.apache.cassandra.locator.PropertyFileEndpointSnitch
* Create the cassandra-rack.properties in your classpath
(e.g. in your Cassandra conf/ directory)
* Optionally set ReplicaPlacementStrategy in cassandra.xml to

View File

@ -36,18 +36,18 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* PropertyFileEndPointSnitch
*
* PropertyFileEndPointSnitch is used by Digg to determine if two IP's are in the same
* PropertyFileEndpointSnitch
*
* PropertyFileEndpointSnitch is used by Digg to determine if two IP's are in the same
* datacenter or on the same rack.
*
*
*/
public class PropertyFileEndPointSnitch extends EndpointSnitch implements PropertyFileEndPointSnitchMBean {
public class PropertyFileEndpointSnitch extends EndpointSnitch implements PropertyFileEndpointSnitchMBean {
/**
* A list of properties with keys being host:port and values being datacenter:rack
*/
private Properties hostProperties = new Properties();
/**
* The default rack property file to be read.
*/
@ -57,13 +57,13 @@ public class PropertyFileEndPointSnitch extends EndpointSnitch implements Proper
* Whether to use the parent for detection of same node
*/
private boolean runInBaseMode = false;
/**
* Reference to the logger.
*/
private static Logger logger_ = LoggerFactory.getLogger(PropertyFileEndPointSnitch.class);
private static Logger logger_ = LoggerFactory.getLogger(PropertyFileEndpointSnitch.class);
public PropertyFileEndPointSnitch() throws ConfigurationException
public PropertyFileEndpointSnitch() throws ConfigurationException
{
reloadConfiguration();
try
@ -125,7 +125,7 @@ public class PropertyFileEndPointSnitch extends EndpointSnitch implements Proper
@Override
public boolean isInSameDataCenter(InetAddress host, InetAddress host2)
throws UnknownHostException {
if (runInBaseMode)
if (runInBaseMode)
{
return super.isInSameDataCenter(host, host2);
}
@ -135,11 +135,11 @@ public class PropertyFileEndPointSnitch extends EndpointSnitch implements Proper
@Override
public boolean isOnSameRack(InetAddress host, InetAddress host2)
throws UnknownHostException {
if (runInBaseMode)
if (runInBaseMode)
{
return super.isOnSameRack(host, host2);
}
if (!isInSameDataCenter(host, host2))
if (!isInSameDataCenter(host, host2))
{
return false;
}
@ -155,10 +155,10 @@ public class PropertyFileEndPointSnitch extends EndpointSnitch implements Proper
}
return configurationString.toString();
}
public void reloadConfiguration() throws ConfigurationException
{
ClassLoader loader = PropertyFileEndPointSnitch.class.getClassLoader();
ClassLoader loader = PropertyFileEndpointSnitch.class.getClassLoader();
URL scpurl = loader.getResource(RACK_PROPERTY_FILENAME);
if (scpurl == null)
throw new ConfigurationException("unable to locate " + RACK_PROPERTY_FILENAME);
@ -172,7 +172,7 @@ public class PropertyFileEndPointSnitch extends EndpointSnitch implements Proper
hostProperties = localHostProperties;
runInBaseMode = false;
}
catch (IOException ioe)
catch (IOException ioe)
{
throw new ConfigurationException("Could not process " + rackPropertyFilename, ioe);
}

View File

@ -23,18 +23,18 @@ import java.io.IOException;
import org.apache.cassandra.config.ConfigurationException;
/**
* PropertyFileEndPointSnitchMBean
* PropertyFileEndpointSnitchMBean
*
* PropertyFileEndPointSnitchMBean is the management interface for Digg's EndpointSnitch MBean
* PropertyFileEndpointSnitchMBean is the management interface for Digg's EndpointSnitch MBean
*
* @author Sammy Yu <syu@sammyyu.net>
*
*/
public interface PropertyFileEndPointSnitchMBean {
public interface PropertyFileEndpointSnitchMBean {
/**
* The object name of the mbean.
*/
public static String MBEAN_OBJECT_NAME = "org.apache.cassandra.locator:type=EndPointSnitch";
public static String MBEAN_OBJECT_NAME = "org.apache.cassandra.locator:type=EndpointSnitch";
/**
* Reload the rack configuration

View File

@ -130,10 +130,10 @@
~ EndpointSnitch: Setting this to the class that implements
~ AbstractEndpointSnitch, which lets Cassandra know enough
~ about your network topology to route requests efficiently.
~ Out of the box, Cassandra provides org.apache.cassandra.locator.EndPointSnitch,
~ and PropertyFileEndPointSnitch is available in contrib/.
~ Out of the box, Cassandra provides org.apache.cassandra.locator.EndpointSnitch,
~ and PropertyFileEndpointSnitch is available in contrib/.
-->
<EndpointSnitch>org.apache.cassandra.locator.EndPointSnitch</EndpointSnitch>
<EndpointSnitch>org.apache.cassandra.locator.EndpointSnitch</EndpointSnitch>
</Keyspace>
</Keyspaces>

View File

@ -141,7 +141,7 @@ public class BootStrapper
return maxEndpoint;
}
/** get potential sources for each range, ordered by proximity (as determined by EndPointSnitch) */
/** get potential sources for each range, ordered by proximity (as determined by EndpointSnitch) */
Multimap<Range, InetAddress> getRangesWithSources(String table)
{
assert tokenMetadata.sortedTokens().size() > 0;

View File

@ -28,7 +28,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This abstraction represents both the HeartBeatState and the ApplicationState in an EndPointState
* This abstraction represents both the HeartBeatState and the ApplicationState in an EndpointState
* instance. Any state for a given endpoint can be retrieved from this instance.
*/
@ -37,7 +37,7 @@ public class EndpointState
private static ICompactSerializer<EndpointState> serializer_;
static
{
serializer_ = new EndPointStateSerializer();
serializer_ = new EndpointStateSerializer();
}
HeartBeatState hbState_;
@ -154,9 +154,9 @@ public class EndpointState
}
class EndPointStateSerializer implements ICompactSerializer<EndpointState>
class EndpointStateSerializer implements ICompactSerializer<EndpointState>
{
private static Logger logger_ = LoggerFactory.getLogger(EndPointStateSerializer.class);
private static Logger logger_ = LoggerFactory.getLogger(EndpointStateSerializer.class);
public void serialize(EndpointState epState, DataOutputStream dos) throws IOException
{
@ -177,7 +177,7 @@ class EndPointStateSerializer implements ICompactSerializer<EndpointState>
{
if ( Gossiper.MAX_GOSSIP_PACKET_SIZE - dos.size() < estimate )
{
logger_.info("@@@@ Breaking out to respect the MTU size in EndPointState serializer. Estimate is {} @@@@", estimate);;
logger_.info("@@@@ Breaking out to respect the MTU size in EndpointState serializer. Estimate is {} @@@@", estimate);;
break;
}

View File

@ -27,7 +27,7 @@ import org.apache.cassandra.net.CompactEndpointSerializationHelper;
import java.net.InetAddress;
/**
* Contains information about a specified list of EndPoints and the largest version
* Contains information about a specified list of Endpoints and the largest version
* of the state they have generated as known by the local endpoint.
*/

View File

@ -61,13 +61,13 @@ class GossipDigestAck2MessageSerializer implements ICompactSerializer<GossipDige
{
public void serialize(GossipDigestAck2Message gDigestAck2Message, DataOutputStream dos) throws IOException
{
/* Use the EndPointState */
EndPointStatesSerializationHelper.serialize(gDigestAck2Message.epStateMap_, dos);
/* Use the EndpointState */
EndpointStatesSerializationHelper.serialize(gDigestAck2Message.epStateMap_, dos);
}
public GossipDigestAck2Message deserialize(DataInputStream dis) throws IOException
{
Map<InetAddress, EndpointState> epStateMap = EndPointStatesSerializationHelper.deserialize(dis);
Map<InetAddress, EndpointState> epStateMap = EndpointStatesSerializationHelper.deserialize(dis);
return new GossipDigestAck2Message(epStateMap);
}
}

View File

@ -73,10 +73,10 @@ class GossipDigestAckMessageSerializer implements ICompactSerializer<GossipDiges
/* Use the helper to serialize the GossipDigestList */
boolean bContinue = GossipDigestSerializationHelper.serialize(gDigestAckMessage.gDigestList_, dos);
dos.writeBoolean(bContinue);
/* Use the EndPointState */
/* Use the EndpointState */
if ( bContinue )
{
EndPointStatesSerializationHelper.serialize(gDigestAckMessage.epStateMap_, dos);
EndpointStatesSerializationHelper.serialize(gDigestAckMessage.epStateMap_, dos);
}
}
@ -88,7 +88,7 @@ class GossipDigestAckMessageSerializer implements ICompactSerializer<GossipDiges
if ( bContinue )
{
epStateMap = EndPointStatesSerializationHelper.deserialize(dis);
epStateMap = EndpointStatesSerializationHelper.deserialize(dis);
}
return new GossipDigestAckMessage(gDigestList, epStateMap);
}

View File

@ -112,9 +112,9 @@ class GossipDigestSerializationHelper
}
}
class EndPointStatesSerializationHelper
class EndpointStatesSerializationHelper
{
private static final Logger logger_ = LoggerFactory.getLogger(EndPointStatesSerializationHelper.class);
private static final Logger logger_ = LoggerFactory.getLogger(EndpointStatesSerializationHelper.class);
static boolean serialize(Map<InetAddress, EndpointState> epStateMap, DataOutputStream dos) throws IOException
{
@ -151,7 +151,7 @@ class EndPointStatesSerializationHelper
{
if ( dis.available() == 0 )
{
logger_.info("Remaining bytes zero. Stopping deserialization in EndPointState.");
logger_.info("Remaining bytes zero. Stopping deserialization in EndpointState.");
break;
}
// int length = dis.readInt();

View File

@ -111,7 +111,7 @@ public class Gossiper implements IFailureDetectionEventListener, IEndpointStateC
private long FatClientTimeout_;
private Random random_ = new Random();
/* subscribers for interest in EndPointState change */
/* subscribers for interest in EndpointState change */
private List<IEndpointStateChangeSubscriber> subscribers_ = new ArrayList<IEndpointStateChangeSubscriber>();
/* live member set */
@ -143,7 +143,7 @@ public class Gossiper implements IFailureDetectionEventListener, IEndpointStateC
FailureDetector.instance.registerFailureDetectionEventListener(this);
}
/** Register with the Gossiper for EndPointState notifications */
/** Register with the Gossiper for EndpointState notifications */
public synchronized void register(IEndpointStateChangeSubscriber subscriber)
{
subscribers_.add(subscriber);
@ -577,7 +577,7 @@ public class Gossiper implements IFailureDetectionEventListener, IEndpointStateC
* immediately mark it alive.
*
* @param ep endpoint
* @param epState EndPointState for the endpoint
* @param epState EndpointState for the endpoint
* @param isKnownNode is this node familiar to us already (present in endpointStateMap)
*/
private void handleMajorStateChange(InetAddress ep, EndpointState epState, boolean isKnownNode)
@ -914,7 +914,7 @@ public class Gossiper implements IFailureDetectionEventListener, IEndpointStateC
/*
* These digests have their maxVersion set to the difference of the version
* of the local EndPointState and the version found in the GossipDigest.
* of the local EndpointState and the version found in the GossipDigest.
*/
List<GossipDigest> diffDigests = new ArrayList<GossipDigest>();
for ( GossipDigest gDigest : gDigestList )

View File

@ -27,13 +27,13 @@ public interface IEndpointStateChangePublisher
{
/**
* Register for interesting state changes.
* @param subcriber module which implements the IEndPointStateChangeSubscriber
* @param subcriber module which implements the IEndpointStateChangeSubscriber
*/
public void register(IEndpointStateChangeSubscriber subcriber);
/**
* Unregister interest for state changes.
* @param subcriber module which implements the IEndPointStateChangeSubscriber
* @param subcriber module which implements the IEndpointStateChangeSubscriber
*/
public void unregister(IEndpointStateChangeSubscriber subcriber);
}

View File

@ -21,7 +21,7 @@ package org.apache.cassandra.gms;
import java.net.InetAddress;
/**
* This is called by an instance of the IEndPointStateChangePublisher to notify
* This is called by an instance of the IEndpointStateChangePublisher to notify
* interested parties about changes in the the state associated with any endpoint.
* For instance if node A figures there is a changes in state for an endpoint B
* it notifies all interested parties of this change. It is upto to the registered

View File

@ -34,17 +34,17 @@ import org.apache.cassandra.utils.XMLUtils;
import org.xml.sax.SAXException;
/**
* DataCenterEndPointSnitch
* DataCenterEndpointSnitch
* <p/>
* This class basically reads the configuration and sets the IP Ranges to a
* hashMap which can be read later. this class also provides a way to compare 2
* EndPoints and also get details from the same.
* Endpoints and also get details from the same.
*/
public class DatacenterEndpointSnitch extends AbstractEndpointSnitch
{
/**
* This Map will contain the information of the EndPoints and its Location
* This Map will contain the information of the Endpoints and its Location
* (Datacenter and RAC)
*/
private Map<Byte, Map<Byte, String>> ipDC = new HashMap<Byte, Map<Byte, String>>();

View File

@ -38,7 +38,7 @@ import org.apache.cassandra.thrift.ConsistencyLevel;
* other Datacenter.... For example if we have 5 nodes this stategy will make
* sure to make 2 copies out of 5 in other dataceneter.
* <p/>
* This class also caches the EndPoints and invalidates the cache if there is a
* This class also caches the Endpoints and invalidates the cache if there is a
* change in the number of tokens.
*/
public class DatacenterShardStategy extends AbstractReplicationStrategy
@ -62,8 +62,8 @@ public class DatacenterShardStategy extends AbstractReplicationStrategy
}
/**
* This Method will get the required information of the EndPoint from the
* DataCenterEndPointSnitch and poopulates this singleton class.
* This Method will get the required information of the Endpoint from the
* DataCenterEndpointSnitch and poopulates this singleton class.
*/
private synchronized void loadEndpoints(TokenMetadata metadata) throws IOException
{
@ -111,7 +111,7 @@ public class DatacenterShardStategy extends AbstractReplicationStrategy
super(tokenMetadata, snitch);
if ((!(snitch instanceof DatacenterEndpointSnitch)))
{
throw new IllegalArgumentException("DatacenterShardStrategy requires DatacenterEndPointSnitch");
throw new IllegalArgumentException("DatacenterShardStrategy requires DatacenterEndpointSnitch");
}
}

View File

@ -40,7 +40,7 @@ public class RackAwareStrategy extends AbstractReplicationStrategy
{
super(tokenMetadata, snitch);
if (!(snitch instanceof EndpointSnitch))
throw new IllegalArgumentException(("RackAwareStrategy requires EndPointSnitch."));
throw new IllegalArgumentException(("RackAwareStrategy requires EndpointSnitch."));
}
public ArrayList<InetAddress> getNaturalEndpoints(Token token, TokenMetadata metadata, String table)

View File

@ -58,13 +58,13 @@
<ColumnFamily ColumnType="Super" CompareSubcolumnsWith="TimeUUIDType" Name="Super4"/>
<ReplicaPlacementStrategy>org.apache.cassandra.locator.RackUnawareStrategy</ReplicaPlacementStrategy>
<ReplicationFactor>1</ReplicationFactor>
<EndpointSnitch>org.apache.cassandra.locator.EndPointSnitch</EndpointSnitch>
<EndpointSnitch>org.apache.cassandra.locator.EndpointSnitch</EndpointSnitch>
</Keyspace>
<Keyspace Name = "Keyspace3">
<ColumnFamily Name="Standard1"/>
<ReplicaPlacementStrategy>org.apache.cassandra.locator.RackUnawareStrategy</ReplicaPlacementStrategy>
<ReplicationFactor>5</ReplicationFactor>
<EndpointSnitch>org.apache.cassandra.locator.EndPointSnitch</EndpointSnitch>
<EndpointSnitch>org.apache.cassandra.locator.EndpointSnitch</EndpointSnitch>
</Keyspace>
<Keyspace Name = "Keyspace4">
<ColumnFamily Name="Standard1"/>
@ -73,7 +73,7 @@
<ColumnFamily ColumnType="Super" CompareSubcolumnsWith="TimeUUIDType" Name="Super4"/>
<ReplicaPlacementStrategy>org.apache.cassandra.locator.RackUnawareStrategy</ReplicaPlacementStrategy>
<ReplicationFactor>3</ReplicationFactor>
<EndpointSnitch>org.apache.cassandra.locator.EndPointSnitch</EndpointSnitch>
<EndpointSnitch>org.apache.cassandra.locator.EndpointSnitch</EndpointSnitch>
</Keyspace>
</Keyspaces>
<Seeds>

View File

@ -142,7 +142,7 @@ class ThriftTester(BaseTester):
self.client.transport.close()
def define_schema(self):
keyspace1 = Cassandra.KsDef('Keyspace1', 'org.apache.cassandra.locator.RackUnawareStrategy', 1, 'org.apache.cassandra.locator.EndPointSnitch',
keyspace1 = Cassandra.KsDef('Keyspace1', 'org.apache.cassandra.locator.RackUnawareStrategy', 1, 'org.apache.cassandra.locator.EndpointSnitch',
[
Cassandra.CfDef('Keyspace1', 'Standard1'),
Cassandra.CfDef('Keyspace1', 'Standard2'),
@ -154,7 +154,7 @@ class ThriftTester(BaseTester):
Cassandra.CfDef('Keyspace1', 'Super4', column_type='Super', subcomparator_type='UTF8Type')
])
keyspace2 = Cassandra.KsDef('Keyspace2', 'org.apache.cassandra.locator.RackUnawareStrategy', 1, 'org.apache.cassandra.locator.EndPointSnitch',
keyspace2 = Cassandra.KsDef('Keyspace2', 'org.apache.cassandra.locator.RackUnawareStrategy', 1, 'org.apache.cassandra.locator.EndpointSnitch',
[
Cassandra.CfDef('Keyspace2', 'Standard1'),
Cassandra.CfDef('Keyspace2', 'Standard3'),
@ -162,12 +162,12 @@ class ThriftTester(BaseTester):
Cassandra.CfDef('Keyspace2', 'Super4', column_type='Super', subcomparator_type='TimeUUIDType'),
])
keyspace3 = Cassandra.KsDef('Keyspace3', 'org.apache.cassandra.locator.RackUnawareStrategy', 5, 'org.apache.cassandra.locator.EndPointSnitch',
keyspace3 = Cassandra.KsDef('Keyspace3', 'org.apache.cassandra.locator.RackUnawareStrategy', 5, 'org.apache.cassandra.locator.EndpointSnitch',
[
Cassandra.CfDef('Keyspace3', 'Standard1'),
])
keyspace4 = Cassandra.KsDef('Keyspace4', 'org.apache.cassandra.locator.RackUnawareStrategy', 3, 'org.apache.cassandra.locator.EndPointSnitch',
keyspace4 = Cassandra.KsDef('Keyspace4', 'org.apache.cassandra.locator.RackUnawareStrategy', 3, 'org.apache.cassandra.locator.EndpointSnitch',
[
Cassandra.CfDef('Keyspace4', 'Standard1'),
Cassandra.CfDef('Keyspace4', 'Standard3'),

View File

@ -949,7 +949,7 @@ class TestMutations(ThriftTester):
def test_system_keyspace_operations(self):
""" Test keyspace (add, drop, rename) operations """
# create
keyspace = KsDef('CreateKeyspace', 'org.apache.cassandra.locator.RackUnawareStrategy', 1, 'org.apache.cassandra.locator.EndPointSnitch',
keyspace = KsDef('CreateKeyspace', 'org.apache.cassandra.locator.RackUnawareStrategy', 1, 'org.apache.cassandra.locator.EndpointSnitch',
[
CfDef('CreateKeyspace', 'CreateKsCf')
])