Search in sources :

Example 1 with NioSocketService

use of voldemort.server.niosocket.NioSocketService in project voldemort by voldemort.

the class VoldemortServer method createOnlineServices.

public void createOnlineServices() {
    onlineServices = Lists.newArrayList();
    if (voldemortConfig.isHttpServerEnabled()) {
        /*
             * TODO: Get rid of HTTP Service.
             */
        HttpService httpService = new HttpService(this, storageService, storeRepository, RequestFormatType.VOLDEMORT_V1, voldemortConfig.getMaxThreads(), identityNode.getHttpPort());
        onlineServices.add(httpService);
    }
    if (voldemortConfig.isRestServiceEnabled()) {
        RestService restService = new RestService(voldemortConfig, identityNode.getRestPort(), storeRepository, identityNode.getZoneId(), metadata.getStoreDefList());
        onlineServices.add(restService);
    }
    if (voldemortConfig.isSocketServerEnabled()) {
        RequestHandlerFactory clientRequestHandlerFactory = new ClientRequestHandlerFactory(this.storeRepository);
        if (voldemortConfig.getUseNioConnector()) {
            logger.info("Using NIO Connector.");
            NioSocketService nioSocketService = new NioSocketService(clientRequestHandlerFactory, identityNode.getSocketPort(), voldemortConfig.getSocketBufferSize(), voldemortConfig.isNioConnectorKeepAlive(), voldemortConfig.getNioConnectorSelectors(), "nio-socket-server", voldemortConfig.isJmxEnabled(), voldemortConfig.getNioAcceptorBacklog(), voldemortConfig.getNioSelectorMaxHeartBeatTimeMs());
            onlineServices.add(nioSocketService);
        } else {
            logger.info("Using BIO Connector.");
            SocketService socketService = new SocketService(clientRequestHandlerFactory, identityNode.getSocketPort(), voldemortConfig.getCoreThreads(), voldemortConfig.getMaxThreads(), voldemortConfig.getSocketBufferSize(), "socket-server", voldemortConfig.isJmxEnabled());
            onlineServices.add(socketService);
        }
    }
}
Also used : HttpService(voldemort.server.http.HttpService) ClientRequestHandlerFactory(voldemort.server.protocol.ClientRequestHandlerFactory) SocketRequestHandlerFactory(voldemort.server.protocol.SocketRequestHandlerFactory) ClientRequestHandlerFactory(voldemort.server.protocol.ClientRequestHandlerFactory) RequestHandlerFactory(voldemort.server.protocol.RequestHandlerFactory) NioSocketService(voldemort.server.niosocket.NioSocketService) NioSocketService(voldemort.server.niosocket.NioSocketService) SocketService(voldemort.server.socket.SocketService) RestService(voldemort.rest.server.RestService)

Example 2 with NioSocketService

use of voldemort.server.niosocket.NioSocketService in project voldemort by voldemort.

the class VoldemortServer method createBasicServices.

private List<VoldemortService> createBasicServices() {
    /* Services are given in the order they must be started */
    List<VoldemortService> services = new ArrayList<VoldemortService>();
    SchedulerService scheduler = new SchedulerService(voldemortConfig.getSchedulerThreads(), SystemTime.INSTANCE, voldemortConfig.canInterruptService());
    storageService = new StorageService(storeRepository, metadata, scheduler, voldemortConfig);
    asyncService = new AsyncOperationService(scheduler, ASYNC_REQUEST_CACHE_SIZE);
    jmxService = null;
    services.add(storageService);
    services.add(scheduler);
    services.add(asyncService);
    if (voldemortConfig.isAdminServerEnabled()) {
        Rebalancer rebalancer = null;
        if (voldemortConfig.isEnableRebalanceService()) {
            RebalancerService rebalancerService = new RebalancerService(storeRepository, metadata, voldemortConfig, asyncService, scheduler);
            services.add(rebalancerService);
            rebalancer = rebalancerService.getRebalancer();
        }
        SocketRequestHandlerFactory adminRequestHandlerFactory = new SocketRequestHandlerFactory(storageService, this.storeRepository, this.metadata, this.voldemortConfig, this.asyncService, scheduler, rebalancer, this);
        if (voldemortConfig.getUseNioConnector()) {
            logger.info("Using NIO Connector for Admin Service.");
            services.add(new NioSocketService(adminRequestHandlerFactory, identityNode.getAdminPort(), voldemortConfig.getAdminSocketBufferSize(), voldemortConfig.isNioAdminConnectorKeepAlive(), voldemortConfig.getNioAdminConnectorSelectors(), "admin-server", voldemortConfig.isJmxEnabled(), voldemortConfig.getNioAcceptorBacklog(), voldemortConfig.getNioSelectorMaxHeartBeatTimeMs()));
        } else {
            logger.info("Using BIO Connector for Admin Service.");
            services.add(new SocketService(adminRequestHandlerFactory, identityNode.getAdminPort(), voldemortConfig.getAdminCoreThreads(), voldemortConfig.getAdminMaxThreads(), voldemortConfig.getAdminSocketBufferSize(), "admin-server", voldemortConfig.isJmxEnabled()));
        }
    }
    if (voldemortConfig.isGossipEnabled()) {
        services.add(new GossipService(this.metadata, scheduler, voldemortConfig));
    }
    if (voldemortConfig.isJmxEnabled()) {
        jmxService = new JmxService(this, this.metadata.getCluster(), storeRepository, services);
        services.add(jmxService);
    }
    return ImmutableList.copyOf(services);
}
Also used : SchedulerService(voldemort.common.service.SchedulerService) Rebalancer(voldemort.server.rebalance.Rebalancer) JmxService(voldemort.server.jmx.JmxService) ArrayList(java.util.ArrayList) NioSocketService(voldemort.server.niosocket.NioSocketService) NioSocketService(voldemort.server.niosocket.NioSocketService) SocketService(voldemort.server.socket.SocketService) AsyncOperationService(voldemort.server.protocol.admin.AsyncOperationService) RebalancerService(voldemort.server.rebalance.RebalancerService) StorageService(voldemort.server.storage.StorageService) GossipService(voldemort.server.gossip.GossipService) VoldemortService(voldemort.common.service.VoldemortService) SocketRequestHandlerFactory(voldemort.server.protocol.SocketRequestHandlerFactory)

Aggregations

NioSocketService (voldemort.server.niosocket.NioSocketService)2 SocketRequestHandlerFactory (voldemort.server.protocol.SocketRequestHandlerFactory)2 SocketService (voldemort.server.socket.SocketService)2 ArrayList (java.util.ArrayList)1 SchedulerService (voldemort.common.service.SchedulerService)1 VoldemortService (voldemort.common.service.VoldemortService)1 RestService (voldemort.rest.server.RestService)1 GossipService (voldemort.server.gossip.GossipService)1 HttpService (voldemort.server.http.HttpService)1 JmxService (voldemort.server.jmx.JmxService)1 ClientRequestHandlerFactory (voldemort.server.protocol.ClientRequestHandlerFactory)1 RequestHandlerFactory (voldemort.server.protocol.RequestHandlerFactory)1 AsyncOperationService (voldemort.server.protocol.admin.AsyncOperationService)1 Rebalancer (voldemort.server.rebalance.Rebalancer)1 RebalancerService (voldemort.server.rebalance.RebalancerService)1 StorageService (voldemort.server.storage.StorageService)1