Package com.hazelcast.mapreduce

Examples of com.hazelcast.mapreduce.JobPartitionState


    public static JobPartitionState.State stateChange(Address owner, int partitionId, JobPartitionState.State currentState,
                                                      JobProcessInformationImpl processInformation,
                                                      JobTaskConfiguration configuration) {

        JobPartitionState[] partitionStates = processInformation.getPartitionStates();
        JobPartitionState partitionState = partitionStates[partitionId];

        // If not yet assigned we don't need to check owner and state
        JobPartitionState.State finalState = null;
        if (partitionState != null) {
            if (!owner.equals(partitionState.getOwner())) {
                return null;
            }
            if (partitionState.getState() != currentState) {
                return null;
            }

            if (currentState == MAPPING) {
                finalState = stateChangeMapping(partitionId, partitionState, processInformation, owner, configuration);
View Full Code Here


    private static boolean compareAndSwapPartitionState(int partitionId, JobPartitionState oldPartitionState,
                                                        JobProcessInformationImpl processInformation, Address owner,
                                                        JobPartitionState.State newState) {

        JobPartitionState newPartitionState = new JobPartitionStateImpl(owner, newState);
        if (processInformation.updatePartitionState(partitionId, oldPartitionState, newPartitionState)) {
            return true;
        }
        return false;
    }
View Full Code Here

        return -1;
    }

    private boolean checkState(JobProcessInformation processInformation, int partitionId) {
        JobPartitionState[] partitionStates = processInformation.getPartitionStates();
        JobPartitionState partitionState = partitionStates[partitionId];
        return partitionState == null || partitionState.getState() == JobPartitionState.State.WAITING;
    }
View Full Code Here

    }

    public int assignMemberId(Address address, String memberUuid, JobTaskConfiguration configuration) {
        JobPartitionState[] partitionStates = getPartitionStates();
        for (int i = 0; i < partitionStates.length; i++) {
            JobPartitionState partitionState = partitionStates[i];
            if (partitionState == null || partitionState.getState() == JobPartitionState.State.WAITING) {

                // Seems unassigned so let try to use it
                if (stateChange(address, i, WAITING, this, configuration) != null) {
                    memberIds.put(memberUuid, i);
                    return i;
View Full Code Here

        JobProcessInformationImpl processInformation = supervisor.getJobProcessInformation();

        while (true) {
            JobPartitionState[] partitionStates = processInformation.getPartitionStates();
            JobPartitionState oldPartitionState = partitionStates[partitionId];

            if (oldPartitionState == null || !getCallerAddress().equals(oldPartitionState.getOwner())) {
                result = new RequestPartitionResult(CHECK_STATE_FAILED, partitionId);
                return;
            }

            if (processInformation.updatePartitionState(partitionId, oldPartitionState, null)) {
View Full Code Here

    public static JobPartitionState.State stateChange(Address owner, int partitionId, JobPartitionState.State currentState,
                                                      JobProcessInformationImpl processInformation,
                                                      JobTaskConfiguration configuration) {

        JobPartitionState[] partitionStates = processInformation.getPartitionStates();
        JobPartitionState partitionState = partitionStates[partitionId];

        // If not yet assigned we don't need to check owner and state
        JobPartitionState.State finalState = null;
        if (partitionState != null) {
            if (!owner.equals(partitionState.getOwner())) {
                return null;
            }
            if (partitionState.getState() != currentState) {
                return null;
            }

            if (currentState == MAPPING) {
                finalState = stateChangeMapping(partitionId, partitionState, processInformation, owner, configuration);
View Full Code Here

    private static boolean compareAndSwapPartitionState(int partitionId, JobPartitionState oldPartitionState,
                                                        JobProcessInformationImpl processInformation, Address owner,
                                                        JobPartitionState.State newState) {

        JobPartitionState newPartitionState = new JobPartitionStateImpl(owner, newState);
        if (processInformation.updatePartitionState(partitionId, oldPartitionState, newPartitionState)) {
            return true;
        }
        return false;
    }
View Full Code Here

    }

    public int assignMemberId(Address address, String memberUuid, JobTaskConfiguration configuration) {
        JobPartitionState[] partitionStates = getPartitionStates();
        for (int i = 0; i < partitionStates.length; i++) {
            JobPartitionState partitionState = partitionStates[i];
            if (partitionState == null || partitionState.getState() == JobPartitionState.State.WAITING) {

                // Seems unassigned so let try to use it
                if (stateChange(address, i, WAITING, this, configuration) != null) {
                    return i;
                }
View Full Code Here

TOP

Related Classes of com.hazelcast.mapreduce.JobPartitionState

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.