Package org.apache.karaf.cellar.core.event

Examples of org.apache.karaf.cellar.core.event.EventConsumer


                group.getNodes().remove(local);
                listGroups().put(groupName, group);
            }
            // shutdown the group consumer/producers
            for (Map.Entry<String, EventConsumer> consumerEntry : groupConsumer.entrySet()) {
                EventConsumer consumer = consumerEntry.getValue();
                consumer.stop();
            }
            groupConsumer.clear();
            groupProducers.clear();
        } finally {
            Thread.currentThread().setContextClassLoader(originalClassLoader);
View Full Code Here


                ServiceRegistration producerRegistration = bundleContext.registerService(EventProducer.class.getCanonicalName(), producer, (Dictionary) serviceProperties);
                producerRegistrations.put(groupName, producerRegistration);
            }

            if (!consumerRegistrations.containsKey(groupName)) {
                EventConsumer consumer = groupConsumer.get(groupName);
                if (consumer == null) {
                    consumer = eventTransportFactory.getEventConsumer(groupName, true);
                    groupConsumer.put(groupName, consumer);
                } else if (!consumer.isConsuming()) {
                    consumer.start();
                }
                ServiceRegistration consumerRegistration = bundleContext.registerService(EventConsumer.class.getCanonicalName(), consumer, (Dictionary) serviceProperties);
                consumerRegistrations.put(groupName, consumerRegistration);
            }
View Full Code Here

                }
            }

            // remove consumers & producers
            groupProducers.remove(groupName);
            EventConsumer consumer = groupConsumer.remove(groupName);
            if (consumer != null) {
                consumer.stop();
            }

            // remove group from configuration
            try {
                Configuration configuration = configurationAdmin.getConfiguration(Configurations.NODE);
View Full Code Here

    private void unImportService(EndpointDescription endpoint) {
        ServiceRegistration registration = registrations.get(endpoint);
        registration.unregister();

        producers.remove(endpoint.getId());
        EventConsumer consumer = consumers.remove(endpoint.getId());
        if (consumer != null) {
            consumer.stop();
        }
    }
View Full Code Here

    }

    public void destroy() {
        bundleContext.removeServiceListener(this);
        for (Map.Entry<String, EventConsumer> consumerEntry : consumers.entrySet()) {
            EventConsumer consumer = consumerEntry.getValue();
            consumer.stop();
        }
        consumers.clear();
    }
View Full Code Here

                    }

                    remoteEndpoints.put(endpointId, endpoint);

                    // register the endpoint consumer
                    EventConsumer consumer = consumers.get(endpointId);
                    if (consumer == null) {
                        consumer = eventTransportFactory.getEventConsumer(Constants.INTERFACE_PREFIX + Constants.SEPARATOR + endpointId, false);
                        consumers.put(endpointId, consumer);
                    } else if (!consumer.isConsuming()) {
                        consumer.start();
                    }
                }
            }
        } finally {
            Thread.currentThread().setContextClassLoader(originalClassLoader);
View Full Code Here

                    // if the endpoint is used for export from other nodes too, then put it back.
                    if (endpointDescription.getNodes().size() > 0) {
                        remoteEndpoints.put(endpointId, endpointDescription);
                    }

                    EventConsumer eventConsumer = consumers.remove(endpointId);
                    eventConsumer.stop();
                }
            }
        } finally {
            Thread.currentThread().setContextClassLoader(originalClassLoader);
        }
View Full Code Here

        for (Map.Entry<EndpointDescription, ServiceRegistration> entry : registrations.entrySet()) {
            ServiceRegistration registration = entry.getValue();
            registration.unregister();
        }
        for (Map.Entry<String, EventConsumer> consumerEntry : consumers.entrySet()) {
            EventConsumer consumer = consumerEntry.getValue();
            consumer.stop();
        }
        consumers.clear();
        producers.clear();
    }
View Full Code Here

        if (requestProducer == null) {
            requestProducer = eventTransportFactory.getEventProducer(Constants.INTERFACE_PREFIX + Constants.SEPARATOR + endpoint.getId(), Boolean.FALSE);
            producers.put(endpoint.getId(), requestProducer);
        }

        EventConsumer resultConsumer = consumers.get(endpoint.getId());
        if (resultConsumer == null) {
            resultConsumer = eventTransportFactory.getEventConsumer(Constants.RESULT_PREFIX + Constants.SEPARATOR + clusterManager.getNode().getId() + endpoint.getId(), Boolean.FALSE);
            consumers.put(endpoint.getId(), resultConsumer);
        } else if (!resultConsumer.isConsuming()) {
            resultConsumer.start();
        }

        producers.put(endpoint.getId(), requestProducer);
        consumers.put(endpoint.getId(), resultConsumer);
View Full Code Here

        for (Map.Entry<EndpointDescription, ServiceRegistration> entry : registrations.entrySet()) {
            ServiceRegistration registration = entry.getValue();
            registration.unregister();
        }
        for (Map.Entry<String, EventConsumer> consumerEntry : consumers.entrySet()) {
            EventConsumer consumer = consumerEntry.getValue();
            consumer.stop();
        }
        consumers.clear();
        producers.clear();
    }
View Full Code Here

TOP

Related Classes of org.apache.karaf.cellar.core.event.EventConsumer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.