Search in sources :

Example 1 with Info

use of io.s4.client.ClientStub.Info in project core by s4.

the class Handshake method clientInit.

private void clientInit(ByteArrayIOChannel io) throws IOException {
    String uuid = UUID.randomUUID().toString();
    Info proto = clientStub.getProtocolInfo();
    HashMap<String, Object> info = new HashMap<String, Object>();
    info.put("uuid", uuid);
    info.put("protocol", proto);
    String response = gson.toJson(info) + "\n";
    io.send(response.getBytes());
}
Also used : HashMap(java.util.HashMap) JSONObject(org.json.JSONObject) Info(io.s4.client.ClientStub.Info)

Example 2 with Info

use of io.s4.client.ClientStub.Info in project core by s4.

the class Response method partition.

public List<CompoundKeyInfo> partition(int partCount) {
    // partition id is available from the request info object
    int p = this.getRInfo().getPartition();
    List<CompoundKeyInfo> partitionInfoList = null;
    if (p >= 0 && p < partCount) {
        CompoundKeyInfo partitionInfo = new CompoundKeyInfo();
        partitionInfo.setPartitionId(p);
        partitionInfoList = new ArrayList<CompoundKeyInfo>();
        partitionInfoList.add(partitionInfo);
    }
    return partitionInfoList;
}
Also used : CompoundKeyInfo(io.s4.dispatcher.partitioner.CompoundKeyInfo)

Aggregations

Info (io.s4.client.ClientStub.Info)1 CompoundKeyInfo (io.s4.dispatcher.partitioner.CompoundKeyInfo)1 HashMap (java.util.HashMap)1 JSONObject (org.json.JSONObject)1