Extract data from a received envelope, and forwad it to the rest of the platform.

@param env
- the evenlope received over the network, and that must be deserialize.
@throws Exception
- if cannot deserialize the envelope.
333329
protected synchronized void receive(EventEnvelope env) throws Exception {
        this.logger.getKernelLogger().fine(MessageFormat.format(Messages.ZeroMQNetworkService_8, this.validatedURI, env));
        final EventDispatch dispatch = this.serializer.deserialize(env);
        this.logger.getKernelLogger().fine(MessageFormat.format(Messages.ZeroMQNetworkService_9, dispatch));

        final SpaceID spaceID = dispatch.getSpaceID();
        final NetworkEventReceivingListener space = this.messageRecvListeners.get(spaceID);
        if (space != null) {
            this.executorService.submit(new AsyncRunner(space, spaceID, dispatch.getScope(), dispatch.getEvent()));
        } else {
            this.logger.getKernelLogger().fine(MessageFormat.format(Messages.ZeroMQNetworkService_10, spaceID, dispatch.getEvent()));
        }
    }
1298124
@Override
	public void handleReturn(
			int replyCode,
			String replyText,
			String exchange,
			String routingKey,
			BasicProperties properties,
			byte[] body )
	throws IOException {

		String messageType = "undetermined";
		try {
			Message msg = SerializationUtils.deserializeObject( body );
			messageType = msg.getClass().getName();

		} catch( Exception e ) {
			this.logger.severe( "Failed to deserialize a message object." );
			Utils.logException( this.logger, e );
		}

		if( this.logger.isLoggable( Level.WARNING )) {
			final StringBuilder sb = new StringBuilder();
			sb.append("A message sent by a RabbitMQ client was not received by any queue.\n");
			sb.append("Message type: " + messageType + '\n');
			sb.append("Routing key: " + routingKey + '\n');
			sb.append("Reason: " + replyText);
			this.logger.warning( sb.toString());
		}
	}
925428
function loadEnvFromFile (fileName) {
  try {
    var receivers = fs.readFileSync(fileName).toString()
    if (receivers) {
      var lines = receivers.split('\n')
    }
    if (/logsene-js/.test(process.env.DEBUG)) {
      console.log(new Date(), 'loading Sematext receiver URLs from ' + fileName)
    }
    lines.forEach(function (line) {
      var kv = line.split('=')
      if (kv.length === 2 && kv[1].length > 0) {
        process.env[kv[0].trim()] = kv[1].trim()
        if (/logsene-js/.test(process.env.DEBUG)) {
          console.log(kv[0].trim() + ' = ' + kv[1].trim())
        }
      }
    })
  } catch (error) {
    // ignore missing file or wrong format
    if (/logsene-js/.test(process.env.DEBUG)) {
      console.error(error.message)
    }
  }
}
629801
public void         takeException(Exception exception) throws Exception
    {
        boolean     rethrow = true;
        if ( isRetryException(exception) )
        {
            if ( !Boolean.getBoolean(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES) )
            {
                log.debug("Retry-able exception received", exception);
            }

            if ( retryPolicy.allowRetry(retryCount++, System.currentTimeMillis() - startTimeMs, sleeper) )
            {
                new EventTrace("retries-allowed", tracer.get()).commit();
                if ( !Boolean.getBoolean(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES) )
                {
                    log.debug("Retrying operation");
                }
                rethrow = false;
            }
            else
            {
                new EventTrace("retries-disallowed", tracer.get()).commit();
                if ( !Boolean.getBoolean(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES) )
                {
                    log.debug("Retry policy not allowing retry");
                }
            }
        }

        if ( rethrow )
        {
            throw exception;
        }
    }
1071461
public static void exception(String message, Throwable e) {
    if(message == null && e != null) {
      message = e.getMessage();
    }
    logExpensive(Level.SEVERE, message, e);
  }
