Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<artifactId>mina-parent</artifactId>
<groupId>org.apache.mina</groupId>
<version>2.1.4-SNAPSHOT</version>
<version>2.1.4-PSG</version>
</parent>

<artifactId>distribution</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion mina-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.mina</groupId>
<artifactId>mina-parent</artifactId>
<version>2.1.4-SNAPSHOT</version>
<version>2.1.4-PSG</version>
</parent>

<artifactId>mina-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
package org.apache.mina.core.filterchain;

import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.filterchain.IoFilter.NextFilter;
import org.apache.mina.core.session.IdleStatus;
import org.apache.mina.core.session.IoEvent;
Expand Down Expand Up @@ -104,6 +105,7 @@ public void fire() {
case MESSAGE_RECEIVED:
Object parameter = getParameter();
nextFilter.messageReceived(session, parameter);
if (parameter instanceof IoBuffer) ((IoBuffer)parameter).free();
break;

case MESSAGE_SENT:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -537,12 +537,15 @@ private void read(S session) {
if (readBytes > 0) {
IoFilterChain filterChain = session.getFilterChain();
filterChain.fireMessageReceived(buf);
buf.free();
buf = null;

if (hasFragmentation) {
if (readBytes << 1 < config.getReadBufferSize()) {
if (LOG.isDebugEnabled()) LOG.debug("Decrease read buffer size: current: " + config.getReadBufferSize());
session.decreaseReadBufferSize();
} else if (readBytes == config.getReadBufferSize()) {
if (LOG.isDebugEnabled()) LOG.debug("Increase read buffer size: current: " + config.getReadBufferSize());
session.increaseReadBufferSize();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void write(Object encodedMessage) {
if (encodedMessage instanceof IoBuffer) {
IoBuffer buf = (IoBuffer) encodedMessage;
if (buf.hasRemaining()) {
messageQueue.offer(buf);
messageQueue.offer(buf.duplicate());
} else {
throw new IllegalArgumentException("buf is empty. Forgot to call flip()?");
}
Expand Down Expand Up @@ -100,6 +100,7 @@ public void mergeAll() {
}

newBuf.put(buf);
buf.free();
}

// Push the new buffer finally.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,12 @@ public void decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) th
newBuf.put(buf);
newBuf.put(in);
newBuf.flip();
buf.free();
buf = newBuf;

// Update the session attribute.
//IoBuffer oldBuf = (IoBuffer) session.getAttribute(BUFFER);
//if (oldBuf != null) oldBuf.free();
session.setAttribute(BUFFER, buf);
}
} else {
Expand Down Expand Up @@ -234,15 +237,18 @@ public void dispose(IoSession session) throws Exception {
}

private void removeSessionBuffer(IoSession session) {
session.removeAttribute(BUFFER);
}
IoBuffer oldBuf = (IoBuffer) session.removeAttribute(BUFFER);
if (oldBuf != null) oldBuf.free();
}

private void storeRemainingInSession(IoBuffer buf, IoSession session) {
final IoBuffer remainingBuf = IoBuffer.allocate(buf.capacity()).setAutoExpand(true);

remainingBuf.order(buf.order());
remainingBuf.put(buf);

IoBuffer oldBuf = (IoBuffer) session.removeAttribute(BUFFER);
if (oldBuf != null) oldBuf.free();
session.setAttribute(BUFFER, remainingBuf);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ public void messageReceived(NextFilter nextFilter, IoSession session, Object mes
}
}
}
//in.free();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;

import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.filterchain.IoFilterAdapter;
import org.apache.mina.core.filterchain.IoFilterChain;
import org.apache.mina.core.filterchain.IoFilterEvent;
Expand Down Expand Up @@ -563,8 +564,13 @@ public final void exceptionCaught(NextFilter nextFilter, IoSession session, Thro
@Override
public final void messageReceived(NextFilter nextFilter, IoSession session, Object message) {
if (eventTypes.contains(IoEventType.MESSAGE_RECEIVED)) {
IoFilterEvent event = new IoFilterEvent(nextFilter, IoEventType.MESSAGE_RECEIVED, session, message);
fireEvent(event);
if (message instanceof IoBuffer) {
IoFilterEvent event = new IoFilterEvent(nextFilter, IoEventType.MESSAGE_RECEIVED, session, ((IoBuffer)message).duplicate());
fireEvent(event);
} else {
IoFilterEvent event = new IoFilterEvent(nextFilter, IoEventType.MESSAGE_RECEIVED, session, message);
fireEvent(event);
}
} else {
nextFilter.messageReceived(session, message);
}
Expand Down
2 changes: 1 addition & 1 deletion mina-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.mina</groupId>
<artifactId>mina-parent</artifactId>
<version>2.1.4-SNAPSHOT</version>
<version>2.1.4-PSG</version>
</parent>

<artifactId>mina-example</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion mina-filter-compression/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.mina</groupId>
<artifactId>mina-parent</artifactId>
<version>2.1.4-SNAPSHOT</version>
<version>2.1.4-PSG</version>
</parent>

<artifactId>mina-filter-compression</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion mina-http/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.mina</groupId>
<artifactId>mina-parent</artifactId>
<version>2.1.4-SNAPSHOT</version>
<version>2.1.4-PSG</version>
</parent>

<artifactId>mina-http</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion mina-integration-beans/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.mina</groupId>
<artifactId>mina-parent</artifactId>
<version>2.1.4-SNAPSHOT</version>
<version>2.1.4-PSG</version>
</parent>

<artifactId>mina-integration-beans</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion mina-integration-jmx/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.mina</groupId>
<artifactId>mina-parent</artifactId>
<version>2.1.4-SNAPSHOT</version>
<version>2.1.4-PSG</version>
</parent>

<artifactId>mina-integration-jmx</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion mina-integration-ognl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.mina</groupId>
<artifactId>mina-parent</artifactId>
<version>2.1.4-SNAPSHOT</version>
<version>2.1.4-PSG</version>
</parent>

<artifactId>mina-integration-ognl</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion mina-integration-xbean/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.mina</groupId>
<artifactId>mina-parent</artifactId>
<version>2.1.4-SNAPSHOT</version>
<version>2.1.4-PSG</version>
</parent>

<artifactId>mina-integration-xbean</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion mina-legal/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.mina</groupId>
<artifactId>mina-parent</artifactId>
<version>2.1.4-SNAPSHOT</version>
<version>2.1.4-PSG</version>
</parent>

<artifactId>mina-legal</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion mina-statemachine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.mina</groupId>
<artifactId>mina-parent</artifactId>
<version>2.1.4-SNAPSHOT</version>
<version>2.1.4-PSG</version>
</parent>

<artifactId>mina-statemachine</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion mina-transport-apr/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.mina</groupId>
<artifactId>mina-parent</artifactId>
<version>2.1.4-SNAPSHOT</version>
<version>2.1.4-PSG</version>
</parent>

<artifactId>mina-transport-apr</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion mina-transport-serial/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.mina</groupId>
<artifactId>mina-parent</artifactId>
<version>2.1.4-SNAPSHOT</version>
<version>2.1.4-PSG</version>
</parent>

<artifactId>mina-transport-serial</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</organization>

<groupId>org.apache.mina</groupId>
<version>2.1.4-SNAPSHOT</version>
<version>2.1.4-PSG</version>
<artifactId>mina-parent</artifactId>
<name>Apache MINA</name>
<packaging>pom</packaging>
Expand Down