This is an automated email from the ASF dual-hosted git repository. elecharny pushed a commit to branch 2.1.X in repository https://gitbox.apache.org/repos/asf/mina.git
The following commit(s) were added to refs/heads/2.1.X by this push: new 7eaca7dcc o Bumped up dependencies and maven polugins o Fixed javadoc o Fixed an OSGi issue o Added a missing ASL2.0 header 7eaca7dcc is described below commit 7eaca7dcc3d5d6dc39e179bd46e2030c00c8b3ac Author: emmanuel lecharny <elecha...@apache.org> AuthorDate: Sun Sep 3 05:26:38 2023 +0200 o Bumped up dependencies and maven polugins o Fixed javadoc o Fixed an OSGi issue o Added a missing ASL2.0 header --- mina-core/pom.xml | 2 +- .../java/org/apache/mina/core/buffer/IoBuffer.java | 3 +- .../mina/core/session/ExpiringSessionRecycler.java | 14 +- .../mina/core/session/IoSessionRecycler.java | 5 +- .../executor/PriorityThreadPoolExecutor.java | 192 +++++++-------- .../transport/socket/nio/NioDatagramAcceptor.java | 2 +- .../filter/ssl/SslIdentificationAlgorithmTest.java | 2 + .../mina/transport/socket/nio/DIRMINA1172Test.java | 264 +++++++++++++++++++++ pom.xml | 88 +++---- 9 files changed, 424 insertions(+), 148 deletions(-) diff --git a/mina-core/pom.xml b/mina-core/pom.xml index 6189ab6c8..79ce1134b 100644 --- a/mina-core/pom.xml +++ b/mina-core/pom.xml @@ -94,7 +94,7 @@ org.apache.mina.transport.socket;version=${project.version};-noimport:=true, org.apache.mina.transport.socket.nio;version=${project.version};-noimport:=true, org.apache.mina.transport.vmpipe;version=${project.version};-noimport:=true, - org.apache.mina.util;version=${project.version};-noimport:=true + org.apache.mina.util;version=${project.version};-noimport:=true, org.apache.mina.util.byteaccess;version=${project.version};-noimport:=true </Export-Package> <Import-Package> diff --git a/mina-core/src/main/java/org/apache/mina/core/buffer/IoBuffer.java b/mina-core/src/main/java/org/apache/mina/core/buffer/IoBuffer.java index 7927a4383..ebc6db728 100644 --- a/mina-core/src/main/java/org/apache/mina/core/buffer/IoBuffer.java +++ b/mina-core/src/main/java/org/apache/mina/core/buffer/IoBuffer.java @@ -1542,7 +1542,8 @@ public abstract class IoBuffer implements Comparable<IoBuffer> { * * @param length The maximum number of bytes to dump from the current buffer * position. - * @return hexidecimal representation of this buffer + * @param pretty If we should do a pretty dump + * @return hexadecimal representation of this buffer */ public String getHexDump(int length, boolean pretty) { return (pretty) ? IoBufferHexDumper.getPrettyHexDumpSlice(this, this.position(), Math.min(this.remaining(), length)) diff --git a/mina-core/src/main/java/org/apache/mina/core/session/ExpiringSessionRecycler.java b/mina-core/src/main/java/org/apache/mina/core/session/ExpiringSessionRecycler.java index 54d58a2b1..1db949da6 100644 --- a/mina-core/src/main/java/org/apache/mina/core/session/ExpiringSessionRecycler.java +++ b/mina-core/src/main/java/org/apache/mina/core/session/ExpiringSessionRecycler.java @@ -19,6 +19,7 @@ */ package org.apache.mina.core.session; +import java.net.InetSocketAddress; import java.net.SocketAddress; import org.apache.mina.util.ExpirationListener; @@ -32,10 +33,10 @@ import org.apache.mina.util.ExpiringMap; */ public class ExpiringSessionRecycler implements IoSessionRecycler { /** A map used to store the session */ - private ExpiringMap<SocketAddress, IoSession> sessionMap; + private ExpiringMap<String, IoSession> sessionMap; /** A map used to keep a track of the expiration */ - private ExpiringMap<SocketAddress, IoSession>.Expirer mapExpirer; + private ExpiringMap<String, IoSession>.Expirer mapExpirer; /** * Create a new ExpiringSessionRecycler instance @@ -72,7 +73,7 @@ public class ExpiringSessionRecycler implements IoSessionRecycler { public void put(IoSession session) { mapExpirer.startExpiringIfNotStarted(); - SocketAddress key = session.getRemoteAddress(); + String key = session.getRemoteAddress() + ":" + ((InetSocketAddress)session.getLocalAddress()).getPort(); if (!sessionMap.containsKey(key)) { sessionMap.put(key, session); @@ -83,8 +84,9 @@ public class ExpiringSessionRecycler implements IoSessionRecycler { * {@inheritDoc} */ @Override - public IoSession recycle(SocketAddress remoteAddress) { - return sessionMap.get(remoteAddress); + public IoSession recycle(SocketAddress remoteAddress, int port) { + String key = remoteAddress + ":" + port; + return sessionMap.get(key); } /** @@ -92,7 +94,7 @@ public class ExpiringSessionRecycler implements IoSessionRecycler { */ @Override public void remove(IoSession session) { - sessionMap.remove(session.getRemoteAddress()); + sessionMap.remove(session.getRemoteAddress() + ":" + ((InetSocketAddress)session.getLocalAddress()).getPort()); } /** diff --git a/mina-core/src/main/java/org/apache/mina/core/session/IoSessionRecycler.java b/mina-core/src/main/java/org/apache/mina/core/session/IoSessionRecycler.java index f7c3b219c..d166967ac 100644 --- a/mina-core/src/main/java/org/apache/mina/core/session/IoSessionRecycler.java +++ b/mina-core/src/main/java/org/apache/mina/core/session/IoSessionRecycler.java @@ -48,7 +48,7 @@ public interface IoSessionRecycler { * {@inheritDoc} */ @Override - public IoSession recycle(SocketAddress remoteAddress) { + public IoSession recycle(SocketAddress remoteAddress, int port) { return null; } @@ -72,9 +72,10 @@ public interface IoSessionRecycler { * Attempts to retrieve a recycled {@link IoSession}. * * @param remoteAddress the remote socket address of the {@link IoSession} the transport wants to recycle. + * @param port The port the Acceptor is listening on* @param port The port the Acceptor is listening on * @return a recycled {@link IoSession}, or null if one cannot be found. */ - IoSession recycle(SocketAddress remoteAddress); + IoSession recycle(SocketAddress remoteAddress, int port); /** * Called when an {@link IoSession} is explicitly closed. diff --git a/mina-core/src/main/java/org/apache/mina/filter/executor/PriorityThreadPoolExecutor.java b/mina-core/src/main/java/org/apache/mina/filter/executor/PriorityThreadPoolExecutor.java index 43ace103a..6a37ca4b7 100644 --- a/mina-core/src/main/java/org/apache/mina/filter/executor/PriorityThreadPoolExecutor.java +++ b/mina-core/src/main/java/org/apache/mina/filter/executor/PriorityThreadPoolExecutor.java @@ -101,12 +101,18 @@ public class PriorityThreadPoolExecutor extends ThreadPoolExecutor { private final IoEventQueueHandler eventQueueHandler; + /** The session comparator */ private final Comparator<IoSession> comparator; /** - * Creates a default ThreadPool, with default values : - minimum pool size is 0 - * - maximum pool size is 16 - keepAlive set to 30 seconds - A default - * ThreadFactory - All events are accepted + * Creates a default ThreadPool, with default values : + * <ul> + * <li>minimum pool size is 0</li> + * <li>maximum pool size is 16</li> + * <li>keepAlive set to 30 seconds</li> + * <li>A default ThreadFactory</li> + * <li>All events are accepted</li> + * </ul> */ public PriorityThreadPoolExecutor() { this(DEFAULT_INITIAL_THREAD_POOL_SIZE, DEFAULT_MAX_THREAD_POOL, DEFAULT_KEEP_ALIVE, TimeUnit.SECONDS, @@ -114,9 +120,15 @@ public class PriorityThreadPoolExecutor extends ThreadPoolExecutor { } /** - * Creates a default ThreadPool, with default values : - minimum pool size is 0 - * - maximum pool size is 16 - keepAlive set to 30 seconds - A default - * ThreadFactory - All events are accepted + * Creates a default ThreadPool, with default values : + * <ul> + * <li>minimum pool size is 0</li> + * <li>maximum pool size is 16</li> + * <li>keepAlive set to 30 seconds</li> + * <li>A default ThreadFactory</li> + * <li>All events are accepted</li> + * </ul> + * @param comparator A session comparator */ public PriorityThreadPoolExecutor(Comparator<IoSession> comparator) { this(DEFAULT_INITIAL_THREAD_POOL_SIZE, DEFAULT_MAX_THREAD_POOL, DEFAULT_KEEP_ALIVE, TimeUnit.SECONDS, @@ -124,12 +136,14 @@ public class PriorityThreadPoolExecutor extends ThreadPoolExecutor { } /** - * Creates a default ThreadPool, with default values : - minimum pool size is 0 - * - keepAlive set to 30 seconds - A default ThreadFactory - All events are - * accepted - * - * @param maximumPoolSize - * The maximum pool size + * Creates a default ThreadPool, with default values : + * <ul> + * <li>minimum pool size is 0</li> + * <li>keepAlive set to 30 seconds</li> + * <li>A default ThreadFactory</li> + * <li>All events are accepted</li> + * </ul> + * @param maximumPoolSize The maximum pool size */ public PriorityThreadPoolExecutor(int maximumPoolSize) { this(DEFAULT_INITIAL_THREAD_POOL_SIZE, maximumPoolSize, DEFAULT_KEEP_ALIVE, TimeUnit.SECONDS, @@ -137,12 +151,16 @@ public class PriorityThreadPoolExecutor extends ThreadPoolExecutor { } /** - * Creates a default ThreadPool, with default values : - minimum pool size is 0 - * - keepAlive set to 30 seconds - A default ThreadFactory - All events are - * accepted + * Creates a default ThreadPool, with default values : + * <ul> + * <li>maximum pool size is 16</li> + * <li>keepAlive set to 30 seconds</li> + * <li>A default ThreadFactory</li> + * <li>All events are accepted</li> + * </ul> * - * @param maximumPoolSize - * The maximum pool size + * @param maximumPoolSize The maximum pool size + * @param comparator A session comparator */ public PriorityThreadPoolExecutor(int maximumPoolSize, Comparator<IoSession> comparator) { this(DEFAULT_INITIAL_THREAD_POOL_SIZE, maximumPoolSize, DEFAULT_KEEP_ALIVE, TimeUnit.SECONDS, @@ -150,92 +168,80 @@ public class PriorityThreadPoolExecutor extends ThreadPoolExecutor { } /** - * Creates a default ThreadPool, with default values : - keepAlive set to 30 - * seconds - A default ThreadFactory - All events are accepted + * Creates a default ThreadPool, with default values : + * <ul> + * <li>keepAlive set to 30 seconds</li> + * <li>A default ThreadFactory</li> + * <li>All events are accepted</li> + * </ul> * - * @param corePoolSize - * The initial pool sizePoolSize - * @param maximumPoolSize - * The maximum pool size + * @param minimumPoolSize The initial pool size + * @param maximumPoolSize The maximum pool size */ - public PriorityThreadPoolExecutor(int corePoolSize, int maximumPoolSize) { - this(corePoolSize, maximumPoolSize, DEFAULT_KEEP_ALIVE, TimeUnit.SECONDS, Executors.defaultThreadFactory(), + public PriorityThreadPoolExecutor(int minimumPoolSize, int maximumPoolSize) { + this(minimumPoolSize, maximumPoolSize, DEFAULT_KEEP_ALIVE, TimeUnit.SECONDS, Executors.defaultThreadFactory(), null, null); } /** - * Creates a default ThreadPool, with default values : - A default ThreadFactory - * - All events are accepted + * Creates a default ThreadPool, with default values : + * <ul> + * <li>minimum pool size is 0</li> + * <li>A default ThreadFactory</li> + * </ul> * - * @param corePoolSize - * The initial pool sizePoolSize - * @param maximumPoolSize - * The maximum pool size - * @param keepAliveTime - * Default duration for a thread - * @param unit - * Time unit used for the keepAlive value + * @param minimumPoolSize The initial pool size + * @param maximumPoolSize The maximum pool size + * @param keepAliveTime Default duration for a thread + * @param unit Time unit used for the keepAlive value */ - public PriorityThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit) { - this(corePoolSize, maximumPoolSize, keepAliveTime, unit, Executors.defaultThreadFactory(), null, null); + public PriorityThreadPoolExecutor(int minimumPoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit) { + this(minimumPoolSize, maximumPoolSize, keepAliveTime, unit, Executors.defaultThreadFactory(), null, null); } /** - * Creates a default ThreadPool, with default values : - A default ThreadFactory + * Creates a default ThreadPool, with default values : + * <ul> + * <li>A default ThreadFactory</li> + * </ul> * - * @param corePoolSize - * The initial pool sizePoolSize - * @param maximumPoolSize - * The maximum pool size - * @param keepAliveTime - * Default duration for a thread - * @param unit - * Time unit used for the keepAlive value - * @param eventQueueHandler - * The queue used to store events - */ - public PriorityThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, + * @param minimumPoolSize The initial pool size + * @param maximumPoolSize The maximum pool size + * @param keepAliveTime Default duration for a thread + * @param unit Time unit used for the keepAlive value + * @param eventQueueHandler The queue used to store events + */ + public PriorityThreadPoolExecutor(int minimumPoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, IoEventQueueHandler eventQueueHandler) { - this(corePoolSize, maximumPoolSize, keepAliveTime, unit, Executors.defaultThreadFactory(), eventQueueHandler, + this(minimumPoolSize, maximumPoolSize, keepAliveTime, unit, Executors.defaultThreadFactory(), eventQueueHandler, null); } /** - * Creates a default ThreadPool, with default values : - A default ThreadFactory + * Creates a default ThreadPool * - * @param corePoolSize - * The initial pool sizePoolSize - * @param maximumPoolSize - * The maximum pool size - * @param keepAliveTime - * Default duration for a thread - * @param unit - * Time unit used for the keepAlive value - * @param threadFactory - * The factory used to create threads - */ - public PriorityThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, + * @param minimumPoolSize The initial pool size + * @param maximumPoolSize The maximum pool size + * @param keepAliveTime Default duration for a thread + * @param unit Time unit used for the keepAlive value + * @param threadFactory The factory used to create threads + */ + public PriorityThreadPoolExecutor(int minimumPoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, ThreadFactory threadFactory) { - this(corePoolSize, maximumPoolSize, keepAliveTime, unit, threadFactory, null, null); + this(minimumPoolSize, maximumPoolSize, keepAliveTime, unit, threadFactory, null, null); } /** * Creates a new instance of a PrioritisedOrderedThreadPoolExecutor. - * - * @param corePoolSize - * The initial pool sizePoolSize - * @param maximumPoolSize - * The maximum pool size - * @param keepAliveTime - * Default duration for a thread - * @param unit - * Time unit used for the keepAlive value - * @param threadFactory - * The factory used to create threads - * @param eventQueueHandler - * The queue used to store events - */ - public PriorityThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, + * @param minimumPoolSize The initial pool sizePoolSize + * @param maximumPoolSize The maximum pool size + * @param keepAliveTime Default duration for a thread + * @param unit Time unit used for the keepAlive value + * @param threadFactory The factory used to create threads + * @param eventQueueHandler The queue used to store events + * @param comparator A session comparator + */ + public PriorityThreadPoolExecutor(int minimumPoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, ThreadFactory threadFactory, IoEventQueueHandler eventQueueHandler, Comparator<IoSession> comparator) { // We have to initialize the pool with default values (0 and 1) in order // to @@ -245,17 +251,17 @@ public class PriorityThreadPoolExecutor extends ThreadPoolExecutor { super(DEFAULT_INITIAL_THREAD_POOL_SIZE, 1, keepAliveTime, unit, new SynchronousQueue<Runnable>(), threadFactory, new AbortPolicy()); - if (corePoolSize < DEFAULT_INITIAL_THREAD_POOL_SIZE) { - throw new IllegalArgumentException("corePoolSize: " + corePoolSize); + if (minimumPoolSize < DEFAULT_INITIAL_THREAD_POOL_SIZE) { + throw new IllegalArgumentException("minimumPoolSize: " + minimumPoolSize); } - if ((maximumPoolSize <= 0) || (maximumPoolSize < corePoolSize)) { + if ((maximumPoolSize <= 0) || (maximumPoolSize < minimumPoolSize)) { throw new IllegalArgumentException("maximumPoolSize: " + maximumPoolSize); } // Now, we can setup the pool sizes super.setMaximumPoolSize(maximumPoolSize); - super.setCorePoolSize(corePoolSize); + super.setCorePoolSize(minimumPoolSize); // The queueHandler might be null. if (eventQueueHandler == null) { @@ -708,21 +714,21 @@ public class PriorityThreadPoolExecutor extends ThreadPoolExecutor { * {@inheritDoc} */ @Override - public void setCorePoolSize(int corePoolSize) { - if (corePoolSize < 0) { - throw new IllegalArgumentException("corePoolSize: " + corePoolSize); + public void setCorePoolSize(int minimumPoolSize) { + if (minimumPoolSize < 0) { + throw new IllegalArgumentException("minimumPoolSize: " + minimumPoolSize); } - if (corePoolSize > super.getMaximumPoolSize()) { - throw new IllegalArgumentException("corePoolSize exceeds maximumPoolSize"); + if (minimumPoolSize > super.getMaximumPoolSize()) { + throw new IllegalArgumentException("minimumPoolSize exceeds maximumPoolSize"); } synchronized (workers) { - if (super.getCorePoolSize() > corePoolSize) { - for (int i = super.getCorePoolSize() - corePoolSize; i > 0; i--) { + if (super.getCorePoolSize() > minimumPoolSize) { + for (int i = super.getCorePoolSize() - minimumPoolSize; i > 0; i--) { removeWorker(); } } - super.setCorePoolSize(corePoolSize); + super.setCorePoolSize(minimumPoolSize); } } @@ -895,7 +901,7 @@ public class PriorityThreadPoolExecutor extends ThreadPoolExecutor { int res = 0; - // If there's a comparator, use it to prioritise events. + // If there's a comparator, use it to prioritize events. if (comparator != null) { res = comparator.compare(session, other.session); } diff --git a/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramAcceptor.java b/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramAcceptor.java index 52d5d253c..a1f3fdfe4 100644 --- a/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramAcceptor.java +++ b/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramAcceptor.java @@ -327,7 +327,7 @@ public final class NioDatagramAcceptor extends AbstractIoAcceptor implements Dat IoSession session; synchronized (sessionRecycler) { - session = sessionRecycler.recycle(remoteAddress); + session = sessionRecycler.recycle(remoteAddress, ((InetSocketAddress)localAddress).getPort()); if (session != null) { return session; diff --git a/mina-core/src/test/java/org/apache/mina/filter/ssl/SslIdentificationAlgorithmTest.java b/mina-core/src/test/java/org/apache/mina/filter/ssl/SslIdentificationAlgorithmTest.java index 93151b135..992b6c57a 100644 --- a/mina-core/src/test/java/org/apache/mina/filter/ssl/SslIdentificationAlgorithmTest.java +++ b/mina-core/src/test/java/org/apache/mina/filter/ssl/SslIdentificationAlgorithmTest.java @@ -94,6 +94,8 @@ public class SslIdentificationAlgorithmTest { /** * Subject Alternative Name (SAN) scenarios + * + * @exception */ @Test public void shouldAuthenticateWhenServerCertificateAlternativeNameMatchesClientSNIExactly() throws Exception { diff --git a/mina-core/src/test/java/org/apache/mina/transport/socket/nio/DIRMINA1172Test.java b/mina-core/src/test/java/org/apache/mina/transport/socket/nio/DIRMINA1172Test.java new file mode 100644 index 000000000..8465d7fd5 --- /dev/null +++ b/mina-core/src/test/java/org/apache/mina/transport/socket/nio/DIRMINA1172Test.java @@ -0,0 +1,264 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.mina.transport.socket.nio; + +import java.io.IOException; +import java.net.DatagramPacket; +import java.net.DatagramSocket; +import java.net.InetAddress; +import java.net.InetSocketAddress; + +import org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder; +import org.apache.mina.core.service.AbstractIoService; +import org.apache.mina.core.service.IoHandler; +import org.apache.mina.core.session.IdleStatus; +import org.apache.mina.core.session.IoSession; +import org.apache.mina.filter.FilterEvent; +import org.apache.mina.filter.logging.LoggingFilter; +import org.junit.Before; +import org.junit.Test; + +/** + * Tests for issue with Datagram sessions (DIRMINA-1172) + * + * @author <a href="http://mina.apache.org">Apache MINA Project</a> + */ +public class DIRMINA1172Test +{ + private static DatagramSocket socket; + private static InetAddress address; + private static byte[] buf; + + @Before + public void init() + { + AbstractIoService inputSource1 = new NioDatagramAcceptor(); + ((NioDatagramAcceptor) inputSource1).getSessionConfig().setReuseAddress(true); + DefaultIoFilterChainBuilder filterChainBuilderUDP = ((NioDatagramAcceptor)inputSource1).getFilterChain(); + filterChainBuilderUDP.addLast("logger", new LoggingFilter()); + + ((NioDatagramAcceptor) inputSource1).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 100000); + ((NioDatagramAcceptor) inputSource1).setHandler( new IoHandler() + { + + @Override + public void sessionOpened( IoSession session ) throws Exception + { + // TODO Auto-generated method stub + + } + + + @Override + public void sessionIdle( IoSession session, IdleStatus status ) throws Exception + { + // TODO Auto-generated method stub + + } + + + @Override + public void sessionCreated( IoSession session ) throws Exception + { + // TODO Auto-generated method stub + + } + + + @Override + public void sessionClosed( IoSession session ) throws Exception + { + // TODO Auto-generated method stub + + } + + + @Override + public void messageSent( IoSession session, Object message ) throws Exception + { + // TODO Auto-generated method stub + + } + + + @Override + public void messageReceived( IoSession session, Object message ) throws Exception + { + // TODO Auto-generated method stub + System.out.println( "1"+session ); + + } + + + @Override + public void inputClosed( IoSession session ) throws Exception + { + // TODO Auto-generated method stub + + } + + + @Override + public void exceptionCaught( IoSession session, Throwable cause ) throws Exception + { + // TODO Auto-generated method stub + + } + + + @Override + public void event( IoSession session, FilterEvent event ) throws Exception + { + // TODO Auto-generated method stub + + } + }); + + AbstractIoService inputSource2 = new NioDatagramAcceptor(); + ((NioDatagramAcceptor) inputSource2).getSessionConfig().setReuseAddress(true); + DefaultIoFilterChainBuilder filterChainBuilderUDP2 = ((NioDatagramAcceptor)inputSource2).getFilterChain(); + filterChainBuilderUDP2.addLast("logger", new LoggingFilter()); + + ((NioDatagramAcceptor) inputSource2).getSessionConfig().setIdleTime(IdleStatus.READER_IDLE, 100000); + ((NioDatagramAcceptor) inputSource2).setHandler( new IoHandler() + { + + @Override + public void sessionOpened( IoSession session ) throws Exception + { + // TODO Auto-generated method stub + + } + + + @Override + public void sessionIdle( IoSession session, IdleStatus status ) throws Exception + { + // TODO Auto-generated method stub + + } + + + @Override + public void sessionCreated( IoSession session ) throws Exception + { + // TODO Auto-generated method stub + + } + + + @Override + public void sessionClosed( IoSession session ) throws Exception + { + // TODO Auto-generated method stub + + } + + + @Override + public void messageSent( IoSession session, Object message ) throws Exception + { + // TODO Auto-generated method stub + + } + + + @Override + public void messageReceived( IoSession session, Object message ) throws Exception + { + // TODO Auto-generated method stub + System.out.println( "2:"+session ); + + } + + + @Override + public void inputClosed( IoSession session ) throws Exception + { + // TODO Auto-generated method stub + + } + + + @Override + public void exceptionCaught( IoSession session, Throwable cause ) throws Exception + { + // TODO Auto-generated method stub + + } + + + @Override + public void event( IoSession session, FilterEvent event ) throws Exception + { + // TODO Auto-generated method stub + + } + }); + + try { + ((NioDatagramAcceptor)inputSource1).bind(new InetSocketAddress(9800)); + ((NioDatagramAcceptor)inputSource2).bind(new InetSocketAddress(9801)); + } catch (IOException e) { + //log.error("Failed to connect {}", e); + } + } + + @Test + public void test() throws InterruptedException, IOException + { + socket = new DatagramSocket(); + address = InetAddress.getByName("localhost"); + + int[] ports = new int[]{9800, 9801}; + + while(true) { + + for (int port : ports ) { + String msg = "TEST_" + port + " " + String.valueOf(System.currentTimeMillis()); + buf = msg.getBytes(); + DatagramPacket packet = new DatagramPacket(buf, buf.length, address, port); + socket.send(packet); + System.out.println("Send: " + msg); + } + + Thread.sleep(5000); + } + } +} diff --git a/pom.xml b/pom.xml index 3ddc381a6..6dfb4b756 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.apache</groupId> <artifactId>apache</artifactId> - <version>24</version> + <version>30</version> <relativePath /> </parent> @@ -94,51 +94,51 @@ <!-- additionalparam>-Xdoclint:none</additionalparam --> <!-- Maven Plugins --> - <version.apache.rat.plugin>0.13</version.apache.rat.plugin> - <version.api.plugin>3.6.3</version.api.plugin> - <version.assembly.plugin>3.3.0</version.assembly.plugin> - <version.build.helper.plugin>3.2.0</version.build.helper.plugin> - <version.bundle.plugin>4.1.0</version.bundle.plugin> + <version.apache.rat.plugin>0.15</version.apache.rat.plugin> + <version.api.plugin>3.9.4</version.api.plugin> + <version.assembly.plugin>3.6.0</version.assembly.plugin> + <version.build.helper.plugin>3.4.0</version.build.helper.plugin> + <version.bundle.plugin>5.1.9</version.bundle.plugin> <version.changes.plugin>2.12.1</version.changes.plugin> - <version.checkstyle.plugin>3.1.2</version.checkstyle.plugin> - <version.clean.plugin>3.1.0</version.clean.plugin> + <version.checkstyle.plugin>3.3.0</version.checkstyle.plugin> + <version.clean.plugin>3.3.1</version.clean.plugin> <version.clirr.plugin>2.8</version.clirr.plugin> <version.cobertura.plugin>2.7</version.cobertura.plugin> - <version.compiler.plugin>3.8.1</version.compiler.plugin> + <version.compiler.plugin>3.11.0</version.compiler.plugin> <version.dashboard.plugin>1.0.0-beta-1</version.dashboard.plugin> - <version.dependency.plugin>3.1.2</version.dependency.plugin> - <version.deploy.plugin>3.0.0-M1</version.deploy.plugin> + <version.dependency.plugin>3.6.0</version.dependency.plugin> + <version.deploy.plugin>3.1.1</version.deploy.plugin> <version.docck.plugin>1.1</version.docck.plugin> <version.eclipse.plugin>2.10</version.eclipse.plugin> - <version.enforcer.plugin>3.0.0-M3</version.enforcer.plugin> + <version.enforcer.plugin>3.4.0</version.enforcer.plugin> <version.findbugs.plugin>3.0.5</version.findbugs.plugin> - <version.gpg.plugin>1.6</version.gpg.plugin> - <version.install.plugin>3.0.0-M1</version.install.plugin> - <version.jar.plugin>3.2.0</version.jar.plugin> + <version.gpg.plugin>3.1.0</version.gpg.plugin> + <version.install.plugin>3.1.1</version.install.plugin> + <version.jar.plugin>3.3.0</version.jar.plugin> <version.javancss.plugin>2.1</version.javancss.plugin> - <version.javadoc.plugin>3.2.0</version.javadoc.plugin> + <version.javadoc.plugin>3.5.0</version.javadoc.plugin> <version.jdepend.plugin>2.0</version.jdepend.plugin> - <version.jxr.plugin>3.1.1</version.jxr.plugin> - <version.model.plugin>3.6.3</version.model.plugin> - <version.plexus.utils>3.3.0</version.plexus.utils> - <version.plugin.plugin>3.6.1</version.plugin.plugin> - <version.pmd.plugin>3.14.0</version.pmd.plugin> + <version.jxr.plugin>3.3.0</version.jxr.plugin> + <version.model.plugin>3.9.4</version.model.plugin> + <version.plexus.utils>4.0.0</version.plexus.utils> + <version.plugin.plugin>3.9.0</version.plugin.plugin> + <version.pmd.plugin>3.21.0</version.pmd.plugin> <version.project.plugin>3.0-alpha-2</version.project.plugin> - <version.project.info.report.plugin>3.1.2</version.project.info.report.plugin> + <version.project.info.report.plugin>3.4.5</version.project.info.report.plugin> <version.rat.maven.plugin>1.0-alpha-3</version.rat.maven.plugin> - <version.release.plugin>3.0.0-M5</version.release.plugin> - <version.remote.resources.plugin>1.7.0</version.remote.resources.plugin> - <version.resources.plugin>3.2.0</version.resources.plugin> - <version.scm.plugin>1.11.2</version.scm.plugin> + <version.release.plugin>3.0.1</version.release.plugin> + <version.remote.resources.plugin>3.1.0</version.remote.resources.plugin> + <version.resources.plugin>3.3.1</version.resources.plugin> + <version.scm.plugin>2.0.1</version.scm.plugin> <version.site.plugin>3.9.1</version.site.plugin> - <version.source.plugin>3.2.1</version.source.plugin> - <version.shade.plugin>3.2.4</version.shade.plugin> - <version.surefire.plugin>3.0.0-M5</version.surefire.plugin> - <version.surfire.report.plugin>3.0.0-M5</version.surfire.report.plugin> - <version.taglist.plugin>2.4</version.taglist.plugin> + <version.source.plugin>3.3.0</version.source.plugin> + <version.shade.plugin>3.5.0</version.shade.plugin> + <version.surefire.plugin>3.1.2</version.surefire.plugin> + <version.surfire.report.plugin>3.1.2</version.surfire.report.plugin> + <version.taglist.plugin>3.0.0</version.taglist.plugin> <version.tools.maven.plugin>1.4</version.tools.maven.plugin> - <version.versions.plugin>2.8.1</version.versions.plugin> - <version.xbean.plugin>4.20</version.xbean.plugin> + <version.versions.plugin>2.16.0</version.versions.plugin> + <version.xbean.plugin>4.23</version.xbean.plugin> <!-- Jars --> <version.easymock>2.5.2</version.easymock> @@ -148,15 +148,15 @@ <version.junit>4.13.2</version.junit> <version.jzlib>1.1.3</version.jzlib> <version.log4j>1.2.17</version.log4j> - <version.ognl>3.3.2</version.ognl> + <version.ognl>3.3.4</version.ognl> <version.pmd>4.3</version.pmd> <version.rmock>2.0.2</version.rmock> - <version.slf4j.api>1.7.35</version.slf4j.api> - <version.slf4j.log4j12>1.7.35</version.slf4j.log4j12> - <version.slf4j.jcl.over.slf4j>1.7.35</version.slf4j.jcl.over.slf4j> + <version.slf4j.api>1.7.36</version.slf4j.api> + <version.slf4j.reload4j>1.7.36</version.slf4j.reload4j> + <version.slf4j.jcl.over.slf4j>1.7.36</version.slf4j.jcl.over.slf4j> <version.springframework>2.5.6.SEC03</version.springframework> - <version.tomcat.jni>10.0.16</version.tomcat.jni> - <version.xbean.spring>4.20</version.xbean.spring> + <version.tomcat.jni>10.0.27</version.tomcat.jni> + <version.xbean.spring>4.23</version.xbean.spring> <!-- OSGi minimum versions --> <osgi-min-version.slf4j.api>1.7</osgi-min-version.slf4j.api> @@ -321,8 +321,8 @@ <dependency> <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <version>${version.slf4j.log4j12}</version> + <artifactId>slf4j-reload4j</artifactId> + <version>${version.slf4j.reload4j}</version> </dependency> <dependency> @@ -368,7 +368,7 @@ <!-- logging implementation used for unit tests --> <dependency> <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> + <artifactId>slf4j-reload4j</artifactId> <scope>test</scope> </dependency> @@ -846,14 +846,14 @@ <dependency> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-ssh</artifactId> - <version>3.5.1</version> + <version>3.5.3</version> </dependency> <!-- Add support for 'scpexe' --> <dependency> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-ssh-external</artifactId> - <version>3.5.1</version> + <version>3.5.3</version> </dependency> </dependencies> </plugin>