Package com.hazelcast.executor.client

Source Code of com.hazelcast.executor.client.ShutdownRequest

package com.hazelcast.executor.client;

import com.hazelcast.client.CallableClientRequest;
import com.hazelcast.executor.DistributedExecutorService;
import com.hazelcast.executor.ExecutorPortableHook;
import com.hazelcast.nio.serialization.PortableReader;
import com.hazelcast.nio.serialization.PortableWriter;

import java.io.IOException;
import java.security.Permission;

public class ShutdownRequest extends CallableClientRequest {

    private String name;

    public ShutdownRequest() {
    }

    public ShutdownRequest(String name) {
        this.name = name;
    }

    @Override
    public Object call() throws Exception {
        final DistributedExecutorService service = getService();
        service.shutdownExecutor(name);
        return true;
    }

    @Override
    public String getServiceName() {
        return DistributedExecutorService.SERVICE_NAME;
    }

    @Override
    public int getFactoryId() {
        return ExecutorPortableHook.F_ID;
    }

    @Override
    public int getClassId() {
        return ExecutorPortableHook.SHUTDOWN_REQUEST;
    }

    @Override
    public void write(PortableWriter writer) throws IOException {
        writer.writeUTF("n", name);
    }

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

    @Override
    public Permission getRequiredPermission() {
        return null;
    }
}
TOP

Related Classes of com.hazelcast.executor.client.ShutdownRequest

TOP
Copyright © 2018 www.massapi.com. 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.