use of org.apache.mina.filter.logging.LoggingFilter in project camel by apache.
the class Mina2Producer method setupVmProtocol.
// Implementation methods
//-------------------------------------------------------------------------
protected void setupVmProtocol(String uri) {
boolean minaLogger = configuration.isMinaLogger();
List<IoFilter> filters = configuration.getFilters();
address = new VmPipeAddress(configuration.getPort());
connector = new VmPipeConnector();
// connector config
if (minaLogger) {
connector.getFilterChain().addLast("logger", new LoggingFilter());
}
appendIoFiltersToChain(filters, connector.getFilterChain());
if (configuration.getSslContextParameters() != null) {
LOG.warn("Using vm protocol" + ", but an SSLContextParameters instance was provided. SSLContextParameters is only supported on the TCP protocol.");
}
configureCodecFactory("Mina2Producer", connector);
}
use of org.apache.mina.filter.logging.LoggingFilter in project camel by apache.
the class Mina2Producer method setupDatagramProtocol.
protected void setupDatagramProtocol(String uri) {
boolean minaLogger = configuration.isMinaLogger();
boolean transferExchange = configuration.isTransferExchange();
List<IoFilter> filters = configuration.getFilters();
if (transferExchange) {
throw new IllegalArgumentException("transferExchange=true is not supported for datagram protocol");
}
address = new InetSocketAddress(configuration.getHost(), configuration.getPort());
final int processorCount = Runtime.getRuntime().availableProcessors() + 1;
connector = new NioDatagramConnector(processorCount);
if (configuration.isOrderedThreadPoolExecutor()) {
workerPool = new OrderedThreadPoolExecutor(configuration.getMaximumPoolSize());
} else {
workerPool = new UnorderedThreadPoolExecutor(configuration.getMaximumPoolSize());
}
connectorConfig = connector.getSessionConfig();
connector.getFilterChain().addLast("threadPool", new ExecutorFilter(workerPool));
if (minaLogger) {
connector.getFilterChain().addLast("logger", new LoggingFilter());
}
appendIoFiltersToChain(filters, connector.getFilterChain());
if (configuration.getSslContextParameters() != null) {
LOG.warn("Using datagram protocol, " + configuration.getProtocol() + ", but an SSLContextParameters instance was provided. SSLContextParameters is only supported on the TCP protocol.");
}
configureDataGramCodecFactory("Mina2Producer", connector, configuration);
// set connect timeout to mina in seconds
connector.setConnectTimeoutMillis(timeout);
}
use of org.apache.mina.filter.logging.LoggingFilter in project opennms by OpenNMS.
the class AsyncSimpleServer method startServer.
/**
* <p>startServer</p>
*
* @throws java.lang.Exception if any.
*/
public void startServer() throws Exception {
m_acceptor = new NioSocketAcceptor();
m_acceptor.getFilterChain().addLast("logger", new LoggingFilter());
m_acceptor.getFilterChain().addLast("codec", new ProtocolCodecFilter(new TextLineCodecFactory(StandardCharsets.UTF_8)));
m_acceptor.setHandler(getServerHandler());
m_acceptor.getSessionConfig().setReadBufferSize(getBufferSize());
m_acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE, getIdleTime());
((NioSocketAcceptor) m_acceptor).setReuseAddress(true);
m_acceptor.bind(new InetSocketAddress(getPort()));
}
Aggregations