org.apache.commons.collections.BufferUtils Java Examples

The following examples show how to use org.apache.commons.collections.BufferUtils. 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: MqRunnerComponent.java    From AuTe-Framework with Apache License 2.0 5 votes vote down vote up
@PostConstruct
public void initMappings() {
    if (properties.isManagerNotDefined()) {
        log.warn("MQ manager not defined, skip JMS mappings initialization");
        return;
    }
    fifo = BufferUtils.synchronizedBuffer(new CircularFifoBuffer(properties.getRequestBufferSize()));
    repository.load().getMappings().forEach(this::applyMapping);
}
 
Example #2
Source File: ApiControllerTest.java    From AuTe-Framework with Apache License 2.0 5 votes vote down vote up
public ApiControllerTest() throws NoSuchFieldException, IllegalAccessException {
    MqRunnerComponent mqRunnerComponent = new MqRunnerComponent(new MqProperties(), new DummyJmsMappingsRepository());
    Field fifo = MqRunnerComponent.class.getDeclaredField("fifo");
    fifo.setAccessible(true);
    fifo.set(mqRunnerComponent, BufferUtils.synchronizedBuffer(new CircularFifoBuffer(BUFF_SIZE)));

    for (int i = 0; i < BUFF_SIZE; i++) {
        MockedRequest mockedRequest = new MockedRequest();
        mockedRequest.setDate(Date.from(LocalDateTime.of(2000 + i, 1, 1, 6, 30).atZone(ZoneId.systemDefault()).toInstant()));
        Buffer b = mqRunnerComponent.getFifo();
        b.add(mockedRequest);
    }

    apiController = new ApiController(mqRunnerComponent);
}
 
Example #3
Source File: CircularQueueLogAppender.java    From engine with GNU General Public License v3.0 5 votes vote down vote up
@PluginFactory
public static CircularQueueLogAppender createAppender(
    @PluginAttribute(value = "name") String name,
    @PluginElement(value = "Filters") Filter filter,
    @PluginElement(value = "Layout") Layout<? extends Serializable> layout,
    @PluginAttribute(value = "ignoreExceptions") boolean ignoreExceptions,
    @PluginAttribute(value = "maxQueueSize") int maxQueueSize,
    @PluginAttribute(value = "dateFormat") String dateFormat,
    @PluginAttribute(value = "global") boolean global) {

    if (StringUtils.isEmpty(name)) {
        LOGGER.error("No name provided for " + PLUGIN_NAME);
        return null;
    }

    if (Objects.isNull(layout)) {
        layout = PatternLayout.createDefaultLayout();
    }

    if (Objects.isNull(buffer)) {
        LOGGER.debug("Initializing circular log queue buffer");
        if (maxQueueSize <= 0) {
            throw new IllegalArgumentException("maxQueueSize must be a integer bigger that 0");
        }
        buffer = BufferUtils.synchronizedBuffer(new CircularFifoBuffer(maxQueueSize));
    }

    CircularQueueLogAppender appender = new CircularQueueLogAppender(name, filter, layout, ignoreExceptions, null);
    appender.dateFormat = DateTimeFormatter.ofPattern(dateFormat).withZone(ZoneId.of("UTC"));
    appender.global = global;

    return appender;
}
 
Example #4
Source File: NotificationList.java    From juddi with Apache License 2.0 4 votes vote down vote up
private NotificationList() {	
	list = BufferUtils.synchronizedBuffer(new CircularFifoBuffer(10));
}
 
Example #5
Source File: ChannelBuffer.java    From AIDR with GNU Affero General Public License v3.0 4 votes vote down vote up
public ChannelBuffer(final String name, final int bufferSize) {
	this.channelName = name;
	this.messageBuffer = BufferUtils.synchronizedBuffer(new CircularFifoBuffer(bufferSize));
	this.size = bufferSize;
}
 
Example #6
Source File: ChannelBuffer.java    From AIDR with GNU Affero General Public License v3.0 4 votes vote down vote up
public void createChannelBuffer() {
	this.messageBuffer = BufferUtils.synchronizedBuffer(new CircularFifoBuffer(MAX_BUFFER_SIZE));
	this.size = MAX_BUFFER_SIZE;
}
 
Example #7
Source File: ChannelBuffer.java    From AIDR with GNU Affero General Public License v3.0 4 votes vote down vote up
public void createChannelBuffer(final int bufferSize) {
	this.messageBuffer = BufferUtils.synchronizedBuffer(new CircularFifoBuffer(bufferSize));
	this.size = bufferSize;
}