Package org.jboss.gravia.runtime

Examples of org.jboss.gravia.runtime.ServiceListener


    }

    private void assertDisableComponent(final ModuleContext ctxA, ServiceA srvA) throws InterruptedException {

        final CountDownLatch latch = new CountDownLatch(1);
        ServiceListener listener = new ServiceListener() {
            @Override
            public void serviceChanged(ServiceEvent event) {
                int type = event.getType();
                ServiceReference<?> sref = event.getServiceReference();
                List<String> clazzes = Arrays.asList(((String[]) sref.getProperty(Constants.OBJECTCLASS)));
View Full Code Here


    }

    private void assertDisableComponent(final ModuleContext ctxA, ServiceA srvA) throws InterruptedException {

        final CountDownLatch latch = new CountDownLatch(1);
        ServiceListener listener = new ServiceListener() {
            @Override
            public void serviceChanged(ServiceEvent event) {
                int type = event.getType();
                ServiceReference<?> sref = event.getServiceReference();
                List<String> clazzes = Arrays.asList(((String[]) sref.getProperty(Constants.OBJECTCLASS)));
View Full Code Here

    @Override
    public void start(final ModuleContext context) throws Exception {

        // Add a listener that tracks {@link Resolver} and {@link Repository}
        ServiceListener listener = new ServiceListener() {

            @Override
            @SuppressWarnings("unchecked")
            public void serviceChanged(ServiceEvent event) {
                if (event.getType() == ServiceEvent.REGISTERED) {
View Full Code Here

                        continue;
                }

                try {
                    String filterstr = info.getFilter();
                    ServiceListener listener = listenerReg.getListener();
                    if (listenerReg.isAllServiceListener() || listenerReg.filter.match(reference)) {
                        listener.serviceChanged(event);
                    }

                    // The MODIFIED_ENDMATCH event is synchronously delivered after the service properties have been modified.
                    // This event is only delivered to listeners which were added with a non-null filter where
                    // the filter matched the service properties prior to the modification but the filter does
                    // not match the modified service properties.
                    else if (filterstr != null && ServiceEvent.MODIFIED == event.getType()) {
                        Filter filter = listenerReg.filter;
                        if (/* filter.match(reference.getPreviousProperties()) && */ !filter.match(reference)) {
                            ServiceEvent endmatch = new ServiceEventImpl(ServiceEvent.MODIFIED_ENDMATCH, reference);
                            listener.serviceChanged(endmatch);
                        }
                    }
                } catch (Throwable th) {
                    LOGGER.warn("Error while firing service event " + typeName + " for: " + reference, th);
                }
View Full Code Here

                        continue;
                }

                try {
                    String filterstr = info.getFilter();
                    ServiceListener listener = listenerReg.getListener();
                    if (listenerReg.isAllServiceListener() || listenerReg.filter.match(reference)) {
                        listener.serviceChanged(event);
                    }

                    // The MODIFIED_ENDMATCH event is synchronously delivered after the service properties have been modified.
                    // This event is only delivered to listeners which were added with a non-null filter where
                    // the filter matched the service properties prior to the modification but the filter does
                    // not match the modified service properties.
                    else if (filterstr != null && ServiceEvent.MODIFIED == event.getType()) {
                        Filter filter = listenerReg.filter;
                        if (/* filter.match(reference.getPreviousProperties()) && */ !filter.match(reference)) {
                            ServiceEvent endmatch = new ServiceEventImpl(ServiceEvent.MODIFIED_ENDMATCH, reference);
                            listener.serviceChanged(endmatch);
                        }
                    }
                } catch (Throwable th) {
                    LOGGER.warn("Error while firing service event " + typeName + " for: " + reference, th);
                }
View Full Code Here

    }

    private void assertDisableComponent(final ModuleContext ctxA, ServiceA srvA) throws InterruptedException {

        final CountDownLatch latch = new CountDownLatch(1);
        ServiceListener listener = new ServiceListener() {
            @Override
            public void serviceChanged(ServiceEvent event) {
                int type = event.getType();
                ServiceReference<?> sref = event.getServiceReference();
                List<String> clazzes = Arrays.asList(((String[]) sref.getProperty(Constants.OBJECTCLASS)));
View Full Code Here

        initConfigurationAdmin(runtime);

        // Start listening on the {@link ZooKeeperClusterBootstrap}
        final CountDownLatch latch = new CountDownLatch(1);
        final ModuleContext syscontext = injectedModuleContext.getValue();
        ServiceListener listener = new ServiceListener() {
            @Override
            public void serviceChanged(ServiceEvent event) {
                if (event.getType() == ServiceEvent.REGISTERED) {
                    ServiceReference<?> sref = event.getServiceReference();
                    bootstrapService = (ZooKeeperClusterBootstrap) syscontext.getService(sref);
View Full Code Here

        runtime.init();

        // Start listening on the {@link BootstrapComplete}
        final ModuleContext syscontext = runtime.getModuleContext();
        final BoostrapLatch latch = new BoostrapLatch(1);
        ServiceListener listener = new ServiceListener() {
            @Override
            public void serviceChanged(ServiceEvent event) {
                if (event.getType() == ServiceEvent.REGISTERED) {
                    syscontext.removeServiceListener(this);
                    latch.countDown();
View Full Code Here

        // Start listening on the {@link BootstrapComplete} service
        final Runtime runtime = RuntimeLocator.getRequiredRuntime();
        final ModuleContext syscontext = runtime.getModuleContext();
        final CountDownLatch latch = new CountDownLatch(1);
        ServiceListener listener = new ServiceListener() {
            @Override
            public void serviceChanged(ServiceEvent event) {
                if (event.getType() == ServiceEvent.REGISTERED) {
                    syscontext.removeServiceListener(this);
                    latch.countDown();
View Full Code Here

                        continue;
                }

                try {
                    String filterstr = info.getFilter();
                    ServiceListener listener = listenerReg.getListener();
                    if (listenerReg.isAllServiceListener() || listenerReg.filter.match(reference)) {
                        listener.serviceChanged(event);
                    }

                    // The MODIFIED_ENDMATCH event is synchronously delivered after the service properties have been modified.
                    // This event is only delivered to listeners which were added with a non-null filter where
                    // the filter matched the service properties prior to the modification but the filter does
                    // not match the modified service properties.
                    else if (filterstr != null && ServiceEvent.MODIFIED == event.getType()) {
                        Filter filter = listenerReg.filter;
                        if (/* filter.match(reference.getPreviousProperties()) && */ !filter.match(reference)) {
                            ServiceEvent endmatch = new ServiceEventImpl(ServiceEvent.MODIFIED_ENDMATCH, reference);
                            listener.serviceChanged(endmatch);
                        }
                    }
                } catch (Throwable th) {
                    LOGGER.warn("Error while firing service event " + typeName + " for: " + reference, th);
                }
View Full Code Here

TOP

Related Classes of org.jboss.gravia.runtime.ServiceListener

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.