Called after each SQL command execution. Stops concrete SQL stopwatch (started in {@link #prepare(String)}),
also adds time to SQL command type Simon and sets human readable SQL cmd as note.

@param split started Stopwatch split
321665
protected final void finish(Split split) {
		if (split != null) {
			SimonManager.getStopwatch(sqlCmdLabel).addSplit(split.stop());
		}
	}
953939
@Override
    public Object js_split(Context cx, Scriptable scope,
                                   String target, Object[] args)
    {
        // create an empty Array to return;
        Scriptable result = cx.newArray(scope, 0);

        // Use the second argument as the split limit, if given.
        boolean limited = (args.length > 1) && (args[1] != Undefined.instance);
        long limit = 0;  // Initialize to avoid warning.
        if (limited) {
            /* Clamp limit between 0 and 1 + string length. */
            limit = ScriptRuntime.toUint32(args[1]);
            if (limit > target.length())
                limit = 1 + target.length();
        }

        // return an array consisting of the target if no separator given
        if (args.length < 1 || args[0] == Undefined.instance) {
            result.put(0, result, target);
            return result;
        }

        String separator = null;
        int[] matchlen = new int[1];
        Scriptable re = null;
        RegExpProxy reProxy = null;
        if (args[0] instanceof Scriptable) {
            reProxy = ScriptRuntime.getRegExpProxy(cx);
            if (reProxy != null) {
                Scriptable test = (Scriptable)args[0];
                if (reProxy.isRegExp(test)) {
                    re = test;
                }
            }
        }
        if (re == null) {
            separator = ScriptRuntime.toString(args[0]);
            matchlen[0] = separator.length();
        }

        // split target with separator or re
        int[] ip = { 0 };
        int match;
        int len = 0;
        boolean[] matched = { false };
        String[][] parens = { null };
        int version = cx.getLanguageVersion();
        while ((match = find_split(cx, scope, target, separator, version,
                                   reProxy, re, ip, matchlen, matched, parens))
               >= 0)
        {
            if ((limited && len >= limit) || (match > target.length()))
                break;

            String substr;
            if (target.length() == 0)
                substr = target;
            else
                substr = target.substring(ip[0], match);

            result.put(len, result, substr);
            len++;
        /*
         * Imitate perl's feature of including parenthesized substrings
         * that matched part of the delimiter in the new array, after the
         * split substring that was delimited.
         */
            if (re != null && matched[0]) {
                int size = parens[0].length;
                for (int num = 0; num < size; num++) {
                    if (limited && len >= limit)
                        break;
                    result.put(len, result, parens[0][num]);
                    len++;
                }
                matched[0] = false;
            }
            ip[0] = match + matchlen[0];

            if (version < Context.VERSION_1_3
                && version != Context.VERSION_DEFAULT)
            {
        /*
         * Deviate from ECMA to imitate Perl, which omits a final
         * split unless a limit argument is given and big enough.
         */
                if (!limited && ip[0] == target.length())
                    break;
            }
        }
        return result;
    }
954324
synchronized void stop(){
        if(status.equals("stopped"))
            return;
        long t = System.currentTimeMillis();
        run = false;

        try {
            serverSocket.close();
        } catch (IOException e) {
            throw S1SystemError.wrap(e);
        }

        executor.shutdown();
        while (!executor.isTerminated()) {
        }

        status = "stopped";
        LOG.info("Node "+nodeId+" file server stopped ("+(System.currentTimeMillis()-t)+" ms.)");
    }
1121684
@Override
    @InterfaceAudience.Private
    public void beginReplicating() {
        // If we're still waiting to create the remote db, do nothing now. (This method will be
        // re-invoked after that request finishes; see -maybeCreateRemoteDB above.)

        Log.d(TAG, "%s: beginReplicating() called", this);

        // reset doneBeginReplicating
        doneBeginReplicating = false;

        // If we're still waiting to create the remote db, do nothing now. (This method will be
        // re-invoked after that request finishes; see maybeCreateRemoteDB() above.)
        if (creatingTarget) {
            Log.d(TAG, "%s: creatingTarget == true, doing nothing", this);
            return;
        }

        pendingSequences = Collections.synchronizedSortedSet(new TreeSet<Long>());
        try {
            maxPendingSequence = Long.parseLong(lastSequence);
        } catch (NumberFormatException e) {
            Log.w(TAG, "Error converting lastSequence: %s to long.  Using 0", lastSequence);
            maxPendingSequence = new Long(0);
        }

        filter = compilePushReplicationFilter();
        if (filterName != null && filter == null) {
            Log.w(TAG, "%s: No ReplicationFilter registered for filter '%s'; ignoring",
                    this, filterName);
        }

        // Now listen for future changes (in continuous mode):
        if (isContinuous() && isRunning()) {
            observing = true;
            db.addChangeListener(this);
        }

        // Process existing changes since the last push:
        long lastSequenceLong = 0;
        if (lastSequence != null) {
            lastSequenceLong = Long.parseLong(lastSequence);
        }
        ChangesOptions options = new ChangesOptions();
        options.setIncludeConflicts(true);
        Log.d(TAG, "%s: Getting changes since %d", this, lastSequenceLong);
        final RevisionList changes = db.changesSince(lastSequenceLong, options, filter, filterParams);
        if (changes.size() > 0) {
            Log.d(TAG, "%s: Queuing %d changes since %d", this, changes.size(), lastSequenceLong);
            // NOTE: Needs to submit changes into inbox from RemoteRequest thread for beginReplication.
            //       RemoteRequest thread is observed by pendingFuture, if using other thread to
            //       submit changes  into inbox, there are chance both inbox and pendingFutures are
            //       empty.
            submitRevisions(changes);
        } else {
            Log.d(TAG, "%s: No changes since %d", this, lastSequenceLong);
        }

        // process queued changes by `changed()` callback
        synchronized (changesLock) {
            for (RevisionInternal rev : queueChanges) {
                if (!changes.contains(rev)) {
                    pauseOrResume();
                    waitIfPaused();
                    addToInbox(rev);
                }
            }
            doneBeginReplicating = true;
        }
    }
874164
public static synchronized void stop(){
        if(status.equals("stopped"))
            return;
        long t = System.currentTimeMillis();

        startupUpdator.stop();
        messageListener.stop();

        fileExchange.stop();
        queueWorker.stop();

        status = "stopped";
        LOG.info("Cluster node "+nodeId+" stopped ("+(System.currentTimeMillis()-t)+" ms.)");
    }
893199
private void attemptToSplit(ActiveLearningNode activeLearningNode, FoundNode foundNode){
		//Increment the split ID
		this.splitId++;
		
		//Schedule time-out thread
		ScheduledFuture<?> timeOutHandler = this.executor.schedule(new AggregationTimeOutHandler(this.splitId, this.timedOutSplittingNodes), 
				this.timeOut, TimeUnit.SECONDS);
		
		//Keep track of the splitting node information, so that we can continue the split
		//once we receive all local statistic calculation from Local Statistic PI
		//this.splittingNodes.put(Long.valueOf(this.splitId), new SplittingNodeInfo(activeLearningNode, foundNode, null)); 
		this.splittingNodes.put(this.splitId, new SplittingNodeInfo(activeLearningNode, foundNode, timeOutHandler));
		
		//Inform Local Statistic PI to perform local statistic calculation
		activeLearningNode.requestDistributedSuggestions(this.splitId, this);
	}
1075567
protected Object processInvoke(MethodInvocation invocation, Split split) throws Throwable {
		try {
			return invocation.proceed();
		} catch (Throwable t) {
			split.stop(tagByExceptionType ? t.getClass().getSimpleName() : EXCEPTION_TAG);
			throw t;
		}
	}
866567
private void init(final Map<DistributedDataSetPartition, InputSplit[]> splitsPerPartition) {
    final Pair<InputSplit[], DistributedDataSetPartition[]>
                                      splitsAndPartitions = getSplitsAndPartitions(splitsPerPartition);
    final InputSplit[] splits = splitsAndPartitions.getFirst();
    final DistributedDataSetPartition[] partitions = splitsAndPartitions.getSecond();
    Validate.isTrue(splits.length == partitions.length);
    for (int splitNum = 0; splitNum < splits.length; splitNum++) {
      LOG.log(Level.FINE, "Processing split: " + splitNum);
      final InputSplit split = splits[splitNum];
      final NumberedSplit<InputSplit> numberedSplit = new NumberedSplit<>(split, splitNum,
          partitions[splitNum]);
      unallocatedSplits.add(numberedSplit);
      updateLocations(numberedSplit);
    }
    if (LOG.isLoggable(Level.FINE)) {
      for (final Map.Entry<String, BlockingQueue<NumberedSplit<InputSplit>>> locSplit : locationToSplits.entrySet()) {
        LOG.log(Level.FINE, locSplit.getKey() + ": " + locSplit.getValue().toString());
      }
    }
  }
1112851
@Override
	public void onStopwatchStop(Split split, StopwatchSample sample) {
		logger.log(level, "SIMON STOP: " + sample.simonToString() + " (" + split.runningFor() + ")");
	}
328854
protected final Split stopStopwatch() {
		HandlerLocation location = threadLocation.get();
		Split split = null;
		if (location != null) {
			split = location.getSplit();
			split.stop();
			location.setSplit(null);
		}
		return split;
	}
952479
@Override
    public void initialize(InputSplit split) throws IOException, InterruptedException {
        if (split instanceof ListStringSplit) {
            ListStringSplit listStringSplit = (ListStringSplit) split;
            delimitedData = listStringSplit.getData();
            dataIter = delimitedData.iterator();
        } else {
            throw new IllegalArgumentException("Illegal type of input split " + split.getClass().getName());
        }
    }
1280359
public static void main(String[] args) {
		// manager with two stopwatches is created
		Manager manager = new EnabledManager();
		Stopwatch sw1 = manager.getStopwatch("org.javasimon.examples.stopwatch1");
		Stopwatch sw2 = manager.getStopwatch("other.stopwatch2");

		// simple callback printing actions to the stdout is created and installed
		Callback stdoutCallback = new CallbackSkeleton() {
			@Override
			public void onStopwatchStart(Split split) {
				System.out.println("Starting " + split.getStopwatch().getName());
			}

			@Override
			public void onStopwatchStop(Split split, StopwatchSample sample) {
				System.out.println("Stopped " + split.getStopwatch().getName() + " (" + SimonUtils.presentNanoTime(split.runningFor()) + ")");
			}
		};
		manager.callback().addCallback(stdoutCallback);

		// prints start/stop for both stopwatches
		sw1.start().stop();
		sw2.start().stop();
		System.out.println();

		// we need to remove old callback
		manager.callback().removeCallback(stdoutCallback);
		// alternatively you can call this if you want to remove all callbacks
		SimonManager.callback().removeAllCallbacks();

		// filter callback is created
		CompositeFilterCallback filter = new CompositeFilterCallback();
		// rule to filter out all Simons matching pattern "other.*" is added
		filter.addRule(FilterRule.Type.MUST_NOT, null, "other.*");
		// original callback is added after this callback
		filter.addCallback(stdoutCallback);

		// filter callback is installed to the manager (with printing callback behind)
		manager.callback().addCallback(filter);

		// start/stop is printed only for sw1 because sw2 matches other.* pattern that is excluded (MUST_NOT)
		sw1.start().stop();
		sw2.start().stop();
	}
347448
@SuppressWarnings("UnusedParameters")
	protected LogTemplate<Split> createLogTemplate(Stopwatch stopwatch) {
		LogTemplate<Split> logTemplate;
		if (logEnabled) {
			logTemplate = everyNSplits(enabledStopwatchLogTemplate, capacity);
		} else {
			logTemplate = disabled();
		}
		return logTemplate;
	}
244430
@Override
	public void onStopwatchStop(Split split, StopwatchSample sample) {
		onStopwatchSplit(split.getStopwatch(), split);
	}
358061
private void stop(boolean removeFromList) {
        synchronized (lock) {
            observing = false;
            willUpdate = false; // cancels the delayed update started by -databaseChanged
            if (query != null && query.getDatabase() != null && dbListenerToken != null) {
                query.getDatabase().removeChangeListener(dbListenerToken);
                dbListenerToken = null;
            }
            if (removeFromList && query != null && query.getDatabase() != null) {
                query.getDatabase().getActiveLiveQueries().remove(this);
            }
            releaseResultSet();
        }
    }
538294
private String performSplitting(String source, String splitString, String indexString)
        throws TransformationOperationException {
        try {
            Integer index = Integer.parseInt(indexString);
            return source.split(splitString)[index];
        } catch (NumberFormatException e) {
            throw new TransformationOperationException("The given result index parameter is not a number");
        } catch (IndexOutOfBoundsException e) {
            throw new TransformationOperationException(
                "The split result does not have that much results for the index parameter");
        }
    }
1304575
public void abort(final Executor exec) throws SQLException {
        if (exec == null) {
            throw new SQLException("Missing executor");
        } // end of if

        if (this.closed) {
            return;
        } // end of if

        this.closed = true;
    }