Search in sources :

Example 1 with DeleteEventQueueApiRequest

use of com.github.jamesnetherton.zulip.client.api.event.request.DeleteEventQueueApiRequest in project zulip-java-client by jamesnetherton.

the class EventPoller method stop.

/**
 * Stops message polling.
 */
public synchronized void stop() {
    if (status.equals(Status.STARTING) || status.equals(Status.STARTED)) {
        try {
            LOG.info("EventPoller stopping");
            status = Status.STOPPING;
            executor.shutdown();
            DeleteEventQueueApiRequest deleteQueue = new DeleteEventQueueApiRequest(this.client, queue.getQueueId());
            deleteQueue.execute();
        } catch (ZulipClientException e) {
            LOG.warning("Error deleting event queue - " + e.getMessage());
        } finally {
            LOG.info("EventPoller stopped");
            executor = null;
            status = Status.STOPPED;
        }
    }
}
Also used : ZulipClientException(com.github.jamesnetherton.zulip.client.exception.ZulipClientException) DeleteEventQueueApiRequest(com.github.jamesnetherton.zulip.client.api.event.request.DeleteEventQueueApiRequest)

Aggregations

DeleteEventQueueApiRequest (com.github.jamesnetherton.zulip.client.api.event.request.DeleteEventQueueApiRequest)1 ZulipClientException (com.github.jamesnetherton.zulip.client.exception.ZulipClientException)1