440882
public static void main(String argv[]) throws Exception {
        String idlFile = null;
        String pkgName = null;
        String outDir = null;
        String nsPkgName = null;
        boolean allImmutable = false;
        List<String> immutableSubstr = new ArrayList<String>();

        for (int i = 0; i < argv.length; i++) {
            if (argv[i].equals("-j")) {
                idlFile = argv[++i];
            }
            else if (argv[i].equals("-p")) {
                pkgName = argv[++i];
            }
            else if (argv[i].equals("-o")) {
                outDir = argv[++i];
            }
            else if (argv[i].equals("-b")) {
                nsPkgName = argv[++i];
            }
            else if (argv[i].equals("-s")) {
                immutableSubstr.add(argv[++i]);
            }
            else if (argv[i].equals("-i")) {
                allImmutable = true;
            }
        }

        if (isBlank(idlFile) || isBlank(pkgName) || isBlank(outDir)) {
            out("Usage: java com.bitmechanic.barrister.Idl2Java -j [idl file] -p [Java package prefix] -b [Java package prefix for namespaced entities] -o [out dir] -i -s [immutable class substr]");
            System.exit(1);
        }

        if (nsPkgName == null) {
            nsPkgName = pkgName;
        }

        new Idl2Java(idlFile, pkgName, nsPkgName, outDir, allImmutable, immutableSubstr);
    }
1104873
@Override
	public DataStream<Row> getDataStream(StreamExecutionEnvironment env) {

		DeserializationSchema<Row> deserializationSchema = getDeserializationSchema();
		// Version-specific Kafka consumer
		FlinkKafkaConsumerBase<Row> kafkaConsumer = getKafkaConsumer(topic, properties, deserializationSchema);
		return env.addSource(kafkaConsumer).name(explainSource());
	}
1372579
@Override
	public void serialize(BinderContext context, SerializerWrapper serializerWrapper, E object) throws Exception {
		serialize(context, object, serializerWrapper, true);
	}
485388
public void addEnvelope(Envelope envSrc, boolean bReverse) {
		if (envSrc.isEmpty())
			return;

		boolean bWasEmpty = m_pointCount == 0;
		Point pt = new Point(m_description);// getDescription());
		for (int i = 0, n = 4; i < n; i++) {
			int j = bReverse ? n - i - 1 : i;

			envSrc.queryCornerByVal(j, pt);
			if (i == 0)
				startPath(pt);
			else
				lineTo(pt);
		}

		closePathWithLine();
		m_bPathStarted = false;

		if (bWasEmpty && !bReverse)
			_setDirtyFlag(DirtyFlags.DirtyIsEnvelope, false);// now we know the
																// polypath is
																// envelope
	}
462790
public void addEnvelope(Envelope2D envSrc, boolean bReverse) {
		boolean bWasEmpty = m_pointCount == 0;

		startPath(envSrc.xmin, envSrc.ymin);
		if (bReverse) {
			lineTo(envSrc.xmax, envSrc.ymin);
			lineTo(envSrc.xmax, envSrc.ymax);
			lineTo(envSrc.xmin, envSrc.ymax);
		} else {
			lineTo(envSrc.xmin, envSrc.ymax);
			lineTo(envSrc.xmax, envSrc.ymax);
			lineTo(envSrc.xmax, envSrc.ymin);
		}

		closePathWithLine();
		m_bPathStarted = false;

		if (bWasEmpty && !bReverse) {
			_setDirtyFlag(DirtyFlags.DirtyIsEnvelope, false);// now we no(sic?)
																// the polypath
																// is envelope
		}
	}
