private void execSQLWrapper(String query) throws SPARULException {
        try {
            execSQL(query);
        } catch (Exception e) {

            String expMessage = e.toString();
            // This means that VOS is probably down
            if (expMessage.contains("Broken pipe") || expMessage.contains("Virtuoso Communications Link Failure")) {
                logger.error("Virtuoso is probably down, exiting...", e);
                System.exit(1);
            }
            //When Virtuoso commits a CHECKPOINT we fail to insert anything
            //and get a Transaction deadlock exception
            //here we lock everything and try X attempts every Y seconds
            if (expMessage.contains("Transaction deadlock")) {
                synchronized (SPARULVosExecutor.class) {
                    //The checkpoint lasts around 2-3 minutes
                    int attempts = 10;
                    int sleep = 30000;
                    for (int i = 1; i < attempts; i++) {
                        try {
                            logger.warn("Transaction Deadlock, retrying query: " + i + "/" + attempts);
                            execSQL(query);
                            //When no exception return
                            return;
                        } catch (Exception e1) {
                            logger.warn("Transaction Deadlock, retrying query: " + i + "/" + attempts + "(FAILED)");
                            try {
                                Thread.sleep(sleep);
                            } catch (InterruptedException e2) {
                                //do nothing
                            }
                        }
                    }
                }
            }
            throw new SPARULException(e);
        }
    }