Search in sources :

Example 1 with DistributedQueueItemProcessedCallback

use of com.emc.storageos.coordinator.client.service.DistributedQueueItemProcessedCallback in project coprhd-controller by CoprHD.

the class BlockMonitoringImpl method stopMonitoringStaleSystem.

/**
 * 1.Find stale SMIS Provider from DB
 * 2. Un-subscribe cimconnection to avoid indications.
 * 3. Remove stale smisprovider URI from local CACHE
 */
@Override
public void stopMonitoringStaleSystem() {
    _logger.debug("Entering {}", Thread.currentThread().getStackTrace()[1].getMethodName());
    Iterator<Map.Entry<String, DistributedQueueItemProcessedCallback>> iter = SMIS_PROVIDERS_CACHE.entrySet().iterator();
    StorageProvider smisprovider = null;
    while (iter.hasNext()) {
        Map.Entry<String, DistributedQueueItemProcessedCallback> entry = iter.next();
        String smisProvoiderURI = entry.getKey();
        _logger.debug("smisProvoiderURI :{}", smisProvoiderURI);
        try {
            smisprovider = _dbClient.queryObject(StorageProvider.class, URI.create(smisProvoiderURI));
        } catch (final DatabaseException e) {
            _logger.error(e.getMessage(), e);
        }
        if (null == smisprovider || smisprovider.getInactive()) {
            _logger.info("Stale SMIS Provider {} has been removed from monitoring", smisProvoiderURI);
            _connectionFactory.unsubscribeSMIProviderConnection(smisProvoiderURI);
            try {
                // Removes monitorinJob token from queue
                entry.getValue().itemProcessed();
            } catch (Exception e) {
                _logger.error("Exception occurred while removing monitoringJob token from ZooKeeper queue", e);
            } finally {
                // Removes from CACHE
                iter.remove();
                ACTIVE_SMIS_PROVIDERS_CACHE.remove(smisProvoiderURI);
            }
        }
    }
    _logger.debug("Exiting {}", Thread.currentThread().getStackTrace()[1].getMethodName());
}
Also used : DistributedQueueItemProcessedCallback(com.emc.storageos.coordinator.client.service.DistributedQueueItemProcessedCallback) StorageProvider(com.emc.storageos.db.client.model.StorageProvider) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Map(java.util.Map) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) IOException(java.io.IOException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException)

Example 2 with DistributedQueueItemProcessedCallback

use of com.emc.storageos.coordinator.client.service.DistributedQueueItemProcessedCallback in project coprhd-controller by CoprHD.

the class IsilonMonitoringImpl method stopMonitoringStaleSystem.

@Override
public void stopMonitoringStaleSystem() {
    _logger.debug("Entering {}", Thread.currentThread().getStackTrace()[1].getMethodName());
    Iterator<Map.Entry<MonitoredDevice, DistributedQueueItemProcessedCallback>> iter = ISILON_CACHE.entrySet().iterator();
    StorageSystem storageDeviceFromDB = null;
    while (iter.hasNext()) {
        Map.Entry<MonitoredDevice, DistributedQueueItemProcessedCallback> entry = iter.next();
        MonitoredDevice monitoredDevice = entry.getKey();
        URI isilonDeviceURI = monitoredDevice._storageSystemURI;
        _logger.debug("storageDeviceURI :{}", isilonDeviceURI);
        try {
            storageDeviceFromDB = _dbClient.queryObject(StorageSystem.class, isilonDeviceURI);
        } catch (DatabaseException e) {
            _logger.error(e.getMessage(), e);
        }
        if (null == storageDeviceFromDB || storageDeviceFromDB.getInactive()) {
            _logger.info("Stale isilon {} has been removed from monitoring", isilonDeviceURI);
            try {
                // Removes monitorinJob token from queue
                entry.getValue().itemProcessed();
            } catch (Exception e) {
                _logger.error("Exception occurred while removing monitoringJob token from ZooKeeper queue", e);
            } finally {
                // Removes item from CACHE
                iter.remove();
            }
        }
    }
    _logger.debug("Exiting {}", Thread.currentThread().getStackTrace()[1].getMethodName());
}
Also used : DistributedQueueItemProcessedCallback(com.emc.storageos.coordinator.client.service.DistributedQueueItemProcessedCallback) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Map(java.util.Map) URI(java.net.URI) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException) IsilonException(com.emc.storageos.isilon.restapi.IsilonException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 3 with DistributedQueueItemProcessedCallback

use of com.emc.storageos.coordinator.client.service.DistributedQueueItemProcessedCallback in project coprhd-controller by CoprHD.

the class VNXFileMonitoringImpl method stopMonitoringStaleSystem.

/**
 * 1. Find stale vnxFile devices.
 * 2. UNsubscribe existing subscription to avoid indications for the stale vnx devices.
 * 3. Clear stale devices from zoo keeper queue and local CACHE.
 */
@Override
public void stopMonitoringStaleSystem() {
    _logger.debug("Entering {}", Thread.currentThread().getStackTrace()[1].getMethodName());
    Iterator<Map.Entry<String, DistributedQueueItemProcessedCallback>> iter = VNXFILE_CACHE.entrySet().iterator();
    StorageSystem storageDevice = null;
    while (iter.hasNext()) {
        Map.Entry<String, DistributedQueueItemProcessedCallback> entry = iter.next();
        String storageDeviceURI = entry.getKey();
        _logger.debug("storageDeviceURI :{}", storageDeviceURI);
        try {
            storageDevice = _dbClient.queryObject(StorageSystem.class, URI.create(storageDeviceURI));
        } catch (DatabaseException e) {
            _logger.error(e.getMessage(), e);
        }
        if (null == storageDevice || storageDevice.getInactive() || !isSMISProviderConnected(storageDeviceURI)) {
            _logger.info("Stale vnxfiler {} has been removed from monitoring", storageDeviceURI);
            _connectionFactory.unsubscribeSMIProviderConnection(storageDeviceURI);
            try {
                // Removes monitorinJob token from queue
                entry.getValue().itemProcessed();
            } catch (Exception e) {
                _logger.error("Exception occurred while removing monitoringJob token from ZooKeeper queue", e);
            } finally {
                // Removes from local CACHE
                iter.remove();
                FAILED_VNXFILE_SUBSCRIPTION.remove(storageDeviceURI);
            }
        }
    }
    _logger.debug("Exiting {}", Thread.currentThread().getStackTrace()[1].getMethodName());
}
Also used : DistributedQueueItemProcessedCallback(com.emc.storageos.coordinator.client.service.DistributedQueueItemProcessedCallback) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Map(java.util.Map) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) IOException(java.io.IOException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) ConnectionManagerException(com.emc.storageos.cimadapter.connections.ConnectionManagerException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

DistributedQueueItemProcessedCallback (com.emc.storageos.coordinator.client.service.DistributedQueueItemProcessedCallback)3 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)3 IOException (java.io.IOException)3 Map (java.util.Map)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)2 ConnectionManagerException (com.emc.storageos.cimadapter.connections.ConnectionManagerException)1 StorageProvider (com.emc.storageos.db.client.model.StorageProvider)1 IsilonException (com.emc.storageos.isilon.restapi.IsilonException)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1