1288925
private static void setEnv(Map<String, String> newEnv, boolean overwrite) {

		for (Entry<String, String> entry : newEnv.entrySet()) {
			if (overwrite || System.getProperty(entry.getKey()) != null) {
				System.setProperty(entry.getKey(), entry.getValue());
			}
		}

		if (!overwrite) {
			Iterator<Entry<String, String>> iterator = newEnv.entrySet().iterator();
			while (iterator.hasNext()) {
				Entry<String, String> next = iterator.next();
				if (System.getenv(next.getKey()) != null) {
					iterator.remove();
				}
			}
		}

		try {
			Class<?> processEnvironmentClass = Class.forName("java.lang.ProcessEnvironment");
			Method variableMethod = Class.forName("java.lang.ProcessEnvironment$Variable").getMethod("valueOf", String.class);
			variableMethod.setAccessible(true);
			Method valueMethod = Class.forName("java.lang.ProcessEnvironment$Value").getMethod("valueOf", String.class);
			valueMethod.setAccessible(true);

			Map<Object, Object> newEnvVarVal = new HashMap<Object, Object>();
			for (Map.Entry<String, String> entry : newEnv.entrySet()) {
				Object key = variableMethod.invoke(null, entry.getKey());
				String valueText = entry.getValue();
				Object value = valueText != null ? valueMethod.invoke(null, valueText) : null;
				newEnvVarVal.put(key, value);
			}

			Field theEnvironmentField = processEnvironmentClass.getDeclaredField("theEnvironment");
			theEnvironmentField.setAccessible(true);
			Map<Object, Object> env = (Map<Object, Object>) theEnvironmentField.get(null);
			for (Entry<Object, Object> entry : newEnvVarVal.entrySet()) {
				if (entry.getValue() == null) {
					env.remove(entry.getKey());
				} else {
					env.put(entry.getKey(), entry.getValue());
				}
			}
			Field theCaseInsensitiveEnvironmentField = processEnvironmentClass.getDeclaredField("theCaseInsensitiveEnvironment");
			theCaseInsensitiveEnvironmentField.setAccessible(true);
			Map<Object, Object> cienv = (Map<Object, Object>) theCaseInsensitiveEnvironmentField.get(null);
			cienv.putAll(newEnvVarVal);

		} catch (NoSuchFieldException e) {
			try {
				Class[] classes = Collections.class.getDeclaredClasses();
				Map<String, String> env = System.getenv();
				for (Class cl : classes) {
					if ("java.util.Collections$UnmodifiableMap".equals(cl.getName())) {
						Field field = cl.getDeclaredField("m");
						field.setAccessible(true);
						Object obj = field.get(env);
						Map<String, String> map = (Map<String, String>) obj;
						for (Entry<String, String> entry : newEnv.entrySet()) {
							if (entry.getValue() == null) {
								map.remove(entry.getKey());
							} else {
								map.put(entry.getKey(), entry.getValue());
							}
						}
					}
				}
			} catch (Exception e2) {
				LOGGER.error(e2.getMessage(), e2);
			}
		} catch (Exception e1) {
			LOGGER.error(e1.getMessage(), e1);
		}
	}
40736
@Given("^I get service '(.+?)' status in cluster '(.+?)' and save it in variable '(.+?)'")
    public void getServiceStatus(String service, String cluster, String envVar) throws Exception {
        String status = commonspec.retrieveServiceStatus(service, cluster);

        ThreadProperty.set(envVar, status);
    }
602506
synchronized private void checkEnv() throws IOException {
    if (!initialized) {
      FormatInfoWritable writable = localFormatInfoWritable.get();
      if (metadataManager.readWritableFromZk(formatInfoPath, writable, null) == null) {
        LOG.error("Environment not initialized (format() not called?)");
        throw new IOException(
            "Environment not initialized (format() not called?");
      }
      if (writable.getProtoVersion() != PROTO_VERSION) {
        throw new IllegalStateException("Wrong protocol version! Expected " +
            BKJM_BOOKKEEPER_DIGEST_PW + ", but read " +
            writable.getProtoVersion());
      }
      if (LOG.isDebugEnabled()) {
        LOG.debug("Namespace info read: " + writable.toColonSeparatedString());
      }
    }
    currentInProgressMetadata.init();
    initialized = true;
  }
518839
public EnvVars getEnvironment() throws IOException, InterruptedException {
        EnvVars cachedEnvironment = this.cachedEnvironment;
        if (cachedEnvironment != null) {
            return new EnvVars(cachedEnvironment);
        }

        cachedEnvironment = EnvVars.getRemote(getChannel());
        this.cachedEnvironment = cachedEnvironment;
        return new EnvVars(cachedEnvironment);
    }
901196
private static ASN1Primitive getIssuer(byte[] enc) {
        try {
            ASN1InputStream in = new ASN1InputStream(new ByteArrayInputStream(enc));
            ASN1Sequence seq = (ASN1Sequence)in.readObject();
            return (ASN1Primitive)seq.getObjectAt(seq.getObjectAt(0) instanceof DERTaggedObject ? 3 : 2);
        }
        catch (IOException e) {
            throw new ExceptionConverter(e);
        }
    }
912197
public static void put(String key, String value) throws Exception {
        Map<String, String> environemnt = new HashMap<String, String>(System.getenv());
        environemnt.put(key, value);
        updateEnvironment(environemnt);
    }
612635
def requestEnv(self, env={}):
        
        for variable, value in env.items():
            data = common.NS(variable) + common.NS(value)
            self.sendRequest('env', data)