List of usage examples for java.lang RuntimeException getMessage
public String getMessage()
From source file:com.espertech.esper.epl.virtualdw.SubordTableLookupStrategyVirtualDW.java
public Collection<EventBean> lookup(Object[] keys) { Set<EventBean> data = null; try {/*from w ww .j a va 2 s .c o m*/ data = externalIndex.lookup(keys, null); } catch (RuntimeException ex) { log.warn("Exception encountered invoking virtual data window external index for window '" + namedWindowName + "': " + ex.getMessage(), ex); } return data; }
From source file:com.espertech.esper.core.ExceptionHandlingService.java
public void handleException(RuntimeException ex, EPStatementHandle handle) { if (exceptionHandlers.isEmpty()) { log.error("Exception encountered processing statement '" + handle.getStatementName() + "' statement text '" + handle.getEPL() + "' : " + ex.getMessage(), ex); return;/*w ww .ja v a 2 s.co m*/ } ExceptionHandlerContext context = new ExceptionHandlerContext(engineURI, ex, handle.getStatementName(), handle.getEPL()); for (ExceptionHandler handler : exceptionHandlers) { handler.handle(context); } }
From source file:com.digitalpebble.storm.crawler.librato.metrics.LibratoMetricsConsumer.java
@Override public void handleDataPoints(TaskInfo taskInfo, Collection<DataPoint> dataPoints) { final Map<String, Object> payloadMap = new HashMap<String, Object>(); payloadMap.put("source", taskInfo.srcComponentId + "_" + taskInfo.srcWorkerHost + "_" + taskInfo.srcTaskId); payloadMap.put("measure_time", taskInfo.timestamp); final List<Map<String, Object>> gaugeData = new ArrayList<Map<String, Object>>(); final List<Map<String, Object>> counterData = new ArrayList<Map<String, Object>>(); int counter = 0; final Iterator<DataPoint> datapointsIterator = dataPoints.iterator(); while (datapointsIterator.hasNext()) { final DataPoint dataPoint = datapointsIterator.next(); // ignore datapoint with a value which is not a map if (!(dataPoint.value instanceof Map)) continue; // a counter or a gauge // convention if its name contains '_counter' // then treat it as a counter boolean isCounter = false; if (dataPoint.name.contains("_counter")) { isCounter = true;//from w w w .j a v a 2 s. c o m dataPoint.name = dataPoint.name.replaceFirst("_counter", ""); } if (!metricsToKeep.isEmpty()) { if (!metricsToKeep.contains(dataPoint.name.toLowerCase())) { continue; } } try { Map<String, Number> metric = (Map<String, Number>) dataPoint.value; for (Map.Entry<String, Number> entry : metric.entrySet()) { String metricId = entry.getKey(); Number val = entry.getValue(); final Map<String, Object> data = new HashMap<String, Object>(); data.put("name", sanitizer.apply(dataPoint.name + "_" + metricId)); data.put("value", val); if (isCounter) counterData.add(data); else // use as gauge gaugeData.add(data); counter++; if (counter % postBatchSize == 0 || (!datapointsIterator.hasNext() && (!counterData.isEmpty() || !gaugeData.isEmpty()))) { final String countersKey = "counters"; final String gaugesKey = "gauges"; payloadMap.put(countersKey, counterData); payloadMap.put(gaugesKey, gaugeData); postPortion(payloadMap); payloadMap.remove(gaugesKey); payloadMap.remove(countersKey); gaugeData.clear(); counterData.clear(); } } } catch (RuntimeException e) { LOG.error(e.getMessage()); } } LOG.debug("Posted {} measurements", counter); }
From source file:de.pixida.logtest.processing.JobExecutor.java
public JobExecutor(final List<Job> jobs) { Validate.notNull(jobs);//from w w w . ja va2s. co m LOG.info("Starting execution of '{}' jobs", jobs.size()); this.results = new ArrayList<>(jobs.size()); this.jobExecutionTimesMs = new ArrayList<>(jobs.size()); int i = 0; for (final Job job : jobs) { LOG.debug("Starting execution of job '{}'", i); final StopWatch watch = new StopWatch(); watch.start(); try { final ILogReader logReader = job.getLogReader(); Validate.notNull(logReader); final List<LogSink> sinks = job.getSinks(); Validate.notNull(sinks); this.runEvaluations(logReader, this.createAutomatons(sinks)); } catch (final RuntimeException re) { LOG.error("Internal error in job '{}': {}", i, re.getMessage()); final List<EvaluationResult> errorResultList = new ArrayList<>(job.getSinks().size()); for (int j = 0; j < job.getSinks().size(); j++) { errorResultList.add(new EvaluationResult(Result.INTERNAL_ERROR, re.getMessage())); } this.results.add(errorResultList); } this.jobExecutionTimesMs.add(watch.getTime()); LOG.info("Job {} / {} finished", i + 1, jobs.size()); i++; } LOG.debug("Finished execution of '{}' jobs", jobs.size()); }
From source file:com.almende.eve.transport.ws.WsClientTransport.java
@Override public void send(final URI receiverUri, final String message, final String tag) throws IOException { if (!receiverUri.equals(serverUrl)) { throw new IOException( "Currently it's only possible to send to the server agent directly, not other agents:" + receiverUri.toASCIIString() + " serverUrl:" + serverUrl.toASCIIString()); }//from w w w . j a v a 2s . c om if (remote == null || !isConnected()) { connect(); } if (remote != null) { try { remote.sendText(message); remote.flushBatch(); } catch (RuntimeException rte) { if (rte.getMessage().equals("Socket is not connected.")) { remote = null; // retry! send(receiverUri, message, tag); } } } else { throw new IOException("Not connected?"); } }
From source file:com.almende.eve.transport.ws.WsClientTransport.java
@Override public void send(final URI receiverUri, final byte[] message, final String tag) throws IOException { if (!receiverUri.equals(serverUrl)) { throw new IOException( "Currently it's only possible to send to the server agent directly, not other agents:" + receiverUri.toASCIIString()); }/*from w w w. ja v a 2s . c om*/ if (remote == null || !isConnected()) { connect(); } if (remote != null) { try { remote.sendBinary(ByteBuffer.wrap(message)); remote.flushBatch(); } catch (RuntimeException rte) { if (rte.getMessage().equals("Socket is not connected.")) { remote = null; // retry! send(receiverUri, message, tag); } } } else { throw new IOException("Not connected?"); } }
From source file:com.subgraph.vega.internal.http.proxy.HttpProxyService.java
private void processTransaction(IProxyTransaction transaction) { synchronized (this) { if (transaction.getResponse() == null || contentAnalyzer == null || isPassthrough) { return; }//from w w w.j a v a2s .c om } try { contentAnalyzer.processResponse(transaction.getResponse()); } catch (RuntimeException e) { logger.log(Level.WARNING, "Exception processing transaction response: " + e.getMessage(), e); } }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmXMsgRspnHandler.CFCrmXMsgRspnAuditActionReadSingleHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/* w ww . ja v a2s . co m*/ // Common XML Attributes String attrId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnAuditActionReadSingle"); CFCrmXMsgRspnHandler xmsgRspnHandler = (CFCrmXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFCrmSchemaObj schemaObj = xmsgRspnHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types } catch (RuntimeException e) { throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmXMsgRspnHandler.CFCrmXMsgRspnClusterReadSingleHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/* ww w . ja v a2 s .c om*/ // Common XML Attributes String attrId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnClusterReadSingle"); CFCrmXMsgRspnHandler xmsgRspnHandler = (CFCrmXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFCrmSchemaObj schemaObj = xmsgRspnHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types } catch (RuntimeException e) { throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmXMsgRspnHandler.CFCrmXMsgRspnContactReadSingleHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {//from w w w . java 2 s .c o m // Common XML Attributes String attrId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnContactReadSingle"); CFCrmXMsgRspnHandler xmsgRspnHandler = (CFCrmXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFCrmSchemaObj schemaObj = xmsgRspnHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types } catch (RuntimeException e) { throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }