Search in sources :

Example 1 with ClientToTaskMessage

use of edu.snu.mist.formats.avro.ClientToTaskMessage in project mist by snuspl.

the class MISTQueryControl method delete.

/**
 * request task to delete the query.
 * TODO[MIST-290]: Return a message to Client.
 * @param queryId
 * @param taskAddress
 * @return It returns a result message of deletion.
 * @throws IOException
 */
public static APIQueryControlResult delete(final String groupId, final String queryId, final IPAddress taskAddress) throws IOException {
    final ClientToTaskMessage proxy = getProxy(taskAddress);
    final QueryControlResult queryControlResult = proxy.deleteQueries(groupId, queryId);
    final APIQueryControlResult apiQueryControlResult = new APIQueryControlResultImpl(queryControlResult.getQueryId(), taskAddress, queryControlResult.getMsg(), queryControlResult.getIsSuccess());
    return apiQueryControlResult;
}
Also used : ClientToTaskMessage(edu.snu.mist.formats.avro.ClientToTaskMessage) QueryControlResult(edu.snu.mist.formats.avro.QueryControlResult)

Example 2 with ClientToTaskMessage

use of edu.snu.mist.formats.avro.ClientToTaskMessage in project mist by snuspl.

the class MISTQueryControl method getProxy.

private static ClientToTaskMessage getProxy(final IPAddress taskAddress) throws IOException {
    ClientToTaskMessage proxyToTask = TASK_PROXY_MAP.get(taskAddress);
    if (proxyToTask == null) {
        final NettyTransceiver clientToTask = new NettyTransceiver(new InetSocketAddress(taskAddress.getHostAddress(), taskAddress.getPort()));
        final ClientToTaskMessage proxy = SpecificRequestor.getClient(ClientToTaskMessage.class, clientToTask);
        TASK_PROXY_MAP.putIfAbsent(taskAddress, proxy);
        proxyToTask = TASK_PROXY_MAP.get(taskAddress);
    }
    return proxyToTask;
}
Also used : NettyTransceiver(org.apache.avro.ipc.NettyTransceiver) InetSocketAddress(java.net.InetSocketAddress) ClientToTaskMessage(edu.snu.mist.formats.avro.ClientToTaskMessage)

Aggregations

ClientToTaskMessage (edu.snu.mist.formats.avro.ClientToTaskMessage)2 QueryControlResult (edu.snu.mist.formats.avro.QueryControlResult)1 InetSocketAddress (java.net.InetSocketAddress)1 NettyTransceiver (org.apache.avro.ipc.NettyTransceiver)1