All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fasterxml.clustermate.client.operation.GetOperationResult Maven / Gradle / Ivy

There is a newer version: 0.10.5
Show newest version
package com.fasterxml.clustermate.client.operation;

import com.fasterxml.clustermate.client.ClusterServerNode;
import com.fasterxml.clustermate.client.call.GetContentProcessor;

/**
 * {@link OperationResult} subtype used with GET operations, adds actual
 * result (of type T which is type of {@link GetContentProcessor}
 * passed to call).
 * 
 * @param  Result type of {@link GetContentProcessor}
 */
public class GetOperationResult extends ReadOperationResult>
{
    /**
     * Actual contents successfully fetched, if any.
     */
    protected T _contents;

    public GetOperationResult(OperationConfig config) {
        super(config);
    }

    public GetOperationResult setContents(ClusterServerNode server, T contents)
    {
        if (server == null) {
            throw new IllegalArgumentException("Should not set null server");
        }
        if (_server != null) {
            throw new IllegalStateException("Already received successful response from "+_server+"; trying to override with "+server);
        }
        _server = server;
        _contents = contents;
        return this;
    }
    
    // // // Extended API

    public T getContents() { return _contents; }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy