Package com.hazelcast.queue

Examples of com.hazelcast.queue.QueueService


    public RemoveListenerRequest(String name, String registrationId) {
        super(name, registrationId);
    }

    public Object call() throws Exception {
        final QueueService service = getService();
        return service.removeItemListener(name, registrationId);
    }
View Full Code Here


    }

    public Object call() throws Exception {
        final ClientEndpoint endpoint = getEndpoint();
        final ClientEngine clientEngine = getClientEngine();
        final QueueService service = getService();

        ItemListener listener = new ItemListener() {
            public void itemAdded(ItemEvent item) {
                send(item);
            }

            public void itemRemoved(ItemEvent item) {
                send(item);
            }

            private void send(ItemEvent event){
                if (endpoint.live()){
                    Data item = clientEngine.toData(event.getItem());
                    PortableItemEvent portableItemEvent = new PortableItemEvent(item, event.getEventType(), event.getMember().getUuid());
                    endpoint.sendEvent(portableItemEvent, getCallId());
                }
            }
        };
        String registrationId = service.addItemListener(name, listener, includeValue);
        endpoint.setListenerRegistration(QueueService.SERVICE_NAME, name, registrationId);
        return registrationId;
    }
View Full Code Here

    public void read(PortableReader reader) throws IOException {
        name = reader.readUTF("n");
    }

    public Object call() throws Exception {
        QueueService service = getService();
        QueueContainer container = service.getOrCreateContainer(name, false);
        return container.getConfig().getMaxSize() - container.size();
    }
View Full Code Here

        if (servicesConfig != null) {
            if (servicesConfig.isEnableDefaults()) {
                logger.finest( "Registering default services...");
                registerService(MapService.SERVICE_NAME, new MapService(nodeEngine));
                registerService(LockService.SERVICE_NAME, new LockServiceImpl(nodeEngine));
                registerService(QueueService.SERVICE_NAME, new QueueService(nodeEngine));
                registerService(TopicService.SERVICE_NAME, new TopicService());
                registerService(MultiMapService.SERVICE_NAME, new MultiMapService(nodeEngine));
                registerService(ListService.SERVICE_NAME, new ListService(nodeEngine));
                registerService(SetService.SERVICE_NAME, new SetService(nodeEngine));
                registerService(DistributedExecutorService.SERVICE_NAME, new DistributedExecutorService());
View Full Code Here

        }

        logger.finest("Registering default services...");
        registerService(MapService.SERVICE_NAME, MapService.create(nodeEngine));
        registerService(LockService.SERVICE_NAME, new LockServiceImpl(nodeEngine));
        registerService(QueueService.SERVICE_NAME, new QueueService(nodeEngine));
        registerService(TopicService.SERVICE_NAME, new TopicService());
        registerService(MultiMapService.SERVICE_NAME, new MultiMapService(nodeEngine));
        registerService(ListService.SERVICE_NAME, new ListService(nodeEngine));
        registerService(SetService.SERVICE_NAME, new SetService(nodeEngine));
        registerService(DistributedExecutorService.SERVICE_NAME, new DistributedExecutorService());
View Full Code Here

        name = reader.readUTF("n");
    }

    @Override
    public Object call() throws Exception {
        QueueService service = getService();
        QueueContainer container = service.getOrCreateContainer(name, false);
        return container.getConfig().getMaxSize() - container.size();
    }
View Full Code Here

        super(name, registrationId);
    }

    @Override
    public Object call() throws Exception {
        final QueueService service = getService();
        return service.removeItemListener(name, registrationId);
    }
View Full Code Here

    }

    @Override
    public Object call() throws Exception {
        final ClientEndpoint endpoint = getEndpoint();
        final QueueService service = getService();

        ItemListener listener = new ItemListener() {
            @Override
            public void itemAdded(ItemEvent item) {
                send(item);
            }

            @Override
            public void itemRemoved(ItemEvent item) {
                send(item);
            }

            private void send(ItemEvent event) {
                if (endpoint.live()) {
                    Data item = serializationService.toData(event.getItem());
                    PortableItemEvent portableItemEvent = new PortableItemEvent(
                            item, event.getEventType(), event.getMember().getUuid());
                    endpoint.sendEvent(portableItemEvent, getCallId());
                }
            }
        };
        String registrationId = service.addItemListener(name, listener, includeValue);
        endpoint.setListenerRegistration(QueueService.SERVICE_NAME, name, registrationId);
        return registrationId;
    }
View Full Code Here

TOP

Related Classes of com.hazelcast.queue.QueueService

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.