<commit_before>/**
 * THe mininal Muon javascript protocol runtime, implemented for Nashorn
 */

var apichannel = null
var theproto;
var state = {}
function setState(name, val) {
  state[name] = val;
}

function setTimeout(func, millis) {
  var run = Java.type("java.lang.Runnable")
  var myRun = Java.extend(run, {
    run: func
  })

  return scheduler.executeIn(millis, Java.type("java.util.concurrent.TimeUnit").MILLISECONDS, new myRun())
}

function clearTimeout (exec) {
  exec.cancel()
}

function startProto() {
  theproto = module.exports(api)
}

function invokeRight(msg) {
  theproto.fromTransport(msg)
}

function invokeLeft(msg) {
  theproto.fromApi(msg)
}

var api = {
  state: function(name) {
    var localstate = state[name]
    if (!localstate) {
    }
    return state[name];
  },
  sendApi: function (msg) {
    if (apichannel) {
      apichannel.send(msg)
    }
  },

  serviceName: function () {
    return muon.configuration.getServiceName()
  },

  configString: function (name) {
    return muon.configuration.getStringConfig(name)
  },

  sendTransport: function (msg) {
    var outbound = muonMessageCreator.apply(msg)
    transportchannel.send(outbound)
  },

  shutdown: function () {
    apichannel.shutdown()
    transportchannel.shutdown()
  },

  type: function (typename, payload) {
    return typeconverter.apply(typename, payload)
  },

  decode: function (typename, message) {
    return decoder.apply(typename, message)
  },

  encodeFor: function (message, service) {
    return encode.apply(message, service)<commit_msg>null guard on JS protocol shutdown<commit_after>/**
 * THe mininal Muon javascript protocol runtime, implemented for Nashorn
 */

var apichannel = null
var theproto;
var state = {}
function setState(name, val) {
  state[name] = val;
}

function setTimeout(func, millis) {
  var run = Java.type("java.lang.Runnable")
  var myRun = Java.extend(run, {
    run: func
  })

  return scheduler.executeIn(millis, Java.type("java.util.concurrent.TimeUnit").MILLISECONDS, new myRun())
}

function clearTimeout (exec) {
  exec.cancel()
}

function startProto() {
  theproto = module.exports(api)
}

function invokeRight(msg) {
  theproto.fromTransport(msg)
}

function invokeLeft(msg) {
  theproto.fromApi(msg)
}

var api = {
  state: function(name) {
    var localstate = state[name]
    if (!localstate) {
    }
    return state[name];
  },
  sendApi: function (msg) {
    if (apichannel) {
      apichannel.send(msg)
    }
  },

  serviceName: function () {
    return muon.configuration.getServiceName()
  },

  configString: function (name) {
    return muon.configuration.getStringConfig(name)
  },

  sendTransport: function (msg) {
    var outbound = muonMessageCreator.apply(msg)
    transportchannel.send(outbound)
  },

  shutdown: function () {
    if (apichannel) apichannel.shutdown()
    if (transportchannel) transportchannel.shutdown()
  },

  type: function (typename, payload) {
    return typeconverter.apply(typename, payload)
  },

  decode: function (typename, message) {
    return decoder.apply(typename, message)
  },

  encodeFor: function (message, service) {
    return encode.apply(message, service)
{'fraction_non_alphanumeric': 0.12582573136206354, 'fraction_numerical': 0.0, 'mean_word_length': 3.8036253776435047, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6878592', 'n_tokens_mistral': 1048, 'n_tokens_neox': 1023, 'n_words': 228}