ServiceEndpointCollection Class

  • java.lang.Object
    • Serializable
      • microsoft.servicefabric.services.communication.ServiceEndpointCollection

public class ServiceEndpointCollection

This class represents the endpoints of a Reliable service. Each endpoint has a listener name and the address of that listener.

Constructor Summary

Constructor Description
ServiceEndpointCollection()

Instantiates an empty ServiceEndpointsCollection

ServiceEndpointCollection(String listenerName, String endpointAddress)

Instantiates the ServiceEndpointsCollection with a single endpoint, identified by the listener name.

Method Summary

Modifier and Type Method and Description
void addEndpoint(String listenerName, String endpointAddress)

Adds the endpoints in the input EndpointsCollection class to the EndpointsCollection.

void addEndpoints(ServiceEndpointCollection newEndpoints)

Adds the endpoints in the input EndpointsCollection class to the EndpointsCollection.

String getEndpointAddress(String listenerName)

Gets the endpoint identified by the listener name.

String getFirstEndpointAddress()

Gets the first endpoint address in the EndpointsCollection

ServiceEndpointCollection parseEndpointsString(String endpointsString)

Constructs an EndpointsCollection from a string version of the endpoints. String form of EndpointsCollection is of the form {"Endpoints":{"Listener1":"Endpoint1","Listener2":"Endpoint2" ...}}

Map<String, String> toReadOnlyHashMap()

Sets the address of the user service replica to the address of read-only hashmap.

String toString()

Converts the endpointsCollection to a JSON string of the form {"Endpoints":{"Listener1":"Endpoint1","Listener2":"Endpoint2" ...}}

Constructor Details

ServiceEndpointCollection

public ServiceEndpointCollection()

Instantiates an empty ServiceEndpointsCollection

ServiceEndpointCollection

public ServiceEndpointCollection(String listenerName, String endpointAddress)

Instantiates the ServiceEndpointsCollection with a single endpoint, identified by the listener name.

Parameters:

listenerName - Listener name of the endpoint
endpointAddress - Address of the endpoint

Method Details

addEndpoint

public void addEndpoint(String listenerName, String endpointAddress)

Adds the endpoints in the input EndpointsCollection class to the EndpointsCollection.

Parameters:

listenerName - listenerName
endpointAddress - Address of the endpoint

Throws:

FabricElementAlreadyExistsException - if fabric element already exists.

addEndpoints

public void addEndpoints(ServiceEndpointCollection newEndpoints)

Adds the endpoints in the input EndpointsCollection class to the EndpointsCollection.

Parameters:

newEndpoints - input EndpointsCollection

Throws:

FabricElementAlreadyExistsException - if fabric element already exists

getEndpointAddress

public String getEndpointAddress(String listenerName)

Gets the endpoint identified by the listener name.

Parameters:

listenerName - Listener name

Returns:

True if an endpoint with the listener name exists, False otherwise

getFirstEndpointAddress

public String getFirstEndpointAddress()

Gets the first endpoint address in the EndpointsCollection

Returns:

True if there is at-least one endpoint in the EndpointsCollection, false otherwise

parseEndpointsString

public static ServiceEndpointCollection parseEndpointsString(String endpointsString)

Constructs an EndpointsCollection from a string version of the endpoints. String form of EndpointsCollection is of the form {"Endpoints":{"Listener1":"Endpoint1","Listener2":"Endpoint2" ...}}

Parameters:

endpointsString - string form of endpointsCollection

Returns:

True if the string can be parsed to a valid EndpointsCollection, False otherwise

toReadOnlyHashMap

public Map toReadOnlyHashMap()

Sets the address of the user service replica to the address of read-only hashmap.

Returns:

Returns an unmodifiable view of the specified map.

toString

public String toString()

Converts the endpointsCollection to a JSON string of the form {"Endpoints":{"Listener1":"Endpoint1","Listener2":"Endpoint2" ...}}

Returns:

String form of the endpointsCollection

Applies to