@Override public void writeValue(Exception newValue) { super.writeValue(newValue); exceptionHandler.handleException(newValue); }
/** * Posts a readTimeout exception in the exception queue. * * @param timeoutMessage the message for the readTimeout */ private void processReadTimeout(String timeoutMessage) { PVReaderImpl<T> pv = pvReaderRef.get(); if (pv != null && !pv.isSentFirsEvent()) { readExceptionCollector.writeValue(new TimeoutException(timeoutMessage)); } }
@Override public void update(SparklineGraph2DRendererUpdate update) { ((SparklineGraph2DFunction) getFunction()).getRendererUpdateQueue().writeValue(update); }
@Override public void update(LineGraph2DRendererUpdate update) { ((LineGraph2DFunction) getFunction()).getRendererUpdateQueue().writeValue(update); }
@Override public void update(BubbleGraph2DRendererUpdate update) { ((BubbleGraph2DFunction) getFunction()).getRendererUpdateQueue().writeValue(update); }
@Override public void update(LineGraph2DRendererUpdate update) { ((MultilineGraph2DFunction) getFunction()).getRendererUpdateQueue().writeValue(update); }
@Override public void update(IntensityGraph2DRendererUpdate update) { ((IntensityGraph2DFunction) getFunction()).getUpdateQueue().writeValue(update); }
@Override public void update(AreaGraph2DRendererUpdate update) { ((HistogramGraph2DFunction) getFunction()).getUpdateQueue().writeValue(update); }
@Override public void update(MultiAxisLineGraph2DRendererUpdate update) { ((MultiAxisLineGraph2DFunction) getFunction()).getRendererUpdateQueue().writeValue(update); }
/** * Disconnects the given expression. * <p> * This can be used for dynamic expression, to remove and disconnects child * expressions. * * @param expression the expression to disconnect */ public void disconnectExpression(WriteExpression<?> expression) { WriteRecipe recipe; synchronized(lock) { recipe = recipes.remove(expression); } if (recipe == null) { log.log(Level.SEVERE, "Director was asked to disconnect expression '" + expression + "' which was not found."); } if (!recipe.getChannelWriteRecipes().isEmpty()) { try { dataSource.disconnectWrite(recipe); } catch(Exception ex) { writeExceptionCollector.writeValue(ex); } updateWriteRecipe(); } }
/** * Simulate a static connection in which the channel name has one exception * and the connection will never change. * <p> * This is a temporary method an will be subject to change in the future. * The aim is to allow to connect expressions that are not channels * but can influence exception and connection state. For example, * to report problems encountered during expression creation as runtime * problems through the normal exception/connection methods. * <p> * In the future, this should be generalized to allow fully fledged expressions * that connect/disconnect and can report errors. * * @param ex the exception to queue * @param connection the connection flag * @param channelName the channel name */ public void connectStatic(Exception ex, boolean connection, String channelName) { writeExceptionCollector.writeValue(ex); writeConnCollector.addChannel(channelName).writeValue(connection); }
/** * Simulate a static connection in which the channel has one exception * and the connection will never change. * <p> * This is a temporary method an will be subject to change in the future. * The aim is to allow to connect expressions that are not channels * but can influence exception and connection state. For example, * to report problems encountered during expression creation as runtime * problems through the normal exception/connection methods. * <p> * In the future, this should be generalized to allow fully fledged expressions * that connect/disconnect and can report errors. * * @param ex the exception to queue * @param connection the connection flag * @param channelName the channel name */ public void connectStaticRead(Exception ex, boolean connection, String channelName) { readExceptionCollector.writeValue(ex); readConnCollector.addChannel(channelName).writeValue(connection); }
/** * Removes all the expressions currently in the map. * * @return this expression */ public ReadMap<T> clear() { synchronized(lock) { getMapOfFunction().getMapUpdateCollector().writeValue(MapUpdate.<T>clear()); if (director != null) { for (DesiredRateExpression<T> desiredRateExpression : expressions.values()) { director.disconnectReadExpression(desiredRateExpression); } } expressions.clear(); return this; } }
/** * Removes the expression with the given name. * * @param name the name of the expression to remove * @return this expression */ public WriteMap<T> remove(String name) { synchronized(lock) { if (!expressions.containsKey(name)) { throw new IllegalArgumentException("MapExpression does not contain an expression named '" + name + "'"); } getMapOfWriteFunction().getMapUpdateCollector().writeValue(MapUpdate.<T>removeFunction(name)); WriteExpression<T> expression = expressions.remove(name); if (director != null) { director.disconnectExpression(expression); } return this; } }
/** * Removes the expression with the given name. * * @param name the name of the expression to remove * @return this expression */ public ReadMap<T> remove(String name) { synchronized(lock) { if (!expressions.containsKey(name)) { throw new IllegalArgumentException("MapExpression does not contain an expression named '" + name + "'"); } getMapOfFunction().getMapUpdateCollector().writeValue(MapUpdate.<T>removeFunction(name)); DesiredRateExpression<T> expression = expressions.remove(name); if (director != null) { director.disconnectReadExpression(expression); } return this; } }
@Override public void update(ScatterGraph2DRendererUpdate update) { if (getFunction() instanceof ScatterGraph2DFunction) { ((ScatterGraph2DFunction) getFunction()).getRendererUpdateQueue().writeValue(update); } }
/** * Removes all the expressions currently in the map. * * @return this expression */ public WriteMap<T> clear() { synchronized(lock) { getMapOfWriteFunction().getMapUpdateCollector().writeValue(MapUpdate.<T>clear()); if (director != null) { for (WriteExpression<T> desiredRateExprewritession : expressions.values()) { director.disconnectExpression(desiredRateExprewritession); } } expressions.clear(); return this; } }
/** * Connects the given expression. * <p> * This can be used for dynamic expression to add and connect child expressions. * The added expression will be automatically closed when the associated * reader is closed, if it's not disconnected first. * * @param expression the expression to connect */ public void connectExpression(WriteExpression<?> expression) { WriteRecipeBuilder builder = new WriteRecipeBuilder(); expression.fillWriteRecipe(this, builder); WriteRecipe recipe = builder.build(writeExceptionCollector, writeConnCollector); synchronized(lock) { recipes.put(expression, recipe); } if (!recipe.getChannelWriteRecipes().isEmpty()) { try { dataSource.connectWrite(recipe); } catch(Exception ex) { writeExceptionCollector.writeValue(ex); } updateWriteRecipe(); } }
/** * Adds the expression to the map. * * @param expression the expression to be added * @return this expression */ public ReadMap<T> add(DesiredRateExpression<T> expression) { synchronized(lock) { if (expression.getName() == null) { throw new NullPointerException("Expression has a null name"); } if (expressions.containsKey(expression.getName())) { throw new IllegalArgumentException("MapExpression already contain an expression named '" + expression.getName() + "'"); } getMapOfFunction().getMapUpdateCollector().writeValue(MapUpdate.addReadFunction(expression.getName(), expression.getFunction())); expressions.put(expression.getName(), expression); if (director != null) { director.connectReadExpression(expression); } return this; } }
/** * Adds the expression to the map. * * @param expression the expression to be added * @return this expression */ public WriteMap<T> add(WriteExpression<T> expression) { synchronized(lock) { if (expression.getName() == null) { throw new NullPointerException("Expression has a null name"); } if (expressions.containsKey(expression.getName())) { throw new IllegalArgumentException("MapExpression already contain an expression named '" + expression.getName() + "'"); } getMapOfWriteFunction().getMapUpdateCollector().writeValue(MapUpdate.addWriteFunction(expression.getName(), expression.getWriteFunction())); expressions.put(expression.getName(), expression); if (director != null) { director.connectExpression(expression); } return this; } }