org.apache.hadoop.metrics.MetricsException Java Examples
The following examples show how to use
org.apache.hadoop.metrics.MetricsException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractMetricsContext.java From hadoop with Apache License 2.0 | 6 votes |
/** * Adds two numbers, coercing the second to the type of the first. * */ private Number sum(Number a, Number b) { if (a instanceof Integer) { return Integer.valueOf(a.intValue() + b.intValue()); } else if (a instanceof Float) { return new Float(a.floatValue() + b.floatValue()); } else if (a instanceof Short) { return Short.valueOf((short)(a.shortValue() + b.shortValue())); } else if (a instanceof Byte) { return Byte.valueOf((byte)(a.byteValue() + b.byteValue())); } else if (a instanceof Long) { return Long.valueOf((a.longValue() + b.longValue())); } else { // should never happen throw new MetricsException("Invalid number type"); } }
Example #2
Source File: AbstractMetricsContext.java From big-c with Apache License 2.0 | 6 votes |
/** * Adds two numbers, coercing the second to the type of the first. * */ private Number sum(Number a, Number b) { if (a instanceof Integer) { return Integer.valueOf(a.intValue() + b.intValue()); } else if (a instanceof Float) { return new Float(a.floatValue() + b.floatValue()); } else if (a instanceof Short) { return Short.valueOf((short)(a.shortValue() + b.shortValue())); } else if (a instanceof Byte) { return Byte.valueOf((byte)(a.byteValue() + b.byteValue())); } else if (a instanceof Long) { return Long.valueOf((a.longValue() + b.longValue())); } else { // should never happen throw new MetricsException("Invalid number type"); } }
Example #3
Source File: JMXContext.java From RDFS with Apache License 2.0 | 6 votes |
@Override public void init(String contextName, ContextFactory factory) { super.init(contextName, factory); initAllowedRecords(); String periodStr = getAttribute(PERIOD_PROPERTY); if (periodStr != null) { int period = 0; try { period = Integer.parseInt(periodStr); } catch (NumberFormatException nfe) { } if (period <= 0) { throw new MetricsException("Invalid period: " + periodStr); } setPeriod(period); } }
Example #4
Source File: AbstractMetricsContext.java From RDFS with Apache License 2.0 | 6 votes |
/** * Adds two numbers, coercing the second to the type of the first. * */ private Number sum(Number a, Number b) { if (a instanceof Integer) { return Integer.valueOf(a.intValue() + b.intValue()); } else if (a instanceof Float) { return new Float(a.floatValue() + b.floatValue()); } else if (a instanceof Short) { return Short.valueOf((short)(a.shortValue() + b.shortValue())); } else if (a instanceof Byte) { return Byte.valueOf((byte)(a.byteValue() + b.byteValue())); } else if (a instanceof Long) { return Long.valueOf((a.longValue() + b.longValue())); } else { // should never happen throw new MetricsException("Invalid number type"); } }
Example #5
Source File: AbstractMetricsContext.java From hadoop-gpu with Apache License 2.0 | 6 votes |
/** * Adds two numbers, coercing the second to the type of the first. * */ private Number sum(Number a, Number b) { if (a instanceof Integer) { return Integer.valueOf(a.intValue() + b.intValue()); } else if (a instanceof Float) { return new Float(a.floatValue() + b.floatValue()); } else if (a instanceof Short) { return Short.valueOf((short)(a.shortValue() + b.shortValue())); } else if (a instanceof Byte) { return Byte.valueOf((byte)(a.byteValue() + b.byteValue())); } else if (a instanceof Long) { return Long.valueOf((a.longValue() + b.longValue())); } else { // should never happen throw new MetricsException("Invalid number type"); } }
Example #6
Source File: NullContextWithUpdateThread.java From hadoop-gpu with Apache License 2.0 | 6 votes |
public void init(String contextName, ContextFactory factory) { super.init(contextName, factory); // If period is specified, use it, otherwise the default is good enough String periodStr = getAttribute(PERIOD_PROPERTY); if (periodStr != null) { int period = 0; try { period = Integer.parseInt(periodStr); } catch (NumberFormatException nfe) { } if (period <= 0) { throw new MetricsException("Invalid period: " + periodStr); } setPeriod(period); } }
Example #7
Source File: FileContext.java From hadoop-gpu with Apache License 2.0 | 6 votes |
public void init(String contextName, ContextFactory factory) { super.init(contextName, factory); String fileName = getAttribute(FILE_NAME_PROPERTY); if (fileName != null) { file = new File(fileName); } String periodStr = getAttribute(PERIOD_PROPERTY); if (periodStr != null) { int period = 0; try { period = Integer.parseInt(periodStr); } catch (NumberFormatException nfe) { } if (period <= 0) { throw new MetricsException("Invalid period: " + periodStr); } setPeriod(period); } }
Example #8
Source File: AbstractMetricsContext.java From hadoop with Apache License 2.0 | 5 votes |
/** * If a period is set in the attribute passed in, override * the default with it. */ protected void parseAndSetPeriod(String attributeName) { String periodStr = getAttribute(attributeName); if (periodStr != null) { int period = 0; try { period = Integer.parseInt(periodStr); } catch (NumberFormatException nfe) { } if (period <= 0) { throw new MetricsException("Invalid period: " + periodStr); } setPeriod(period); } }
Example #9
Source File: AbstractMetricsContext.java From big-c with Apache License 2.0 | 5 votes |
/** * If a period is set in the attribute passed in, override * the default with it. */ protected void parseAndSetPeriod(String attributeName) { String periodStr = getAttribute(attributeName); if (periodStr != null) { int period = 0; try { period = Integer.parseInt(periodStr); } catch (NumberFormatException nfe) { } if (period <= 0) { throw new MetricsException("Invalid period: " + periodStr); } setPeriod(period); } }
Example #10
Source File: AbstractMetricsContext.java From RDFS with Apache License 2.0 | 5 votes |
/** * If a period is set in the attribute passed in, override * the default with it. */ protected void parseAndSetPeriod(String attributeName) { String periodStr = getAttribute(attributeName); if (periodStr != null) { int period = 0; try { period = Integer.parseInt(periodStr); } catch (NumberFormatException nfe) { } if (period <= 0) { throw new MetricsException("Invalid period: " + periodStr); } setPeriod(period); } }
Example #11
Source File: GangliaContext.java From hadoop-gpu with Apache License 2.0 | 5 votes |
public void init(String contextName, ContextFactory factory) { super.init(contextName, factory); String periodStr = getAttribute(PERIOD_PROPERTY); if (periodStr != null) { int period = 0; try { period = Integer.parseInt(periodStr); } catch (NumberFormatException nfe) { } if (period <= 0) { throw new MetricsException("Invalid period: " + periodStr); } setPeriod(period); } metricsServers = Util.parse(getAttribute(SERVERS_PROPERTY), DEFAULT_PORT); unitsTable = getAttributeTable(UNITS_PROPERTY); slopeTable = getAttributeTable(SLOPE_PROPERTY); tmaxTable = getAttributeTable(TMAX_PROPERTY); dmaxTable = getAttributeTable(DMAX_PROPERTY); try { datagramSocket = new DatagramSocket(); } catch (SocketException se) { se.printStackTrace(); } }
Example #12
Source File: TaskTracker.java From RDFS with Apache License 2.0 | 4 votes |
/** * Build and transmit the heart beat to the JobTracker * @param jobClient The jobTracker RPC handle * @param heartbeatResponseId Last heartbeat response received * @param status TaskTrackerStatus to transmit * @return false if the tracker was unknown * @throws IOException */ protected HeartbeatResponse transmitHeartBeat( InterTrackerProtocol jobClient, short heartbeatResponseId, TaskTrackerStatus status) throws IOException { // // Check if we should ask for a new Task // boolean askForNewTask; long localMinSpaceStart; synchronized (this) { askForNewTask = ((status.countOccupiedMapSlots() < maxMapSlots || status.countOccupiedReduceSlots() < maxReduceSlots) && acceptNewTasks); localMinSpaceStart = minSpaceStart; } if (askForNewTask) { checkLocalDirs(fConf.getLocalDirs()); askForNewTask = enoughFreeSpace(localMinSpaceStart); gatherResourceStatus(status); } //add node health information TaskTrackerHealthStatus healthStatus = status.getHealthStatus(); synchronized (this) { if (healthChecker != null) { healthChecker.setHealthStatus(healthStatus); } else { healthStatus.setNodeHealthy(true); healthStatus.setLastReported(0L); healthStatus.setHealthReport(""); } } // // Xmit the heartbeat // HeartbeatResponse heartbeatResponse = jobClient.heartbeat(status, justStarted, justInited, askForNewTask, heartbeatResponseId); synchronized (this) { for (TaskStatus taskStatus : status.getTaskReports()) { if (taskStatus.getRunState() != TaskStatus.State.RUNNING && taskStatus.getRunState() != TaskStatus.State.UNASSIGNED && taskStatus.getRunState() != TaskStatus.State.COMMIT_PENDING && !taskStatus.inTaskCleanupPhase()) { if (taskStatus.getIsMap()) { mapTotal--; } else { reduceTotal--; } try { myInstrumentation.completeTask(taskStatus.getTaskID()); } catch (MetricsException me) { LOG.warn("Caught: " + StringUtils.stringifyException(me)); } removeRunningTask(taskStatus.getTaskID()); } } // Clear transient status information which should only // be sent once to the JobTracker for (TaskInProgress tip: runningTasks.values()) { tip.getStatus().clearStatus(); } } return heartbeatResponse; }