Search in sources :

Example 1 with JavaSerializationBasedPayloadSerializerDeserializer

use of org.apache.hyracks.ipc.impl.JavaSerializationBasedPayloadSerializerDeserializer in project asterixdb by apache.

the class ClusterControllerService method start.

@Override
public void start() throws Exception {
    LOGGER.log(Level.INFO, "Starting ClusterControllerService: " + this);
    serverCtx = new ServerContext(ServerContext.ServerType.CLUSTER_CONTROLLER, new File(ccConfig.getRootDir()));
    IIPCI ccIPCI = new ClusterControllerIPCI(this);
    clusterIPC = new IPCSystem(new InetSocketAddress(ccConfig.getClusterListenPort()), ccIPCI, new CCNCFunctions.SerializerDeserializer());
    IIPCI ciIPCI = new ClientInterfaceIPCI(this);
    clientIPC = new IPCSystem(new InetSocketAddress(ccConfig.getClientListenAddress(), ccConfig.getClientListenPort()), ciIPCI, new JavaSerializationBasedPayloadSerializerDeserializer());
    webServer = new WebServer(this, ccConfig.getConsoleListenPort());
    clusterIPC.start();
    clientIPC.start();
    webServer.start();
    info = new ClusterControllerInfo(ccConfig.getClientListenAddress(), ccConfig.getClientListenPort(), webServer.getListeningPort());
    timer.schedule(sweeper, 0, ccConfig.getHeartbeatPeriod());
    jobLog.open();
    startApplication();
    datasetDirectoryService.init(executor);
    workQueue.start();
    connectNCs();
    LOGGER.log(Level.INFO, "Started ClusterControllerService");
    notifyApplication();
}
Also used : IIPCI(org.apache.hyracks.ipc.api.IIPCI) ClusterControllerInfo(org.apache.hyracks.api.client.ClusterControllerInfo) JavaSerializationBasedPayloadSerializerDeserializer(org.apache.hyracks.ipc.impl.JavaSerializationBasedPayloadSerializerDeserializer) ServerContext(org.apache.hyracks.control.common.context.ServerContext) WebServer(org.apache.hyracks.control.cc.web.WebServer) InetSocketAddress(java.net.InetSocketAddress) JavaSerializationBasedPayloadSerializerDeserializer(org.apache.hyracks.ipc.impl.JavaSerializationBasedPayloadSerializerDeserializer) LogFile(org.apache.hyracks.control.common.logs.LogFile) File(java.io.File) IPCSystem(org.apache.hyracks.ipc.impl.IPCSystem)

Example 2 with JavaSerializationBasedPayloadSerializerDeserializer

use of org.apache.hyracks.ipc.impl.JavaSerializationBasedPayloadSerializerDeserializer in project asterixdb by apache.

the class IPCTest method createServerIPCSystem.

private IPCSystem createServerIPCSystem() throws IOException {
    final Executor executor = Executors.newCachedThreadPool();
    IIPCI ipci = new IIPCI() {

        @Override
        public void deliverIncomingMessage(final IIPCHandle handle, final long mid, long rmid, final Object payload, Exception exception) {
            executor.execute(new Runnable() {

                @Override
                public void run() {
                    Object result = null;
                    Exception exception = null;
                    try {
                        Integer i = (Integer) payload;
                        result = i.intValue() * 2;
                    } catch (Exception e) {
                        exception = e;
                    }
                    try {
                        handle.send(mid, result, exception);
                    } catch (IPCException e) {
                        e.printStackTrace();
                    }
                }
            });
        }
    };
    return new IPCSystem(new InetSocketAddress("127.0.0.1", 0), ipci, new JavaSerializationBasedPayloadSerializerDeserializer());
}
Also used : IIPCHandle(org.apache.hyracks.ipc.api.IIPCHandle) IIPCI(org.apache.hyracks.ipc.api.IIPCI) Executor(java.util.concurrent.Executor) JavaSerializationBasedPayloadSerializerDeserializer(org.apache.hyracks.ipc.impl.JavaSerializationBasedPayloadSerializerDeserializer) InetSocketAddress(java.net.InetSocketAddress) IPCException(org.apache.hyracks.ipc.exceptions.IPCException) IOException(java.io.IOException) IPCException(org.apache.hyracks.ipc.exceptions.IPCException) IPCSystem(org.apache.hyracks.ipc.impl.IPCSystem)

Aggregations

InetSocketAddress (java.net.InetSocketAddress)2 IIPCI (org.apache.hyracks.ipc.api.IIPCI)2 IPCSystem (org.apache.hyracks.ipc.impl.IPCSystem)2 JavaSerializationBasedPayloadSerializerDeserializer (org.apache.hyracks.ipc.impl.JavaSerializationBasedPayloadSerializerDeserializer)2 File (java.io.File)1 IOException (java.io.IOException)1 Executor (java.util.concurrent.Executor)1 ClusterControllerInfo (org.apache.hyracks.api.client.ClusterControllerInfo)1 WebServer (org.apache.hyracks.control.cc.web.WebServer)1 ServerContext (org.apache.hyracks.control.common.context.ServerContext)1 LogFile (org.apache.hyracks.control.common.logs.LogFile)1 IIPCHandle (org.apache.hyracks.ipc.api.IIPCHandle)1 IPCException (org.apache.hyracks.ipc.exceptions.IPCException)1