/** * Creates a new instance using an empty configuration. */ public PipeWriter(final String pipeName) { super(new Configuration()); this.pipe = Broker.INSTANCE.acquirePipe(pipeName); }
/** * Creates a new instance using an empty configuration. */ public PipeWriter(final String pipeName) { super(new Configuration()); this.pipe = Broker.INSTANCE.acquirePipe(pipeName); }
/** * Creates a new instance of this class using the given parameters. * * @param configuration * The configuration used to initialize the pipe writer. */ public PipeWriter(final Configuration configuration) { super(configuration); final String pipeName = configuration.getStringProperty(CONFIG_PIPENAME); if (pipeName.length() == 0) { throw new IllegalArgumentException("Invalid or missing value for property '" + CONFIG_PIPENAME + "': '" + pipeName + "'"); } this.pipe = Broker.INSTANCE.acquirePipe(pipeName); }
/** * Creates a new instance of this class using the given parameters. * * @param configuration * The configuration used to initialize the pipe writer. */ public PipeWriter(final Configuration configuration) { super(configuration); final String pipeName = configuration.getStringProperty(CONFIG_PIPENAME); if (pipeName.length() == 0) { throw new IllegalArgumentException("Invalid or missing value for property '" + CONFIG_PIPENAME + "': '" + pipeName + "'"); } this.pipe = Broker.INSTANCE.acquirePipe(pipeName); }
/** * Creates a new instance of this class using the given parameters. * * @param configuration * The configuration for this component. * @param projectContext * The project context for this component. */ public PipeReader(final String pipeName) { this.pipe = Broker.INSTANCE.acquirePipe(pipeName); if (this.pipe == null) { throw new IllegalArgumentException("Failed to get Pipe with name " + pipeName); } else { if (this.logger.isDebugEnabled()) { this.logger.debug("Connected to named pipe '" + this.pipe.getName() + "'"); } } // escaping this in constructor! very bad practice! this.pipe.setPipeReader(this); }
/** * Creates a new instance of this class using the given parameters. * * @param configuration * The configuration for this component. * @param projectContext * The project context for this component. */ public PipeReader(final Configuration configuration, final IProjectContext projectContext) { super(configuration, projectContext); final String pipeNameConfig = this.configuration.getStringProperty(CONFIG_PROPERTY_NAME_PIPENAME); this.pipeName = pipeNameConfig; this.pipe = Broker.INSTANCE.acquirePipe(pipeNameConfig); if (this.pipe == null) { throw new IllegalArgumentException("Failed to get Pipe with name " + pipeNameConfig); } else { this.logger.debug("Connected to named pipe '{}'", this.pipe.getName()); } // escaping this in constructor! very bad practice! this.pipe.setPipeReader(this); }
/** * Creates an {@link kieker.common.namedRecordPipe.IPipeReader IPipeReader} that collects records from a * {@link Pipe} and collects these in the returned {@link List}. * * @param pipeName * The name of the pipe to use. * @return a synchronized list which contains the collected records */ public static List<IMonitoringRecord> createAndRegisterNamedPipeRecordCollector(final String pipeName) { final List<IMonitoringRecord> receivedRecords = Collections .synchronizedList(new ArrayList<IMonitoringRecord>()); final Pipe namedPipe = Broker.INSTANCE.acquirePipe(pipeName); namedPipe.setPipeReader(new IPipeReader() { @Override public void notifyPipeClosed() { // do nothing } @Override public boolean newMonitoringRecord(final IMonitoringRecord record) { return receivedRecords.add(record); } }); return receivedRecords; } }
/** * Creates a new instance of this class using the given parameters. * * @param configuration * The configuration for this component. * @param projectContext * The project context for this component. */ public PipeReader(final Configuration configuration, final IProjectContext projectContext) { super(configuration, projectContext); final String pipeNameConfig = this.configuration.getStringProperty(CONFIG_PROPERTY_NAME_PIPENAME); this.pipeName = pipeNameConfig; this.pipe = Broker.INSTANCE.acquirePipe(pipeNameConfig); if (this.pipe == null) { throw new IllegalArgumentException("Failed to get Pipe with name " + pipeNameConfig); } else { if (this.log.isDebugEnabled()) { this.log.debug("Connected to named pipe '" + this.pipe.getName() + "'"); } } // escaping this in constructor! very bad practice! this.pipe.setPipeReader(this); }