public void destroy()
    {
        for (Socket socket : sockets) {
            destroySocket(socket);
        }
        sockets.clear();

        for (Selector selector : selectors) {
            context.close(selector);
        }
        selectors.clear();

        // Only terminate context if we are on the main thread
        if (isMain()) {
            context.term();
        }
    }
public void destroy ( ) { for ( Socket socket : sockets ) { destroySocket ( socket ) ; } sockets . clear ( ) ; for ( Selector selector : selectors ) { context . close ( selector ) ; } selectors . clear ( ) ; if ( isMain ( ) ) { context . term ( ) ; } }
Destructor.  Call this to gracefully terminate context and close any managed 0MQ sockets