use of com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl in project coprhd-controller by CoprHD.
the class DistributedQueueTest method createStatisticDistQueue.
/**
* Create a distributed queue for statistic purpose
*
* @throws Exception
*/
public DistributedQueue<Integer> createStatisticDistQueue(final int serial, final int threadsNumber) {
try {
CoordinatorClientImpl client = null;
client = (CoordinatorClientImpl) connectClient();
ItemStatisticConsumer consumer = new ItemStatisticConsumer();
consumer.setSerial(serial);
IntegerSerializer serializer = new IntegerSerializer();
DistributedQueue<Integer> queue = client.getQueue(QUEUE_NAME_4, consumer, serializer, threadsNumber);
statisticDistQueueList.add(queue);
return queue;
} catch (Exception e) {
_logger.error("Failed to create statistic distribution queue.", e);
return null;
}
}
use of com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl in project coprhd-controller by CoprHD.
the class DrUtil method isAllSyssvcUp.
/**
* Check if all syssvc is up and running for specified site
* @param siteId
* @return true if all syssvc is running
*/
public boolean isAllSyssvcUp(String siteId) {
// Get service beacons for given site - - assume syssvc on all sites share same service name in beacon
try {
String syssvcName = ((CoordinatorClientImpl) coordinator).getSysSvcName();
String syssvcVersion = ((CoordinatorClientImpl) coordinator).getSysSvcVersion();
List<Service> svcs = coordinator.locateAllServices(siteId, syssvcName, syssvcVersion, null, null);
Site site = this.getSiteFromLocalVdc(siteId);
log.info("Node count is {}, running syssvc count is", site.getNodeCount(), svcs.size());
return svcs.size() == site.getNodeCount();
} catch (CoordinatorException ex) {
return false;
}
}
use of com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl in project coprhd-controller by CoprHD.
the class TestCoordinatorService method start.
public void start() throws Exception {
zkServer = new TestingServer();
zkConnection = new ZkConnection();
zkConnection.setServer(Collections.singletonList(new URI("coordinator://localhost:" + zkServer.getPort())));
zkConnection.build();
coordinatorClient = new CoordinatorClientImpl();
coordinatorClient.setZkConnection(zkConnection);
coordinatorClient.setInetAddessLookupMap(StubCoordinatorClientImpl.createLocalAddressLookupMap());
coordinatorClient.start();
}
use of com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl in project coprhd-controller by CoprHD.
the class GeoSeedProviderImpl method initCoordinatorClient.
/**
* Construct coordinator client from argument. Seed provider instance is created by cassandra
* on demand. Not from spring context.
*
* @param args
*/
private void initCoordinatorClient(Map<String, String> args) throws IOException {
// endpoints for coordinator in local site
String coordinatorArg = args.get(COORDINATORS);
if (coordinatorArg == null || coordinatorArg.trim().isEmpty()) {
throw new IllegalArgumentException(COORDINATORS);
}
String[] coordinators = coordinatorArg.split(",", -1);
List<URI> uri = new ArrayList<URI>(coordinators.length);
for (String coord : coordinators) {
if (!coord.trim().isEmpty()) {
uri.add(URI.create(coord.trim()));
}
}
ZkConnection connection = new ZkConnection();
connection.setServer(uri);
String siteIdFile = args.get(Constants.SITE_ID_FILE);
connection.setSiteIdFile(siteIdFile);
connection.build();
CoordinatorClientImpl client = new CoordinatorClientImpl();
client.setZkConnection(connection);
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("/nodeaddrmap-var.xml");
CoordinatorClientInetAddressMap inetAddressMap = (CoordinatorClientInetAddressMap) ctx.getBean("inetAddessLookupMap");
if (inetAddressMap == null) {
log.error("CoordinatorClientInetAddressMap is not initialized. Node address lookup will fail.");
}
// HARCODE FOR NOW
client.setInetAddessLookupMap(inetAddressMap);
client.start();
coordinator = client;
}
use of com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl in project coprhd-controller by CoprHD.
the class DbSvcRunner method getCoordinator.
/**
* Get CoordinatorClient instance
*
* @return
* @throws URISyntaxException
* @throws IOException
*/
public CoordinatorClient getCoordinator() throws URISyntaxException, IOException {
if (coordinator == null) {
ZkConnection zkConn = new ZkConnection();
List<URI> uris = new ArrayList<URI>();
uris.add(new URI("coordinator://localhost:2181"));
zkConn.setServer(uris);
zkConn.setTimeoutMs(10000);
zkConn.build();
// Suppress Sonar violation of Lazy initialization of static fields should be synchronized
// Junit test will be called in single thread by default, it's safe to ignore this violation
// NOSONAR ("squid:S2444")
coordinator = new CoordinatorClientImpl();
coordinator.setZkConnection(zkConn);
coordinator.setSysSvcName("syssvc");
coordinator.setSysSvcVersion("1");
coordinator.setNodeCount(1);
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("nodeaddrmap-var.xml");
CoordinatorClientInetAddressMap inetAddressMap = (CoordinatorClientInetAddressMap) ctx.getBean("inetAddessLookupMap");
if (inetAddressMap == null) {
log.error("CoordinatorClientInetAddressMap is not initialized. Node address lookup will fail.");
}
Map<String, DualInetAddress> controlNodes = inetAddressMap.getControllerNodeIPLookupMap();
// HARCODE FOR NOW
coordinator.setInetAddessLookupMap(inetAddressMap);
DbVersionInfo dbVersionInfo = new DbVersionInfo();
dbVersionInfo.setSchemaVersion(SVC_VERSION);
coordinator.setDbVersionInfo(dbVersionInfo);
coordinator.start();
}
return coordinator;
}
Aggregations