Skip to content
GitLab
Explore
Sign in
Register
Commits on Source (3)
New upstream version 2.0.17
· fb837b08
Emmanuel Bourg
authored
Jun 04, 2018
fb837b08
New upstream version 2.0.18
· b2dacf56
Emmanuel Bourg
authored
Jun 04, 2018
b2dacf56
New upstream version 2.0.19
· 76b32cea
Emmanuel Bourg
authored
Nov 19, 2018
76b32cea
Expand all
Show whitespace changes
Inline
Side-by-side
src/mina-core/META-INF/MANIFEST.MF
View file @
76b32cea
Manifest-Version: 1.0
Bnd-LastModified: 1
477248910833
Build-Jdk: 1.8.0_
60
Bnd-LastModified: 1
528403319419
Build-Jdk: 1.8.0_
171
Built-By: elecharny
Bundle-Description: Apache MINA is a network application framework which
helps users develop high performance and highly scalable network appli
...
...
@@ -12,106 +12,106 @@ Bundle-ManifestVersion: 2
Bundle-Name: Apache MINA Core
Bundle-SymbolicName: org.apache.mina.core
Bundle-Vendor: Apache MINA Project
Bundle-Version: 2.0.1
6
Bundle-Version: 2.0.1
9
Created-By: Apache Maven Bundle Plugin
Export-Package: org.apache.mina.core;version="2.0.1
6
";uses:="org.apache.
Export-Package: org.apache.mina.core;version="2.0.1
9
";uses:="org.apache.
mina.core.future,org.apache.mina.core.session",org.apache.mina.core.buf
fer;version="2.0.1
6
",org.apache.mina.core.file;version="2.0.1
6
",org.apa
che.mina.core.filterchain;version="2.0.1
6
";uses:="org.apache.mina.core.
fer;version="2.0.1
9
",org.apache.mina.core.file;version="2.0.1
9
",org.apa
che.mina.core.filterchain;version="2.0.1
9
";uses:="org.apache.mina.core.
session,org.apache.mina.core.write",org.apache.mina.core.future;version
="2.0.1
6
";uses:="org.apache.mina.core.session",org.apache.mina.core.pol
ling;version="2.0.1
6
";uses:="org.apache.mina.core.buffer,org.apache.min
="2.0.1
9
";uses:="org.apache.mina.core.session",org.apache.mina.core.pol
ling;version="2.0.1
9
";uses:="org.apache.mina.core.buffer,org.apache.min
a.core.file,org.apache.mina.core.future,org.apache.mina.core.service,or
g.apache.mina.core.session,org.apache.mina.core.write,org.apache.mina.t
ransport.socket",org.apache.mina.core.service;version="2.0.1
6
";uses:="o
ransport.socket",org.apache.mina.core.service;version="2.0.1
9
";uses:="o
rg.apache.mina.core.filterchain,org.apache.mina.core.future,org.apache.
mina.core.session,org.apache.mina.core.write",org.apache.mina.core.sess
ion;version="2.0.16";uses:="org.apache.mina.core.filterchain,org.apache
.mina.core.future,org.apache.mina.core.service,org.apache.mina.core.wri
te",org.apache.mina.core.write;version="2.0.16";uses:="org.apache.mina.
core.future,org.apache.mina.core.session",org.apache.mina.filter.buffer
;version="2.0.16";uses:="org.apache.mina.core.buffer,org.apache.mina.co
re.filterchain,org.apache.mina.core.session,org.apache.mina.core.write,
org.apache.mina.util",org.apache.mina.filter.codec;version="2.0.16";use
s:="org.apache.mina.core.buffer,org.apache.mina.core.filterchain,org.ap
ache.mina.core.future,org.apache.mina.core.session,org.apache.mina.core
.write",org.apache.mina.filter.codec.demux;version="2.0.16";uses:="org.
apache.mina.core.buffer,org.apache.mina.core.session,org.apache.mina.fi
lter.codec",org.apache.mina.filter.codec.prefixedstring;version="2.0.16
";uses:="org.apache.mina.core.buffer,org.apache.mina.core.session,org.a
pache.mina.filter.codec",org.apache.mina.filter.codec.serialization;ver
sion="2.0.16";uses:="org.apache.mina.core.buffer,org.apache.mina.core.s
ession,org.apache.mina.filter.codec",org.apache.mina.filter.codec.state
machine;version="2.0.16";uses:="org.apache.mina.core.buffer,org.apache.
mina.core.session,org.apache.mina.filter.codec",org.apache.mina.filter.
codec.textline;version="2.0.16";uses:="org.apache.mina.core.buffer,org.
apache.mina.core.session,org.apache.mina.filter.codec",org.apache.mina.
filter.errorgenerating;version="2.0.16";uses:="org.apache.mina.core.fil
terchain,org.apache.mina.core.session,org.apache.mina.core.write",org.a
pache.mina.filter.executor;version="2.0.16";uses:="org.apache.mina.core
.filterchain,org.apache.mina.core.session,org.apache.mina.core.write",o
rg.apache.mina.filter.firewall;version="2.0.16";uses:="org.apache.mina.
core.filterchain,org.apache.mina.core.session,org.apache.mina.core.writ
e",org.apache.mina.filter.keepalive;version="2.0.16";uses:="org.apache.
mina.core.filterchain,org.apache.mina.core.session,org.apache.mina.core
.write",org.apache.mina.filter.logging;version="2.0.16";uses:="org.apac
mina.core.session,org.apache.mina.core.write,org.slf4j",org.apache.mina
.core.session;version="2.0.19";uses:="org.apache.mina.core.filterchain,
org.apache.mina.core.future,org.apache.mina.core.service,org.apache.min
a.core.write",org.apache.mina.core.write;version="2.0.19";uses:="org.ap
ache.mina.core.future,org.apache.mina.core.session",org.apache.mina.fil
ter.buffer;version="2.0.19";uses:="org.apache.mina.core.buffer,org.apac
he.mina.core.filterchain,org.apache.mina.core.session,org.apache.mina.c
ore.write,org.apache.mina.filter.util",org.apache.mina.filter.ssl;versi
on="2.0.16";uses:="javax.net.ssl,org.apache.mina.core.filterchain,org.a
pache.mina.core.future,org.apache.mina.core.session,org.apache.mina.cor
e.write",org.apache.mina.filter.statistic;version="2.0.16";uses:="org.a
pache.mina.core.filterchain,org.apache.mina.core.session,org.apache.min
a.core.write",org.apache.mina.filter.stream;version="2.0.16";uses:="org
.apache.mina.core.buffer,org.apache.mina.core.file,org.apache.mina.core
.filterchain,org.apache.mina.core.session,org.apache.mina.core.write",o
rg.apache.mina.filter.util;version="2.0.16";uses:="org.apache.mina.core
.filterchain,org.apache.mina.core.session,org.apache.mina.core.write",o
rg.apache.mina.handler.chain;version="2.0.16";uses:="org.apache.mina.co
re.service,org.apache.mina.core.session",org.apache.mina.handler.demux;
version="2.0.16";uses:="org.apache.mina.core.service,org.apache.mina.co
re.session",org.apache.mina.handler.multiton;version="2.0.16";uses:="or
g.apache.mina.core.service,org.apache.mina.core.session",org.apache.min
a.handler.stream;version="2.0.16";uses:="org.apache.mina.core.service,o
rg.apache.mina.core.session",org.apache.mina.proxy;version="2.0.16";use
s:="javax.security.sasl,org.apache.mina.core.buffer,org.apache.mina.cor
e.filterchain,org.apache.mina.core.future,org.apache.mina.core.service,
org.apache.mina.core.session,org.apache.mina.core.write,org.apache.mina
.proxy.filter,org.apache.mina.proxy.session,org.apache.mina.transport.s
ocket",org.apache.mina.proxy.event;version="2.0.16";uses:="org.apache.m
ina.core.filterchain,org.apache.mina.core.session,org.apache.mina.proxy
.session",org.apache.mina.proxy.filter;version="2.0.16";uses:="org.apac
he.mina.core.buffer,org.apache.mina.core.filterchain,org.apache.mina.co
re.session,org.apache.mina.core.write,org.apache.mina.proxy",org.apache
.mina.proxy.handlers;version="2.0.16",org.apache.mina.proxy.handlers.ht
tp;version="2.0.16";uses:="org.apache.mina.core.buffer,org.apache.mina.
core.filterchain,org.apache.mina.proxy,org.apache.mina.proxy.handlers,o
rg.apache.mina.proxy.session",org.apache.mina.proxy.handlers.http.basic
;version="2.0.16";uses:="org.apache.mina.core.filterchain,org.apache.mi
na.proxy,org.apache.mina.proxy.handlers.http,org.apache.mina.proxy.sess
ion",org.apache.mina.proxy.handlers.http.digest;version="2.0.16";uses:=
"javax.security.sasl,org.apache.mina.core.filterchain,org.apache.mina.c
ore.session,org.apache.mina.proxy,org.apache.mina.proxy.handlers.http,o
rg.apache.mina.proxy.session",org.apache.mina.proxy.handlers.http.ntlm;
version="2.0.16";uses:="org.apache.mina.core.filterchain,org.apache.min
a.proxy,org.apache.mina.proxy.handlers.http,org.apache.mina.proxy.sessi
on",org.apache.mina.proxy.handlers.socks;version="2.0.16";uses:="org.ap
ache.mina.core.buffer,org.apache.mina.core.filterchain,org.apache.mina.
proxy,org.apache.mina.proxy.handlers,org.apache.mina.proxy.session",org
.apache.mina.proxy.session;version="2.0.16";uses:="org.apache.mina.core
.future,org.apache.mina.core.session,org.apache.mina.proxy,org.apache.m
ina.proxy.event,org.apache.mina.proxy.filter,org.apache.mina.proxy.hand
lers,org.apache.mina.proxy.handlers.http",org.apache.mina.proxy.utils;v
ersion="2.0.16";uses:="javax.security.sasl,org.apache.mina.core.buffer"
,org.apache.mina.transport.socket;version="2.0.16";uses:="org.apache.mi
na.core.service,org.apache.mina.core.session",org.apache.mina.transport
.socket.nio;version="2.0.16";uses:="org.apache.mina.core.buffer,org.apa
che.mina.core.file,org.apache.mina.core.filterchain,org.apache.mina.cor
e.polling,org.apache.mina.core.service,org.apache.mina.core.session,org
.apache.mina.core.write,org.apache.mina.transport.socket",org.apache.mi
na.transport.vmpipe;version="2.0.16";uses:="org.apache.mina.core.future
,org.apache.mina.core.service,org.apache.mina.core.session",org.apache.
mina.util;version="2.0.16"
ore.write,org.apache.mina.util",org.apache.mina.filter.codec;version="2
.0.19";uses:="org.apache.mina.core.buffer,org.apache.mina.core.filterch
ain,org.apache.mina.core.future,org.apache.mina.core.session,org.apache
.mina.core.write",org.apache.mina.filter.codec.demux;version="2.0.19";u
ses:="org.apache.mina.core.buffer,org.apache.mina.core.session,org.apac
he.mina.filter.codec",org.apache.mina.filter.codec.prefixedstring;versi
on="2.0.19";uses:="org.apache.mina.core.buffer,org.apache.mina.core.ses
sion,org.apache.mina.filter.codec",org.apache.mina.filter.codec.seriali
zation;version="2.0.19";uses:="org.apache.mina.core.buffer,org.apache.m
ina.core.session,org.apache.mina.filter.codec",org.apache.mina.filter.c
odec.statemachine;version="2.0.19";uses:="org.apache.mina.core.buffer,o
rg.apache.mina.core.session,org.apache.mina.filter.codec",org.apache.mi
na.filter.codec.textline;version="2.0.19";uses:="org.apache.mina.core.b
uffer,org.apache.mina.core.session,org.apache.mina.filter.codec",org.ap
ache.mina.filter.errorgenerating;version="2.0.19";uses:="org.apache.min
a.core.filterchain,org.apache.mina.core.session,org.apache.mina.core.wr
ite",org.apache.mina.filter.executor;version="2.0.19";uses:="org.apache
.mina.core.filterchain,org.apache.mina.core.session,org.apache.mina.cor
e.write",org.apache.mina.filter.firewall;version="2.0.19";uses:="org.ap
ache.mina.core.filterchain,org.apache.mina.core.session,org.apache.mina
.core.write",org.apache.mina.filter.keepalive;version="2.0.19";uses:="o
rg.apache.mina.core.filterchain,org.apache.mina.core.session,org.apache
.mina.core.write",org.apache.mina.filter.logging;version="2.0.19";uses:
="org.apache.mina.core.filterchain,org.apache.mina.core.session,org.apa
che.mina.core.write,org.apache.mina.filter.util",org.apache.mina.filter
.ssl;version="2.0.19";uses:="javax.net.ssl,org.apache.mina.core.filterc
hain,org.apache.mina.core.future,org.apache.mina.core.session,org.apach
e.mina.core.write",org.apache.mina.filter.statistic;version="2.0.19";us
es:="org.apache.mina.core.filterchain,org.apache.mina.core.session,org.
apache.mina.core.write",org.apache.mina.filter.stream;version="2.0.19";
uses:="org.apache.mina.core.buffer,org.apache.mina.core.file,org.apache
.mina.core.filterchain,org.apache.mina.core.session,org.apache.mina.cor
e.write",org.apache.mina.filter.util;version="2.0.19";uses:="org.apache
.mina.core.filterchain,org.apache.mina.core.session,org.apache.mina.cor
e.write",org.apache.mina.handler.chain;version="2.0.19";uses:="org.apac
he.mina.core.service,org.apache.mina.core.session",org.apache.mina.hand
ler.demux;version="2.0.19";uses:="org.apache.mina.core.service,org.apac
he.mina.core.session",org.apache.mina.handler.multiton;version="2.0.19"
;uses:="org.apache.mina.core.service,org.apache.mina.core.session",org.
apache.mina.handler.stream;version="2.0.19";uses:="org.apache.mina.core
.service,org.apache.mina.core.session",org.apache.mina.proxy;version="2
.0.19";uses:="javax.security.sasl,org.apache.mina.core.buffer,org.apach
e.mina.core.filterchain,org.apache.mina.core.future,org.apache.mina.cor
e.service,org.apache.mina.core.session,org.apache.mina.core.write,org.a
pache.mina.proxy.filter,org.apache.mina.proxy.session,org.apache.mina.t
ransport.socket",org.apache.mina.proxy.event;version="2.0.19";uses:="or
g.apache.mina.core.filterchain,org.apache.mina.core.session,org.apache.
mina.proxy.session",org.apache.mina.proxy.filter;version="2.0.19";uses:
="org.apache.mina.core.buffer,org.apache.mina.core.filterchain,org.apac
he.mina.core.session,org.apache.mina.core.write,org.apache.mina.proxy",
org.apache.mina.proxy.handlers;version="2.0.19",org.apache.mina.proxy.h
andlers.http;version="2.0.19";uses:="org.apache.mina.core.buffer,org.ap
ache.mina.core.filterchain,org.apache.mina.proxy,org.apache.mina.proxy.
handlers,org.apache.mina.proxy.session",org.apache.mina.proxy.handlers.
http.basic;version="2.0.19";uses:="org.apache.mina.core.filterchain,org
.apache.mina.proxy,org.apache.mina.proxy.handlers.http,org.apache.mina.
proxy.session",org.apache.mina.proxy.handlers.http.digest;version="2.0.
19";uses:="javax.security.sasl,org.apache.mina.core.filterchain,org.apa
che.mina.core.session,org.apache.mina.proxy,org.apache.mina.proxy.handl
ers.http,org.apache.mina.proxy.session",org.apache.mina.proxy.handlers.
http.ntlm;version="2.0.19";uses:="org.apache.mina.core.filterchain,org.
apache.mina.proxy,org.apache.mina.proxy.handlers.http,org.apache.mina.p
roxy.session",org.apache.mina.proxy.handlers.socks;version="2.0.19";use
s:="org.apache.mina.core.buffer,org.apache.mina.core.filterchain,org.ap
ache.mina.proxy,org.apache.mina.proxy.handlers,org.apache.mina.proxy.se
ssion",org.apache.mina.proxy.session;version="2.0.19";uses:="org.apache
.mina.core.future,org.apache.mina.core.session,org.apache.mina.proxy,or
g.apache.mina.proxy.event,org.apache.mina.proxy.filter,org.apache.mina.
proxy.handlers,org.apache.mina.proxy.handlers.http",org.apache.mina.pro
xy.utils;version="2.0.19";uses:="javax.security.sasl,org.apache.mina.co
re.buffer",org.apache.mina.transport.socket;version="2.0.19";uses:="org
.apache.mina.core.service,org.apache.mina.core.session",org.apache.mina
.transport.socket.nio;version="2.0.19";uses:="org.apache.mina.core.buff
er,org.apache.mina.core.file,org.apache.mina.core.filterchain,org.apach
e.mina.core.polling,org.apache.mina.core.service,org.apache.mina.core.s
ession,org.apache.mina.core.write,org.apache.mina.transport.socket",org
.apache.mina.transport.vmpipe;version="2.0.19";uses:="org.apache.mina.c
ore.future,org.apache.mina.core.service,org.apache.mina.core.session",o
rg.apache.mina.util;version="2.0.19"
Import-Package: javax.crypto,javax.crypto.spec,javax.net.ssl,javax.secur
ity.sasl,org.slf4j;version="1.7"
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.7))"
Tool: Bnd-
2
.3.0.201
405100607
Tool: Bnd-
3
.3.0.201
609221906
src/mina-core/pom.xml
View file @
76b32cea
...
...
@@ -24,7 +24,7 @@
<parent>
<groupId>
org.apache.mina
</groupId>
<artifactId>
mina-parent
</artifactId>
<version>
2.0.1
6
</version>
<version>
2.0.1
9
</version>
</parent>
<artifactId>
mina-core
</artifactId>
...
...
src/mina-core/src/main/java/org/apache/mina/core/IoUtil.java
View file @
76b32cea
...
...
@@ -39,6 +39,10 @@ import org.apache.mina.core.session.IoSession;
public
final
class
IoUtil
{
private
static
final
IoSession
[]
EMPTY_SESSIONS
=
new
IoSession
[
0
];
private
IoUtil
()
{
// Do nothing
}
/**
* Writes the specified {@code message} to the specified {@code sessions}.
* If the specified {@code message} is an {@link IoBuffer}, the buffer is
...
...
@@ -49,7 +53,7 @@ public final class IoUtil {
* @return The list of WriteFuture created for each broadcasted message
*/
public
static
List
<
WriteFuture
>
broadcast
(
Object
message
,
Collection
<
IoSession
>
sessions
)
{
List
<
WriteFuture
>
answer
=
new
ArrayList
<
WriteFuture
>(
sessions
.
size
());
List
<
WriteFuture
>
answer
=
new
ArrayList
<>(
sessions
.
size
());
broadcast
(
message
,
sessions
.
iterator
(),
answer
);
return
answer
;
}
...
...
@@ -64,7 +68,7 @@ public final class IoUtil {
* @return The list of WriteFuture created for each broadcasted message
*/
public
static
List
<
WriteFuture
>
broadcast
(
Object
message
,
Iterable
<
IoSession
>
sessions
)
{
List
<
WriteFuture
>
answer
=
new
ArrayList
<
WriteFuture
>();
List
<
WriteFuture
>
answer
=
new
ArrayList
<>();
broadcast
(
message
,
sessions
.
iterator
(),
answer
);
return
answer
;
}
...
...
@@ -79,7 +83,7 @@ public final class IoUtil {
* @return The list of {@link WriteFuture} for the written messages
*/
public
static
List
<
WriteFuture
>
broadcast
(
Object
message
,
Iterator
<
IoSession
>
sessions
)
{
List
<
WriteFuture
>
answer
=
new
ArrayList
<
WriteFuture
>();
List
<
WriteFuture
>
answer
=
new
ArrayList
<>();
broadcast
(
message
,
sessions
,
answer
);
return
answer
;
}
...
...
@@ -98,7 +102,7 @@ public final class IoUtil {
sessions
=
EMPTY_SESSIONS
;
}
List
<
WriteFuture
>
answer
=
new
ArrayList
<
WriteFuture
>(
sessions
.
length
);
List
<
WriteFuture
>
answer
=
new
ArrayList
<>(
sessions
.
length
);
if
(
message
instanceof
IoBuffer
)
{
for
(
IoSession
s
:
sessions
)
{
answer
.
add
(
s
.
write
(((
IoBuffer
)
message
).
duplicate
()));
...
...
@@ -125,31 +129,78 @@ public final class IoUtil {
}
}
/**
* Wait on all the {@link IoFuture}s we get, or until one of the {@link IoFuture}s is interrupted
*
* @param futures The {@link IoFuture}s we are waiting on
* @throws InterruptedException If one of the {@link IoFuture} is interrupted
*/
public
static
void
await
(
Iterable
<?
extends
IoFuture
>
futures
)
throws
InterruptedException
{
for
(
IoFuture
f
:
futures
)
{
f
.
await
();
}
}
/**
* Wait on all the {@link IoFuture}s we get. This can't get interrupted.
*
* @param futures The {@link IoFuture}s we are waiting on
*/
public
static
void
awaitUninterruptably
(
Iterable
<?
extends
IoFuture
>
futures
)
{
for
(
IoFuture
f
:
futures
)
{
f
.
awaitUninterruptibly
();
}
}
/**
* Wait on all the {@link IoFuture}s we get, or until one of the {@link IoFuture}s is interrupted
*
* @param futures The {@link IoFuture}s we are waiting on
* @param timeout The maximum time we wait for the {@link IoFuture}s to complete
* @param unit The Time unit to use for the timeout
* @return <tt>TRUE</TT> if all the {@link IoFuture} have been completed, <tt>FALSE</tt> if
* at least one {@link IoFuture} haas been interrupted
* @throws InterruptedException If one of the {@link IoFuture} is interrupted
*/
public
static
boolean
await
(
Iterable
<?
extends
IoFuture
>
futures
,
long
timeout
,
TimeUnit
unit
)
throws
InterruptedException
{
return
await
(
futures
,
unit
.
toMillis
(
timeout
));
}
/**
* Wait on all the {@link IoFuture}s we get, or until one of the {@link IoFuture}s is interrupted
*
* @param futures The {@link IoFuture}s we are waiting on
* @param timeoutMillis The maximum milliseconds we wait for the {@link IoFuture}s to complete
* @return <tt>TRUE</TT> if all the {@link IoFuture} have been completed, <tt>FALSE</tt> if
* at least one {@link IoFuture} has been interrupted
* @throws InterruptedException If one of the {@link IoFuture} is interrupted
*/
public
static
boolean
await
(
Iterable
<?
extends
IoFuture
>
futures
,
long
timeoutMillis
)
throws
InterruptedException
{
return
await0
(
futures
,
timeoutMillis
,
true
);
}
/**
* Wait on all the {@link IoFuture}s we get.
*
* @param futures The {@link IoFuture}s we are waiting on
* @param timeout The maximum time we wait for the {@link IoFuture}s to complete
* @param unit The Time unit to use for the timeout
* @return <tt>TRUE</TT> if all the {@link IoFuture} have been completed, <tt>FALSE</tt> if
* at least one {@link IoFuture} has been interrupted
*/
public
static
boolean
awaitUninterruptibly
(
Iterable
<?
extends
IoFuture
>
futures
,
long
timeout
,
TimeUnit
unit
)
{
return
awaitUninterruptibly
(
futures
,
unit
.
toMillis
(
timeout
));
}
/**
* Wait on all the {@link IoFuture}s we get.
*
* @param futures The {@link IoFuture}s we are waiting on
* @param timeoutMillis The maximum milliseconds we wait for the {@link IoFuture}s to complete
* @return <tt>TRUE</TT> if all the {@link IoFuture} have been completed, <tt>FALSE</tt> if
* at least one {@link IoFuture} has been interrupted
*/
public
static
boolean
awaitUninterruptibly
(
Iterable
<?
extends
IoFuture
>
futures
,
long
timeoutMillis
)
{
try
{
return
await0
(
futures
,
timeoutMillis
,
false
);
...
...
@@ -165,8 +216,10 @@ public final class IoUtil {
boolean
lastComplete
=
true
;
Iterator
<?
extends
IoFuture
>
i
=
futures
.
iterator
();
while
(
i
.
hasNext
())
{
IoFuture
f
=
i
.
next
();
do
{
if
(
interruptable
)
{
lastComplete
=
f
.
await
(
waitTime
);
...
...
@@ -176,7 +229,7 @@ public final class IoUtil {
waitTime
=
timeoutMillis
-
(
System
.
currentTimeMillis
()
-
startTime
);
if
(
lastComplete
||
waitTime
<=
0
)
{
if
(
waitTime
<=
0
)
{
break
;
}
}
while
(!
lastComplete
);
...
...
@@ -188,8 +241,4 @@ public final class IoUtil {
return
lastComplete
&&
!
i
.
hasNext
();
}
private
IoUtil
()
{
// Do nothing
}
}
src/mina-core/src/main/java/org/apache/mina/core/RuntimeIoException.java
View file @
76b32cea
...
...
@@ -33,18 +33,37 @@ import java.io.IOException;
public
class
RuntimeIoException
extends
RuntimeException
{
private
static
final
long
serialVersionUID
=
9029092241311939548L
;
/**
* Create a new RuntimeIoException instance
*/
public
RuntimeIoException
()
{
super
();
}
/**
* Create a new RuntimeIoException instance
*
* @param message The error message
*/
public
RuntimeIoException
(
String
message
)
{
super
(
message
);
}
/**
* Create a new RuntimeIoException instance
*
* @param message The error message
* @param cause The original exception
*/
public
RuntimeIoException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
/**
* Create a new RuntimeIoException instance
*
* @param cause The original exception
*/
public
RuntimeIoException
(
Throwable
cause
)
{
super
(
cause
);
}
...
...
src/mina-core/src/main/java/org/apache/mina/core/buffer/AbstractIoBuffer.java
View file @
76b32cea
...
...
@@ -42,6 +42,7 @@ import java.nio.charset.CharacterCodingException;
import
java.nio.charset.CharsetDecoder
;
import
java.nio.charset.CharsetEncoder
;
import
java.nio.charset.CoderResult
;
import
java.nio.charset.StandardCharsets
;
import
java.util.EnumSet
;
import
java.util.Set
;
...
...
@@ -522,6 +523,7 @@ public abstract class AbstractIoBuffer extends IoBuffer {
/**
* {@inheritDoc}
*/
@Override
public
IoBuffer
putUnsigned
(
byte
value
)
{
autoExpand
(
1
);
buf
().
put
((
byte
)
(
value
&
0xff
));
...
...
@@ -531,6 +533,7 @@ public abstract class AbstractIoBuffer extends IoBuffer {
/**
* {@inheritDoc}
*/
@Override
public
IoBuffer
putUnsigned
(
int
index
,
byte
value
)
{
autoExpand
(
index
,
1
);
buf
().
put
(
index
,
(
byte
)
(
value
&
0xff
));
...
...
@@ -540,6 +543,7 @@ public abstract class AbstractIoBuffer extends IoBuffer {
/**
* {@inheritDoc}
*/
@Override
public
IoBuffer
putUnsigned
(
short
value
)
{
autoExpand
(
1
);
buf
().
put
((
byte
)
(
value
&
0x00ff
));
...
...
@@ -549,6 +553,7 @@ public abstract class AbstractIoBuffer extends IoBuffer {
/**
* {@inheritDoc}
*/
@Override
public
IoBuffer
putUnsigned
(
int
index
,
short
value
)
{
autoExpand
(
index
,
1
);
buf
().
put
(
index
,
(
byte
)
(
value
&
0x00ff
));
...
...
@@ -558,6 +563,7 @@ public abstract class AbstractIoBuffer extends IoBuffer {
/**
* {@inheritDoc}
*/
@Override
public
IoBuffer
putUnsigned
(
int
value
)
{
autoExpand
(
1
);
buf
().
put
((
byte
)
(
value
&
0x000000ff
));
...
...
@@ -567,6 +573,7 @@ public abstract class AbstractIoBuffer extends IoBuffer {
/**
* {@inheritDoc}
*/
@Override
public
IoBuffer
putUnsigned
(
int
index
,
int
value
)
{
autoExpand
(
index
,
1
);
buf
().
put
(
index
,
(
byte
)
(
value
&
0x000000ff
));
...
...
@@ -576,6 +583,7 @@ public abstract class AbstractIoBuffer extends IoBuffer {
/**
* {@inheritDoc}
*/
@Override
public
IoBuffer
putUnsigned
(
long
value
)
{
autoExpand
(
1
);
buf
().
put
((
byte
)
(
value
&
0x00000000000000ff
L
));
...
...
@@ -585,6 +593,7 @@ public abstract class AbstractIoBuffer extends IoBuffer {
/**
* {@inheritDoc}
*/
@Override
public
IoBuffer
putUnsigned
(
int
index
,
long
value
)
{
autoExpand
(
index
,
1
);
buf
().
put
(
index
,
(
byte
)
(
value
&
0x00000000000000ff
L
));
...
...
@@ -828,7 +837,7 @@ public abstract class AbstractIoBuffer extends IoBuffer {
@Override
public
final
IoBuffer
putUnsignedInt
(
byte
value
)
{
autoExpand
(
4
);
buf
().
putInt
(
(
value
&
0x00ff
)
)
;
buf
().
putInt
(
value
&
0x00ff
);
return
this
;
}
...
...
@@ -838,7 +847,7 @@ public abstract class AbstractIoBuffer extends IoBuffer {
@Override
public
final
IoBuffer
putUnsignedInt
(
int
index
,
byte
value
)
{
autoExpand
(
index
,
4
);
buf
().
putInt
(
index
,
(
value
&
0x00ff
)
)
;
buf
().
putInt
(
index
,
value
&
0x00ff
);
return
this
;
}
...
...
@@ -848,7 +857,7 @@ public abstract class AbstractIoBuffer extends IoBuffer {
@Override
public
final
IoBuffer
putUnsignedInt
(
short
value
)
{
autoExpand
(
4
);
buf
().
putInt
(
(
value
&
0x0000ffff
)
)
;
buf
().
putInt
(
value
&
0x0000ffff
);
return
this
;
}
...
...
@@ -858,7 +867,7 @@ public abstract class AbstractIoBuffer extends IoBuffer {
@Override
public
final
IoBuffer
putUnsignedInt
(
int
index
,
short
value
)
{
autoExpand
(
index
,
4
);
buf
().
putInt
(
index
,
(
value
&
0x0000ffff
)
)
;
buf
().
putInt
(
index
,
value
&
0x0000ffff
);
return
this
;
}
...
...
@@ -867,9 +876,7 @@ public abstract class AbstractIoBuffer extends IoBuffer {
*/
@Override
public
final
IoBuffer
putUnsignedInt
(
int
value
)
{
autoExpand
(
4
);
buf
().
putInt
(
value
);
return
this
;
return
putInt
(
value
);
}
/**
...
...
@@ -877,9 +884,7 @@ public abstract class AbstractIoBuffer extends IoBuffer {
*/
@Override
public
final
IoBuffer
putUnsignedInt
(
int
index
,
int
value
)
{
autoExpand
(
index
,
4
);
buf
().
putInt
(
index
,
value
);
return
this
;
return
putInt
(
index
,
value
);
}
/**
...
...
@@ -927,9 +932,7 @@ public abstract class AbstractIoBuffer extends IoBuffer {
*/
@Override
public
final
IoBuffer
putUnsignedShort
(
short
value
)
{
autoExpand
(
2
);
buf
().
putShort
(
value
);
return
this
;
return
putShort
(
value
);
}
/**
...
...
@@ -937,9 +940,7 @@ public abstract class AbstractIoBuffer extends IoBuffer {
*/
@Override
public
final
IoBuffer
putUnsignedShort
(
int
index
,
short
value
)
{
autoExpand
(
index
,
2
);
buf
().
putShort
(
index
,
value
);
return
this
;
return
putShort
(
index
,
value
);
}
/**
...
...
@@ -1289,6 +1290,7 @@ public abstract class AbstractIoBuffer extends IoBuffer {
/**
* {@inheritDoc}
*/
@Override
public
int
compareTo
(
IoBuffer
that
)
{
int
n
=
this
.
position
()
+
Math
.
min
(
this
.
remaining
(),
that
.
remaining
());
for
(
int
i
=
this
.
position
(),
j
=
that
.
position
();
i
<
n
;
i
++,
j
++)
{
...
...
@@ -1438,9 +1440,6 @@ public abstract class AbstractIoBuffer extends IoBuffer {
return
b3
<<
16
|
b2
<<
8
|
b1
;
}
/**
* {@inheritDoc}
*/
private
int
getMediumInt
(
byte
b1
,
byte
b2
,
byte
b3
)
{
int
ret
=
b1
<<
16
&
0xff0000
|
b2
<<
8
&
0xff00
|
b3
&
0xff
;
// Check to see if the medium int is negative (high bit in b1 set)
...
...
@@ -1599,7 +1598,10 @@ public abstract class AbstractIoBuffer extends IoBuffer {
return
""
;
}
boolean
utf16
=
decoder
.
charset
().
name
().
startsWith
(
"UTF-16"
);
boolean
utf16
=
decoder
.
charset
().
equals
(
StandardCharsets
.
UTF_16
)
||
decoder
.
charset
().
equals
(
StandardCharsets
.
UTF_16BE
)
||
decoder
.
charset
().
equals
(
StandardCharsets
.
UTF_16LE
);
int
oldPos
=
position
();
int
oldLimit
=
limit
();
...
...
@@ -1707,7 +1709,9 @@ public abstract class AbstractIoBuffer extends IoBuffer {
return
""
;
}
boolean
utf16
=
decoder
.
charset
().
name
().
startsWith
(
"UTF-16"
);
boolean
utf16
=
decoder
.
charset
().
equals
(
StandardCharsets
.
UTF_16
)
||
decoder
.
charset
().
equals
(
StandardCharsets
.
UTF_16BE
)
||
decoder
.
charset
().
equals
(
StandardCharsets
.
UTF_16LE
);
if
(
utf16
&&
(
fieldSize
&
1
)
!=
0
)
{
throw
new
IllegalArgumentException
(
"fieldSize is not even."
);
...
...
@@ -1855,7 +1859,10 @@ public abstract class AbstractIoBuffer extends IoBuffer {
autoExpand
(
fieldSize
);
boolean
utf16
=
encoder
.
charset
().
name
().
startsWith
(
"UTF-16"
);
boolean
utf16
=
encoder
.
charset
().
equals
(
StandardCharsets
.
UTF_16
)
||
encoder
.
charset
().
equals
(
StandardCharsets
.
UTF_16BE
)
||
encoder
.
charset
().
equals
(
StandardCharsets
.
UTF_16LE
);
if
(
utf16
&&
(
fieldSize
&
1
)
!=
0
)
{
throw
new
IllegalArgumentException
(
"fieldSize is not even."
);
...
...
@@ -1954,7 +1961,10 @@ public abstract class AbstractIoBuffer extends IoBuffer {
return
""
;
}
boolean
utf16
=
decoder
.
charset
().
name
().
startsWith
(
"UTF-16"
);
boolean
utf16
=
decoder
.
charset
().
equals
(
StandardCharsets
.
UTF_16
)
||
decoder
.
charset
().
equals
(
StandardCharsets
.
UTF_16BE
)
||
decoder
.
charset
().
equals
(
StandardCharsets
.
UTF_16LE
);
if
(
utf16
&&
(
fieldSize
&
1
)
!=
0
)
{
throw
new
BufferDataException
(
"fieldSize is not even for a UTF-16 string."
);
...
...
@@ -2168,10 +2178,8 @@ public abstract class AbstractIoBuffer extends IoBuffer {
int
oldLimit
=
limit
();
limit
(
position
()
+
length
);
ObjectInputStream
in
=
null
;
try
{
in
=
new
ObjectInputStream
(
asInputStream
())
{
try
(
ObjectInputStream
in
=
new
ObjectInputStream
(
asInputStream
())
{
@Override
protected
ObjectStreamClass
readClassDescriptor
()
throws
IOException
,
ClassNotFoundException
{
int
type
=
read
();
...
...
@@ -2205,19 +2213,11 @@ public abstract class AbstractIoBuffer extends IoBuffer {
return
clazz
;
}
}
}
;
}
)
{
return
in
.
readObject
();
}
catch
(
IOException
e
)
{
throw
new
BufferDataException
(
e
);
}
finally
{
try
{
if
(
in
!=
null
)
{
in
.
close
();
}
}
catch
(
IOException
ioe
)
{
// Nothing to do
}
limit
(
oldLimit
);
}
}
...
...
@@ -2229,10 +2229,8 @@ public abstract class AbstractIoBuffer extends IoBuffer {
public
IoBuffer
putObject
(
Object
o
)
{
int
oldPos
=
position
();
skip
(
4
);
// Make a room for the length field.
ObjectOutputStream
out
=
null
;
try
{
out
=
new
ObjectOutputStream
(
asOutputStream
())
{
try
(
ObjectOutputStream
out
=
new
ObjectOutputStream
(
asOutputStream
())
{
@Override
protected
void
writeClassDescriptor
(
ObjectStreamClass
desc
)
throws
IOException
{
Class
<?>
clazz
=
desc
.
forClass
();
...
...
@@ -2246,19 +2244,11 @@ public abstract class AbstractIoBuffer extends IoBuffer {
writeUTF
(
desc
.
getName
());
}
}
}
;
}
)
{
out
.
writeObject
(
o
);
out
.
flush
();
}
catch
(
IOException
e
)
{
throw
new
BufferDataException
(
e
);
}
finally
{
try
{
if
(
out
!=
null
)
{
out
.
close
();
}
}
catch
(
IOException
ioe
)
{
// Nothing to do
}
}
// Fill the length field
...
...
@@ -2496,6 +2486,7 @@ public abstract class AbstractIoBuffer extends IoBuffer {
/**
* {@inheritDoc}
*/
@Override
public
<
E
extends
Enum
<
E
>>
E
getEnumInt
(
int
index
,
Class
<
E
>
enumClass
)
{
return
toEnum
(
enumClass
,
getInt
(
index
));
}
...
...
@@ -2577,7 +2568,7 @@ public abstract class AbstractIoBuffer extends IoBuffer {
* {@inheritDoc}
*/
@Override
public
<
E
extends
Enum
<
E
>>
Enum
Set
<
E
>
getEnumSet
(
Class
<
E
>
enumClass
)
{
public
<
E
extends
Enum
<
E
>>
Set
<
E
>
getEnumSet
(
Class
<
E
>
enumClass
)
{
return
toEnumSet
(
enumClass
,
get
()
&
BYTE_MASK
);
}
...
...
@@ -2585,7 +2576,7 @@ public abstract class AbstractIoBuffer extends IoBuffer {
* {@inheritDoc}
*/
@Override
public
<
E
extends
Enum
<
E
>>
Enum
Set
<
E
>
getEnumSet
(
int
index
,
Class
<
E
>
enumClass
)
{
public
<
E
extends
Enum
<
E
>>
Set
<
E
>
getEnumSet
(
int
index
,
Class
<
E
>
enumClass
)
{
return
toEnumSet
(
enumClass
,
get
(
index
)
&
BYTE_MASK
);
}
...
...
@@ -2593,7 +2584,7 @@ public abstract class AbstractIoBuffer extends IoBuffer {
* {@inheritDoc}
*/
@Override
public
<
E
extends
Enum
<
E
>>
Enum
Set
<
E
>
getEnumSetShort
(
Class
<
E
>
enumClass
)
{
public
<
E
extends
Enum
<
E
>>
Set
<
E
>
getEnumSetShort
(
Class
<
E
>
enumClass
)
{
return
toEnumSet
(
enumClass
,
getShort
()
&
SHORT_MASK
);
}
...
...
@@ -2601,7 +2592,7 @@ public abstract class AbstractIoBuffer extends IoBuffer {
* {@inheritDoc}
*/
@Override
public
<
E
extends
Enum
<
E
>>
Enum
Set
<
E
>
getEnumSetShort
(
int
index
,
Class
<
E
>
enumClass
)
{
public
<
E
extends
Enum
<
E
>>
Set
<
E
>
getEnumSetShort
(
int
index
,
Class
<
E
>
enumClass
)
{
return
toEnumSet
(
enumClass
,
getShort
(
index
)
&
SHORT_MASK
);
}
...
...
@@ -2609,7 +2600,7 @@ public abstract class AbstractIoBuffer extends IoBuffer {
* {@inheritDoc}
*/
@Override
public
<
E
extends
Enum
<
E
>>
Enum
Set
<
E
>
getEnumSetInt
(
Class
<
E
>
enumClass
)
{
public
<
E
extends
Enum
<
E
>>
Set
<
E
>
getEnumSetInt
(
Class
<
E
>
enumClass
)
{
return
toEnumSet
(
enumClass
,
getInt
()
&
INT_MASK
);
}
...
...
@@ -2617,7 +2608,7 @@ public abstract class AbstractIoBuffer extends IoBuffer {
* {@inheritDoc}
*/
@Override
public
<
E
extends
Enum
<
E
>>
Enum
Set
<
E
>
getEnumSetInt
(
int
index
,
Class
<
E
>
enumClass
)
{
public
<
E
extends
Enum
<
E
>>
Set
<
E
>
getEnumSetInt
(
int
index
,
Class
<
E
>
enumClass
)
{
return
toEnumSet
(
enumClass
,
getInt
(
index
)
&
INT_MASK
);
}
...
...
@@ -2625,7 +2616,7 @@ public abstract class AbstractIoBuffer extends IoBuffer {
* {@inheritDoc}
*/
@Override
public
<
E
extends
Enum
<
E
>>
Enum
Set
<
E
>
getEnumSetLong
(
Class
<
E
>
enumClass
)
{
public
<
E
extends
Enum
<
E
>>
Set
<
E
>
getEnumSetLong
(
Class
<
E
>
enumClass
)
{
return
toEnumSet
(
enumClass
,
getLong
());
}
...
...
@@ -2633,7 +2624,7 @@ public abstract class AbstractIoBuffer extends IoBuffer {
* {@inheritDoc}
*/
@Override
public
<
E
extends
Enum
<
E
>>
Enum
Set
<
E
>
getEnumSetLong
(
int
index
,
Class
<
E
>
enumClass
)
{
public
<
E
extends
Enum
<
E
>>
Set
<
E
>
getEnumSetLong
(
int
index
,
Class
<
E
>
enumClass
)
{
return
toEnumSet
(
enumClass
,
getLong
(
index
));
}
...
...
src/mina-core/src/main/java/org/apache/mina/core/buffer/BufferDataException.java
View file @
76b32cea
...
...
@@ -29,18 +29,36 @@ package org.apache.mina.core.buffer;
public
class
BufferDataException
extends
RuntimeException
{
private
static
final
long
serialVersionUID
=
-
4138189188602563502L
;
/**
* Create a new BufferDataException instance
*/
public
BufferDataException
()
{
super
();
}
/**
* Create a new BufferDataException instance
*
* @param message The exception message
*/
public
BufferDataException
(
String
message
)
{
super
(
message
);
}
/**
* Create a new BufferDataException instance
*
* @param message The exception message
* @param cause The original cause
*/
public
BufferDataException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
/**
* Create a new BufferDataException instance
* @param cause The original cause
*/
public
BufferDataException
(
Throwable
cause
)
{
super
(
cause
);
}
...
...
src/mina-core/src/main/java/org/apache/mina/core/buffer/CachedBufferAllocator.java
View file @
76b32cea
...
...
@@ -133,7 +133,7 @@ public class CachedBufferAllocator implements IoBufferAllocator {
}
Map
<
Integer
,
Queue
<
CachedBuffer
>>
newPoolMap
()
{
Map
<
Integer
,
Queue
<
CachedBuffer
>>
poolMap
=
new
HashMap
<
Integer
,
Queue
<
CachedBuffer
>
>();
Map
<
Integer
,
Queue
<
CachedBuffer
>>
poolMap
=
new
HashMap
<>();
for
(
int
i
=
0
;
i
<
31
;
i
++)
{
poolMap
.
put
(
1
<<
i
,
new
ConcurrentLinkedQueue
<
CachedBuffer
>());
...
...
@@ -145,6 +145,10 @@ public class CachedBufferAllocator implements IoBufferAllocator {
return
poolMap
;
}
/**
* {@inheritDoc}
*/
@Override
public
IoBuffer
allocate
(
int
requestedCapacity
,
boolean
direct
)
{
int
actualCapacity
=
IoBuffer
.
normalizeCapacity
(
requestedCapacity
);
IoBuffer
buf
;
...
...
@@ -184,14 +188,26 @@ public class CachedBufferAllocator implements IoBufferAllocator {
return
buf
;
}
/**
* {@inheritDoc}
*/
@Override
public
ByteBuffer
allocateNioBuffer
(
int
capacity
,
boolean
direct
)
{
return
allocate
(
capacity
,
direct
).
buf
();
}
/**
* {@inheritDoc}
*/
@Override
public
IoBuffer
wrap
(
ByteBuffer
nioBuffer
)
{
return
new
CachedBuffer
(
nioBuffer
);
}
/**
* {@inheritDoc}
*/
@Override
public
void
dispose
()
{
// Do nothing
}
...
...
src/mina-core/src/main/java/org/apache/mina/core/buffer/IoBuffer.java
View file @
76b32cea
...
...
@@ -30,7 +30,6 @@ import java.nio.DoubleBuffer;
import
java.nio.FloatBuffer
;
import
java.nio.IntBuffer
;
import
java.nio.LongBuffer
;
import
java.nio.ReadOnlyBufferException
;
import
java.nio.ShortBuffer
;
import
java.nio.charset.CharacterCodingException
;
import
java.nio.charset.CharsetDecoder
;
...
...
@@ -152,6 +151,14 @@ public abstract class IoBuffer implements Comparable<IoBuffer> {
/** A flag indicating which type of buffer we are using : heap or direct */
private
static
boolean
useDirectBuffer
=
false
;
/**
* Creates a new instance. This is an empty constructor. It's protected,
* to forbid its usage by the users.
*/
protected
IoBuffer
()
{
// Do nothing
}
/**
* @return the allocator used by existing and new buffers
*/
...
...
@@ -283,14 +290,6 @@ public abstract class IoBuffer implements Comparable<IoBuffer> {
return
newCapacity
<
0
?
Integer
.
MAX_VALUE
:
newCapacity
;
}
/**
* Creates a new instance. This is an empty constructor. It's protected,
* to forbid its usage by the users.
*/
protected
IoBuffer
()
{
// Do nothing
}
/**
* Declares this buffer and all its derived buffers are not used anymore so
* that it can be reused by some {@link IoBufferAllocator} implementations.
...
...
@@ -1088,9 +1087,6 @@ public abstract class IoBuffer implements Comparable<IoBuffer> {
* @param value The medium int value to be written
*
* @return the modified IoBuffer
*
* @throws BufferOverflowException If there are fewer than three bytes remaining in this buffer
* @throws ReadOnlyBufferException If this buffer is read-only
*/
public
abstract
IoBuffer
putMediumInt
(
int
value
);
...
...
@@ -1110,8 +1106,6 @@ public abstract class IoBuffer implements Comparable<IoBuffer> {
* @throws IndexOutOfBoundsException
* If <tt>index</tt> is negative or not smaller than the
* buffer's limit, minus three
*
* @throws ReadOnlyBufferException If this buffer is read-only
*/
public
abstract
IoBuffer
putMediumInt
(
int
index
,
int
value
);
...
...
@@ -1326,9 +1320,6 @@ public abstract class IoBuffer implements Comparable<IoBuffer> {
*
* @param index the position in the buffer to write the value
* @param value the int to write
*
* @param index The position where to put the unsigned short
* @param value The unsigned short to put in the IoBuffer
* @return the modified IoBuffer
*/
public
abstract
IoBuffer
putUnsignedShort
(
int
index
,
int
value
);
...
...
@@ -1372,7 +1363,6 @@ public abstract class IoBuffer implements Comparable<IoBuffer> {
* @param index The position where to put the int
* @param value The int to put in the IoBuffer
* @return the modified IoBuffer
* @return the modified IoBuffer
*/
public
abstract
IoBuffer
putInt
(
int
index
,
int
value
);
...
...
@@ -1412,7 +1402,6 @@ public abstract class IoBuffer implements Comparable<IoBuffer> {
* @param index The position where to put the long
* @param value The long to put in the IoBuffer
* @return the modified IoBuffer
* @return the modified IoBuffer
*/
public
abstract
IoBuffer
putLong
(
int
index
,
long
value
);
...
...
@@ -1937,7 +1926,7 @@ public abstract class IoBuffer implements Comparable<IoBuffer> {
* @param enumClass the enum class used to create the EnumSet
* @return the EnumSet representation of the bit vector
*/
public
abstract
<
E
extends
Enum
<
E
>>
Enum
Set
<
E
>
getEnumSet
(
Class
<
E
>
enumClass
);
public
abstract
<
E
extends
Enum
<
E
>>
Set
<
E
>
getEnumSet
(
Class
<
E
>
enumClass
);
/**
* Reads a byte sized bit vector and converts it to an {@link EnumSet}.
...
...
@@ -1948,7 +1937,7 @@ public abstract class IoBuffer implements Comparable<IoBuffer> {
* @param enumClass the enum class used to create the EnumSet
* @return the EnumSet representation of the bit vector
*/
public
abstract
<
E
extends
Enum
<
E
>>
Enum
Set
<
E
>
getEnumSet
(
int
index
,
Class
<
E
>
enumClass
);
public
abstract
<
E
extends
Enum
<
E
>>
Set
<
E
>
getEnumSet
(
int
index
,
Class
<
E
>
enumClass
);
/**
* Reads a short sized bit vector and converts it to an {@link EnumSet}.
...
...
@@ -1958,7 +1947,7 @@ public abstract class IoBuffer implements Comparable<IoBuffer> {
* @param enumClass the enum class used to create the EnumSet
* @return the EnumSet representation of the bit vector
*/
public
abstract
<
E
extends
Enum
<
E
>>
Enum
Set
<
E
>
getEnumSetShort
(
Class
<
E
>
enumClass
);
public
abstract
<
E
extends
Enum
<
E
>>
Set
<
E
>
getEnumSetShort
(
Class
<
E
>
enumClass
);
/**
* Reads a short sized bit vector and converts it to an {@link EnumSet}.
...
...
@@ -1969,7 +1958,7 @@ public abstract class IoBuffer implements Comparable<IoBuffer> {
* @param enumClass the enum class used to create the EnumSet
* @return the EnumSet representation of the bit vector
*/
public
abstract
<
E
extends
Enum
<
E
>>
Enum
Set
<
E
>
getEnumSetShort
(
int
index
,
Class
<
E
>
enumClass
);
public
abstract
<
E
extends
Enum
<
E
>>
Set
<
E
>
getEnumSetShort
(
int
index
,
Class
<
E
>
enumClass
);
/**
* Reads an int sized bit vector and converts it to an {@link EnumSet}.
...
...
@@ -1979,7 +1968,7 @@ public abstract class IoBuffer implements Comparable<IoBuffer> {
* @param enumClass the enum class used to create the EnumSet
* @return the EnumSet representation of the bit vector
*/
public
abstract
<
E
extends
Enum
<
E
>>
Enum
Set
<
E
>
getEnumSetInt
(
Class
<
E
>
enumClass
);
public
abstract
<
E
extends
Enum
<
E
>>
Set
<
E
>
getEnumSetInt
(
Class
<
E
>
enumClass
);
/**
* Reads an int sized bit vector and converts it to an {@link EnumSet}.
...
...
@@ -1990,7 +1979,7 @@ public abstract class IoBuffer implements Comparable<IoBuffer> {
* @param enumClass the enum class used to create the EnumSet
* @return the EnumSet representation of the bit vector
*/
public
abstract
<
E
extends
Enum
<
E
>>
Enum
Set
<
E
>
getEnumSetInt
(
int
index
,
Class
<
E
>
enumClass
);
public
abstract
<
E
extends
Enum
<
E
>>
Set
<
E
>
getEnumSetInt
(
int
index
,
Class
<
E
>
enumClass
);
/**
* Reads a long sized bit vector and converts it to an {@link EnumSet}.
...
...
@@ -2000,7 +1989,7 @@ public abstract class IoBuffer implements Comparable<IoBuffer> {
* @param enumClass the enum class used to create the EnumSet
* @return the EnumSet representation of the bit vector
*/
public
abstract
<
E
extends
Enum
<
E
>>
Enum
Set
<
E
>
getEnumSetLong
(
Class
<
E
>
enumClass
);
public
abstract
<
E
extends
Enum
<
E
>>
Set
<
E
>
getEnumSetLong
(
Class
<
E
>
enumClass
);
/**
* Reads a long sized bit vector and converts it to an {@link EnumSet}.
...
...
@@ -2011,7 +2000,7 @@ public abstract class IoBuffer implements Comparable<IoBuffer> {
* @param enumClass the enum class used to create the EnumSet
* @return the EnumSet representation of the bit vector
*/
public
abstract
<
E
extends
Enum
<
E
>>
Enum
Set
<
E
>
getEnumSetLong
(
int
index
,
Class
<
E
>
enumClass
);
public
abstract
<
E
extends
Enum
<
E
>>
Set
<
E
>
getEnumSetLong
(
int
index
,
Class
<
E
>
enumClass
);
/**
* Writes the specified {@link Set} to the buffer as a byte sized bit
...
...
src/mina-core/src/main/java/org/apache/mina/core/buffer/IoBufferHexDumper.java
View file @
76b32cea
...
...
@@ -20,7 +20,8 @@
package
org.apache.mina.core.buffer
;
/**
* Provides utility methods to dump an {@link IoBuffer} into a hex formatted string.
* Provides utility methods to dump an {@link IoBuffer} into a hex formatted
* string.
*
* @author <a href="http://mina.apache.org">Apache MINA Project</a>
*/
...
...
@@ -60,19 +61,22 @@ class IoBufferHexDumper {
*
* @param in the buffer to dump
* @param lengthLimit the limit at which hex dumping will stop
* @return a hex formatted string representation of the <i>in</i> {@link Io
b
uffer}.
* @return a hex formatted string representation of the <i>in</i> {@link Io
B
uffer}.
*/
public
static
String
getHexdump
(
IoBuffer
in
,
int
lengthLimit
)
{
if
(
lengthLimit
==
0
)
{
throw
new
IllegalArgumentException
(
"lengthLimit: "
+
lengthLimit
+
" (expected: 1+)"
);
}
boolean
truncate
=
in
.
remaining
()
>
lengthLimit
;
int
limit
=
in
.
limit
();
int
pos
=
in
.
position
();
boolean
truncate
=
limit
-
pos
>
lengthLimit
;
int
size
;
if
(
truncate
)
{
size
=
lengthLimit
;
}
else
{
size
=
in
.
remaining
()
;
size
=
limit
-
pos
;
}
if
(
size
==
0
)
{
...
...
@@ -81,24 +85,19 @@ class IoBufferHexDumper {
StringBuilder
out
=
new
StringBuilder
(
size
*
3
+
3
);
int
mark
=
in
.
position
();
// fill the first
int
byteValue
=
in
.
get
()
&
0xFF
;
int
byteValue
=
in
.
get
(
pos
++
)
&
0xFF
;
out
.
append
((
char
)
highDigits
[
byteValue
]);
out
.
append
((
char
)
lowDigits
[
byteValue
]);
size
--;
// and the others, too
for
(;
size
>
0
;
size
--
)
{
for
(;
pos
<
limit
;
)
{
out
.
append
(
' '
);
byteValue
=
in
.
get
()
&
0xFF
;
byteValue
=
in
.
get
(
pos
++
)
&
0xFF
;
out
.
append
((
char
)
highDigits
[
byteValue
]);
out
.
append
((
char
)
lowDigits
[
byteValue
]);
}
in
.
position
(
mark
);
if
(
truncate
)
{
out
.
append
(
"..."
);
}
...
...
src/mina-core/src/main/java/org/apache/mina/core/buffer/IoBufferWrapper.java
View file @
76b32cea
This diff is collapsed.
Click to expand it.
src/mina-core/src/main/java/org/apache/mina/core/file/DefaultFileRegion.java
View file @
76b32cea
...
...
@@ -23,25 +23,42 @@ import java.io.IOException;
import
java.nio.channels.FileChannel
;
/**
* TODO Add documentation
* Manage a File to be sent to a remote host. We keep a track on the current
* position, and the number of already written bytes.
*
*
* @author <a href="http://mina.apache.org">Apache MINA Project</a>
*/
public
class
DefaultFileRegion
implements
FileRegion
{
/** The channel used to manage the file */
private
final
FileChannel
channel
;
/** The original position in the file */
private
final
long
originalPosition
;
/** The position in teh file */
private
long
position
;
/** The number of bytes remaining to write */
private
long
remainingBytes
;
/**
* Creates a new DefaultFileRegion instance
*
* @param channel The channel mapped over the file
* @throws IOException If we had an IO error
*/
public
DefaultFileRegion
(
FileChannel
channel
)
throws
IOException
{
this
(
channel
,
0
,
channel
.
size
());
}
/**
* Creates a new DefaultFileRegion instance
*
* @param channel The channel mapped over the file
* @param position The position in teh file
* @param remainingBytes The remaining bytes
*/
public
DefaultFileRegion
(
FileChannel
channel
,
long
position
,
long
remainingBytes
)
{
if
(
channel
==
null
)
{
throw
new
IllegalArgumentException
(
"channel can not be null"
);
...
...
@@ -61,29 +78,52 @@ public class DefaultFileRegion implements FileRegion {
this
.
remainingBytes
=
remainingBytes
;
}
/**
* {@inheritDoc}
*/
@Override
public
long
getWrittenBytes
()
{
return
position
-
originalPosition
;
}
/**
* {@inheritDoc}
*/
@Override
public
long
getRemainingBytes
()
{
return
remainingBytes
;
}
/**
* {@inheritDoc}
*/
@Override
public
FileChannel
getFileChannel
()
{
return
channel
;
}
/**
* {@inheritDoc}
*/
@Override
public
long
getPosition
()
{
return
position
;
}
/**
* {@inheritDoc}
*/
@Override
public
void
update
(
long
value
)
{
position
+=
value
;
remainingBytes
-=
value
;
}
/**
* {@inheritDoc}
*/
@Override
public
String
getFilename
()
{
return
null
;
}
}
src/mina-core/src/main/java/org/apache/mina/core/file/FileRegion.java
View file @
76b32cea
...
...
@@ -49,8 +49,7 @@ public interface FileRegion {
* {@link #getWrittenBytes()} by the given amount and decreases the value
* returned by {@link #getRemainingBytes()} by the given {@code amount}.
*
* @param amount
* The new value for the file position.
* @param amount The new value for the file position.
*/
void
update
(
long
amount
);
...
...
src/mina-core/src/main/java/org/apache/mina/core/file/FilenameFileRegion.java
View file @
76b32cea
...
...
@@ -24,8 +24,8 @@ import java.io.IOException;
import
java.nio.channels.FileChannel
;
/**
*
TODO Add documentation
*
*
Manage a File to be sent to a remote host. We keep a track on the current
*
position, and the number of already written bytes.
*
* @author The Apache MINA Project (dev@mina.apache.org)
* @version $Rev$, $Date$
...
...
@@ -34,10 +34,24 @@ public class FilenameFileRegion extends DefaultFileRegion {
private
final
File
file
;
public
FilenameFileRegion
(
File
file
,
FileChannel
channel
)
throws
IOException
{
/**
* Create a new FilenameFileRegion instance
*
* @param file The file to manage
* @param channel The channel over the file
*/
public
FilenameFileRegion
(
File
file
,
FileChannel
channel
)
{
this
(
file
,
channel
,
0
,
file
.
length
());
}
/**
* Create a new FilenameFileRegion instance
*
* @param file The file to manage
* @param channel The channel over the file
* @param position The position in teh file
* @param remainingBytes The remaining bytes
*/
public
FilenameFileRegion
(
File
file
,
FileChannel
channel
,
long
position
,
long
remainingBytes
)
{
super
(
channel
,
position
,
remainingBytes
);
...
...
@@ -48,6 +62,10 @@ public class FilenameFileRegion extends DefaultFileRegion {
this
.
file
=
file
;
}
/**
* {@inheritDoc}
*/
@Override
public
String
getFilename
()
{
return
file
.
getAbsolutePath
();
}
...
...
src/mina-core/src/main/java/org/apache/mina/core/filterchain/DefaultIoFilterChain.java
View file @
76b32cea
...
...
@@ -59,7 +59,7 @@ public class DefaultIoFilterChain implements IoFilterChain {
private
final
AbstractIoSession
session
;
/** The mapping between the filters and their associated name */
private
final
Map
<
String
,
Entry
>
name2entry
=
new
ConcurrentHashMap
<
String
,
Entry
>();
private
final
Map
<
String
,
Entry
>
name2entry
=
new
ConcurrentHashMap
<>();
/** The chain head */
private
final
EntryImpl
head
;
...
...
@@ -68,7 +68,7 @@ public class DefaultIoFilterChain implements IoFilterChain {
private
final
EntryImpl
tail
;
/** The logger for this class */
private
final
static
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
DefaultIoFilterChain
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
DefaultIoFilterChain
.
class
);
/**
* Create a new default chain, associated with a session. It will only contain a
...
...
@@ -87,10 +87,18 @@ public class DefaultIoFilterChain implements IoFilterChain {
head
.
nextEntry
=
tail
;
}
/**
* {@inheritDoc}
*/
@Override
public
IoSession
getSession
()
{
return
session
;
}
/**
* {@inheritDoc}
*/
@Override
public
Entry
getEntry
(
String
name
)
{
Entry
e
=
name2entry
.
get
(
name
);
...
...
@@ -101,6 +109,10 @@ public class DefaultIoFilterChain implements IoFilterChain {
return
e
;
}
/**
* {@inheritDoc}
*/
@Override
public
Entry
getEntry
(
IoFilter
filter
)
{
EntryImpl
e
=
head
.
nextEntry
;
...
...
@@ -115,6 +127,10 @@ public class DefaultIoFilterChain implements IoFilterChain {
return
null
;
}
/**
* {@inheritDoc}
*/
@Override
public
Entry
getEntry
(
Class
<?
extends
IoFilter
>
filterType
)
{
EntryImpl
e
=
head
.
nextEntry
;
...
...
@@ -129,6 +145,10 @@ public class DefaultIoFilterChain implements IoFilterChain {
return
null
;
}
/**
* {@inheritDoc}
*/
@Override
public
IoFilter
get
(
String
name
)
{
Entry
e
=
getEntry
(
name
);
...
...
@@ -139,6 +159,10 @@ public class DefaultIoFilterChain implements IoFilterChain {
return
e
.
getFilter
();
}
/**
* {@inheritDoc}
*/
@Override
public
IoFilter
get
(
Class
<?
extends
IoFilter
>
filterType
)
{
Entry
e
=
getEntry
(
filterType
);
...
...
@@ -149,6 +173,10 @@ public class DefaultIoFilterChain implements IoFilterChain {
return
e
.
getFilter
();
}
/**
* {@inheritDoc}
*/
@Override
public
NextFilter
getNextFilter
(
String
name
)
{
Entry
e
=
getEntry
(
name
);
...
...
@@ -159,6 +187,10 @@ public class DefaultIoFilterChain implements IoFilterChain {
return
e
.
getNextFilter
();
}
/**
* {@inheritDoc}
*/
@Override
public
NextFilter
getNextFilter
(
IoFilter
filter
)
{
Entry
e
=
getEntry
(
filter
);
...
...
@@ -169,6 +201,10 @@ public class DefaultIoFilterChain implements IoFilterChain {
return
e
.
getNextFilter
();
}
/**
* {@inheritDoc}
*/
@Override
public
NextFilter
getNextFilter
(
Class
<?
extends
IoFilter
>
filterType
)
{
Entry
e
=
getEntry
(
filterType
);
...
...
@@ -179,34 +215,59 @@ public class DefaultIoFilterChain implements IoFilterChain {
return
e
.
getNextFilter
();
}
/**
* {@inheritDoc}
*/
@Override
public
synchronized
void
addFirst
(
String
name
,
IoFilter
filter
)
{
checkAddable
(
name
);
register
(
head
,
name
,
filter
);
}
/**
* {@inheritDoc}
*/
@Override
public
synchronized
void
addLast
(
String
name
,
IoFilter
filter
)
{
checkAddable
(
name
);
register
(
tail
.
prevEntry
,
name
,
filter
);
}
/**
* {@inheritDoc}
*/
@Override
public
synchronized
void
addBefore
(
String
baseName
,
String
name
,
IoFilter
filter
)
{
EntryImpl
baseEntry
=
checkOldName
(
baseName
);
checkAddable
(
name
);
register
(
baseEntry
.
prevEntry
,
name
,
filter
);
}
/**
* {@inheritDoc}
*/
@Override
public
synchronized
void
addAfter
(
String
baseName
,
String
name
,
IoFilter
filter
)
{
EntryImpl
baseEntry
=
checkOldName
(
baseName
);
checkAddable
(
name
);
register
(
baseEntry
,
name
,
filter
);
}
/**
* {@inheritDoc}
*/
@Override
public
synchronized
IoFilter
remove
(
String
name
)
{
EntryImpl
entry
=
checkOldName
(
name
);
deregister
(
entry
);
return
entry
.
getFilter
();
}
/**
* {@inheritDoc}
*/
@Override
public
synchronized
void
remove
(
IoFilter
filter
)
{
EntryImpl
e
=
head
.
nextEntry
;
...
...
@@ -223,6 +284,10 @@ public class DefaultIoFilterChain implements IoFilterChain {
throw
new
IllegalArgumentException
(
"Filter not found: "
+
filter
.
getClass
().
getName
());
}
/**
* {@inheritDoc}
*/
@Override
public
synchronized
IoFilter
remove
(
Class
<?
extends
IoFilter
>
filterType
)
{
EntryImpl
e
=
head
.
nextEntry
;
...
...
@@ -240,6 +305,10 @@ public class DefaultIoFilterChain implements IoFilterChain {
throw
new
IllegalArgumentException
(
"Filter not found: "
+
filterType
.
getName
());
}
/**
* {@inheritDoc}
*/
@Override
public
synchronized
IoFilter
replace
(
String
name
,
IoFilter
newFilter
)
{
EntryImpl
entry
=
checkOldName
(
name
);
IoFilter
oldFilter
=
entry
.
getFilter
();
...
...
@@ -265,6 +334,10 @@ public class DefaultIoFilterChain implements IoFilterChain {
return
oldFilter
;
}
/**
* {@inheritDoc}
*/
@Override
public
synchronized
void
replace
(
IoFilter
oldFilter
,
IoFilter
newFilter
)
{
EntryImpl
entry
=
head
.
nextEntry
;
...
...
@@ -311,6 +384,10 @@ public class DefaultIoFilterChain implements IoFilterChain {
throw
new
IllegalArgumentException
(
"Filter not found: "
+
oldFilter
.
getClass
().
getName
());
}
/**
* {@inheritDoc}
*/
@Override
public
synchronized
IoFilter
replace
(
Class
<?
extends
IoFilter
>
oldFilterType
,
IoFilter
newFilter
)
{
EntryImpl
entry
=
head
.
nextEntry
;
...
...
@@ -357,8 +434,12 @@ public class DefaultIoFilterChain implements IoFilterChain {
throw
new
IllegalArgumentException
(
"Filter not found: "
+
oldFilterType
.
getName
());
}
/**
* {@inheritDoc}
*/
@Override
public
synchronized
void
clear
()
throws
Exception
{
List
<
IoFilterChain
.
Entry
>
l
=
new
ArrayList
<
IoFilterChain
.
Entry
>(
name2entry
.
values
());
List
<
IoFilterChain
.
Entry
>
l
=
new
ArrayList
<>(
name2entry
.
values
());
for
(
IoFilterChain
.
Entry
entry
:
l
)
{
try
{
...
...
@@ -448,6 +529,10 @@ public class DefaultIoFilterChain implements IoFilterChain {
}
}
/**
* {@inheritDoc}
*/
@Override
public
void
fireSessionCreated
()
{
callNextSessionCreated
(
head
,
session
);
}
...
...
@@ -465,6 +550,10 @@ public class DefaultIoFilterChain implements IoFilterChain {
}
}
/**
* {@inheritDoc}
*/
@Override
public
void
fireSessionOpened
()
{
callNextSessionOpened
(
head
,
session
);
}
...
...
@@ -482,6 +571,10 @@ public class DefaultIoFilterChain implements IoFilterChain {
}
}
/**
* {@inheritDoc}
*/
@Override
public
void
fireSessionClosed
()
{
// Update future.
try
{
...
...
@@ -502,13 +595,15 @@ public class DefaultIoFilterChain implements IoFilterChain {
IoFilter
filter
=
entry
.
getFilter
();
NextFilter
nextFilter
=
entry
.
getNextFilter
();
filter
.
sessionClosed
(
nextFilter
,
session
);
}
catch
(
Exception
e
)
{
fireExceptionCaught
(
e
);
}
catch
(
Error
e
)
{
}
catch
(
Exception
|
Error
e
)
{
fireExceptionCaught
(
e
);
}
}
/**
* {@inheritDoc}
*/
@Override
public
void
fireSessionIdle
(
IdleStatus
status
)
{
session
.
increaseIdleCount
(
status
,
System
.
currentTimeMillis
());
callNextSessionIdle
(
head
,
session
,
status
);
...
...
@@ -527,6 +622,10 @@ public class DefaultIoFilterChain implements IoFilterChain {
}
}
/**
* {@inheritDoc}
*/
@Override
public
void
fireMessageReceived
(
Object
message
)
{
if
(
message
instanceof
IoBuffer
)
{
session
.
increaseReadBytes
(((
IoBuffer
)
message
).
remaining
(),
System
.
currentTimeMillis
());
...
...
@@ -548,6 +647,10 @@ public class DefaultIoFilterChain implements IoFilterChain {
}
}
/**
* {@inheritDoc}
*/
@Override
public
void
fireMessageSent
(
WriteRequest
request
)
{
try
{
request
.
getFuture
().
setWritten
();
...
...
@@ -576,6 +679,10 @@ public class DefaultIoFilterChain implements IoFilterChain {
}
}
/**
* {@inheritDoc}
*/
@Override
public
void
fireExceptionCaught
(
Throwable
cause
)
{
callNextExceptionCaught
(
head
,
session
,
cause
);
}
...
...
@@ -603,6 +710,10 @@ public class DefaultIoFilterChain implements IoFilterChain {
}
}
/**
* {@inheritDoc}
*/
@Override
public
void
fireInputClosed
()
{
Entry
head
=
this
.
head
;
callNextInputClosed
(
head
,
session
);
...
...
@@ -618,6 +729,10 @@ public class DefaultIoFilterChain implements IoFilterChain {
}
}
/**
* {@inheritDoc}
*/
@Override
public
void
fireFilterWrite
(
WriteRequest
writeRequest
)
{
callPreviousFilterWrite
(
tail
,
session
,
writeRequest
);
}
...
...
@@ -637,6 +752,10 @@ public class DefaultIoFilterChain implements IoFilterChain {
}
}
/**
* {@inheritDoc}
*/
@Override
public
void
fireFilterClose
()
{
callPreviousFilterClose
(
tail
,
session
);
}
...
...
@@ -654,8 +773,12 @@ public class DefaultIoFilterChain implements IoFilterChain {
}
}
/**
* {@inheritDoc}
*/
@Override
public
List
<
Entry
>
getAll
()
{
List
<
Entry
>
list
=
new
ArrayList
<
Entry
>();
List
<
Entry
>
list
=
new
ArrayList
<>();
EntryImpl
e
=
head
.
nextEntry
;
while
(
e
!=
tail
)
{
...
...
@@ -666,8 +789,12 @@ public class DefaultIoFilterChain implements IoFilterChain {
return
list
;
}
/**
* {@inheritDoc}
*/
@Override
public
List
<
Entry
>
getAllReversed
()
{
List
<
Entry
>
list
=
new
ArrayList
<
Entry
>();
List
<
Entry
>
list
=
new
ArrayList
<>();
EntryImpl
e
=
tail
.
prevEntry
;
while
(
e
!=
head
)
{
...
...
@@ -678,14 +805,26 @@ public class DefaultIoFilterChain implements IoFilterChain {
return
list
;
}
/**
* {@inheritDoc}
*/
@Override
public
boolean
contains
(
String
name
)
{
return
getEntry
(
name
)
!=
null
;
}
/**
* {@inheritDoc}
*/
@Override
public
boolean
contains
(
IoFilter
filter
)
{
return
getEntry
(
filter
)
!=
null
;
}
/**
* {@inheritDoc}
*/
@Override
public
boolean
contains
(
Class
<?
extends
IoFilter
>
filterType
)
{
return
getEntry
(
filterType
)
!=
null
;
}
...
...
@@ -728,7 +867,6 @@ public class DefaultIoFilterChain implements IoFilterChain {
@SuppressWarnings
(
"unchecked"
)
@Override
public
void
filterWrite
(
NextFilter
nextFilter
,
IoSession
session
,
WriteRequest
writeRequest
)
throws
Exception
{
AbstractIoSession
s
=
(
AbstractIoSession
)
session
;
// Maintain counters.
...
...
@@ -743,7 +881,9 @@ public class DefaultIoFilterChain implements IoFilterChain {
if
(
remaining
>
0
)
{
s
.
increaseScheduledWriteBytes
(
remaining
);
}
}
else
{
}
if
(!
writeRequest
.
isEncoded
())
{
s
.
increaseScheduledWriteMessages
();
}
...
...
@@ -762,6 +902,7 @@ public class DefaultIoFilterChain implements IoFilterChain {
}
}
@SuppressWarnings
(
"unchecked"
)
@Override
public
void
filterClose
(
NextFilter
nextFilter
,
IoSession
session
)
throws
Exception
{
...
...
@@ -842,9 +983,7 @@ public class DefaultIoFilterChain implements IoFilterChain {
public
void
messageReceived
(
NextFilter
nextFilter
,
IoSession
session
,
Object
message
)
throws
Exception
{
AbstractIoSession
s
=
(
AbstractIoSession
)
session
;
if
(!(
message
instanceof
IoBuffer
))
{
s
.
increaseReadMessages
(
System
.
currentTimeMillis
());
}
else
if
(!((
IoBuffer
)
message
).
hasRemaining
())
{
if
(!(
message
instanceof
IoBuffer
)
||
!((
IoBuffer
)
message
).
hasRemaining
())
{
s
.
increaseReadMessages
(
System
.
currentTimeMillis
());
}
...
...
@@ -912,66 +1051,118 @@ public class DefaultIoFilterChain implements IoFilterChain {
this
.
name
=
name
;
this
.
filter
=
filter
;
this
.
nextFilter
=
new
NextFilter
()
{
/**
* {@inheritDoc}
*/
@Override
public
void
sessionCreated
(
IoSession
session
)
{
Entry
nextEntry
=
EntryImpl
.
this
.
nextEntry
;
callNextSessionCreated
(
nextEntry
,
session
);
}
/**
* {@inheritDoc}
*/
@Override
public
void
sessionOpened
(
IoSession
session
)
{
Entry
nextEntry
=
EntryImpl
.
this
.
nextEntry
;
callNextSessionOpened
(
nextEntry
,
session
);
}
/**
* {@inheritDoc}
*/
@Override
public
void
sessionClosed
(
IoSession
session
)
{
Entry
nextEntry
=
EntryImpl
.
this
.
nextEntry
;
callNextSessionClosed
(
nextEntry
,
session
);
}
/**
* {@inheritDoc}
*/
@Override
public
void
sessionIdle
(
IoSession
session
,
IdleStatus
status
)
{
Entry
nextEntry
=
EntryImpl
.
this
.
nextEntry
;
callNextSessionIdle
(
nextEntry
,
session
,
status
);
}
/**
* {@inheritDoc}
*/
@Override
public
void
exceptionCaught
(
IoSession
session
,
Throwable
cause
)
{
Entry
nextEntry
=
EntryImpl
.
this
.
nextEntry
;
callNextExceptionCaught
(
nextEntry
,
session
,
cause
);
}
/**
* {@inheritDoc}
*/
@Override
public
void
inputClosed
(
IoSession
session
)
{
Entry
nextEntry
=
EntryImpl
.
this
.
nextEntry
;
callNextInputClosed
(
nextEntry
,
session
);
}
/**
* {@inheritDoc}
*/
@Override
public
void
messageReceived
(
IoSession
session
,
Object
message
)
{
Entry
nextEntry
=
EntryImpl
.
this
.
nextEntry
;
callNextMessageReceived
(
nextEntry
,
session
,
message
);
}
/**
* {@inheritDoc}
*/
@Override
public
void
messageSent
(
IoSession
session
,
WriteRequest
writeRequest
)
{
Entry
nextEntry
=
EntryImpl
.
this
.
nextEntry
;
callNextMessageSent
(
nextEntry
,
session
,
writeRequest
);
}
/**
* {@inheritDoc}
*/
@Override
public
void
filterWrite
(
IoSession
session
,
WriteRequest
writeRequest
)
{
Entry
nextEntry
=
EntryImpl
.
this
.
prevEntry
;
callPreviousFilterWrite
(
nextEntry
,
session
,
writeRequest
);
}
/**
* {@inheritDoc}
*/
@Override
public
void
filterClose
(
IoSession
session
)
{
Entry
nextEntry
=
EntryImpl
.
this
.
prevEntry
;
callPreviousFilterClose
(
nextEntry
,
session
);
}
/**
* {@inheritDoc}
*/
@Override
public
String
toString
()
{
return
EntryImpl
.
this
.
nextEntry
.
name
;
}
};
}
/**
* {@inheritDoc}
*/
@Override
public
String
getName
()
{
return
name
;
}
/**
* {@inheritDoc}
*/
@Override
public
IoFilter
getFilter
()
{
return
filter
;
}
...
...
@@ -984,6 +1175,10 @@ public class DefaultIoFilterChain implements IoFilterChain {
this
.
filter
=
filter
;
}
/**
* {@inheritDoc}
*/
@Override
public
NextFilter
getNextFilter
()
{
return
nextFilter
;
}
...
...
@@ -1022,18 +1217,34 @@ public class DefaultIoFilterChain implements IoFilterChain {
return
sb
.
toString
();
}
/**
* {@inheritDoc}
*/
@Override
public
void
addAfter
(
String
name
,
IoFilter
filter
)
{
DefaultIoFilterChain
.
this
.
addAfter
(
getName
(),
name
,
filter
);
}
/**
* {@inheritDoc}
*/
@Override
public
void
addBefore
(
String
name
,
IoFilter
filter
)
{
DefaultIoFilterChain
.
this
.
addBefore
(
getName
(),
name
,
filter
);
}
/**
* {@inheritDoc}
*/
@Override
public
void
remove
()
{
DefaultIoFilterChain
.
this
.
remove
(
getName
());
}
/**
* {@inheritDoc}
*/
@Override
public
void
replace
(
IoFilter
newFilter
)
{
DefaultIoFilterChain
.
this
.
replace
(
getName
(),
newFilter
);
}
...
...
src/mina-core/src/main/java/org/apache/mina/core/filterchain/DefaultIoFilterChainBuilder.java
View file @
76b32cea
...
...
@@ -60,16 +60,17 @@ import org.slf4j.LoggerFactory;
* @org.apache.xbean.XBean
*/
public
class
DefaultIoFilterChainBuilder
implements
IoFilterChainBuilder
{
/** The logger */
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
DefaultIoFilterChainBuilder
.
class
);
private
final
static
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
DefaultIoFilterChainBuilder
.
class
);
/** The list of filters */
private
final
List
<
Entry
>
entries
;
/**
* Creates a new instance with an empty filter list.
*/
public
DefaultIoFilterChainBuilder
()
{
entries
=
new
CopyOnWriteArrayList
<
Entry
>();
entries
=
new
CopyOnWriteArrayList
<>();
}
/**
...
...
@@ -81,7 +82,7 @@ public class DefaultIoFilterChainBuilder implements IoFilterChainBuilder {
if
(
filterChain
==
null
)
{
throw
new
IllegalArgumentException
(
"filterChain"
);
}
entries
=
new
CopyOnWriteArrayList
<
Entry
>(
filterChain
.
entries
);
entries
=
new
CopyOnWriteArrayList
<>(
filterChain
.
entries
);
}
/**
...
...
@@ -140,6 +141,7 @@ public class DefaultIoFilterChainBuilder implements IoFilterChainBuilder {
*/
public
IoFilter
get
(
String
name
)
{
Entry
e
=
getEntry
(
name
);
if
(
e
==
null
)
{
return
null
;
}
...
...
@@ -155,6 +157,7 @@ public class DefaultIoFilterChainBuilder implements IoFilterChainBuilder {
*/
public
IoFilter
get
(
Class
<?
extends
IoFilter
>
filterType
)
{
Entry
e
=
getEntry
(
filterType
);
if
(
e
==
null
)
{
return
null
;
}
...
...
@@ -168,7 +171,7 @@ public class DefaultIoFilterChainBuilder implements IoFilterChainBuilder {
* @return The list of Filters
*/
public
List
<
Entry
>
getAll
()
{
return
new
ArrayList
<
Entry
>(
entries
);
return
new
ArrayList
<>(
entries
);
}
/**
...
...
@@ -179,6 +182,7 @@ public class DefaultIoFilterChainBuilder implements IoFilterChainBuilder {
public
List
<
Entry
>
getAllReversed
()
{
List
<
Entry
>
result
=
getAll
();
Collections
.
reverse
(
result
);
return
result
;
}
...
...
@@ -244,6 +248,7 @@ public class DefaultIoFilterChainBuilder implements IoFilterChainBuilder {
for
(
ListIterator
<
Entry
>
i
=
entries
.
listIterator
();
i
.
hasNext
();)
{
Entry
base
=
i
.
next
();
if
(
base
.
getName
().
equals
(
baseName
))
{
register
(
i
.
previousIndex
(),
new
EntryImpl
(
name
,
filter
));
break
;
...
...
@@ -263,6 +268,7 @@ public class DefaultIoFilterChainBuilder implements IoFilterChainBuilder {
for
(
ListIterator
<
Entry
>
i
=
entries
.
listIterator
();
i
.
hasNext
();)
{
Entry
base
=
i
.
next
();
if
(
base
.
getName
().
equals
(
baseName
))
{
register
(
i
.
nextIndex
(),
new
EntryImpl
(
name
,
filter
));
break
;
...
...
@@ -283,8 +289,10 @@ public class DefaultIoFilterChainBuilder implements IoFilterChainBuilder {
for
(
ListIterator
<
Entry
>
i
=
entries
.
listIterator
();
i
.
hasNext
();)
{
Entry
e
=
i
.
next
();
if
(
e
.
getName
().
equals
(
name
))
{
entries
.
remove
(
i
.
previousIndex
());
return
e
.
getFilter
();
}
}
...
...
@@ -305,8 +313,10 @@ public class DefaultIoFilterChainBuilder implements IoFilterChainBuilder {
for
(
ListIterator
<
Entry
>
i
=
entries
.
listIterator
();
i
.
hasNext
();)
{
Entry
e
=
i
.
next
();
if
(
e
.
getFilter
()
==
filter
)
{
entries
.
remove
(
i
.
previousIndex
());
return
e
.
getFilter
();
}
}
...
...
@@ -327,8 +337,10 @@ public class DefaultIoFilterChainBuilder implements IoFilterChainBuilder {
for
(
ListIterator
<
Entry
>
i
=
entries
.
listIterator
();
i
.
hasNext
();)
{
Entry
e
=
i
.
next
();
if
(
filterType
.
isAssignableFrom
(
e
.
getFilter
().
getClass
()))
{
entries
.
remove
(
i
.
previousIndex
());
return
e
.
getFilter
();
}
}
...
...
@@ -336,31 +348,57 @@ public class DefaultIoFilterChainBuilder implements IoFilterChainBuilder {
throw
new
IllegalArgumentException
(
"Filter not found: "
+
filterType
.
getName
());
}
/**
* Replace a filter by a new one.
*
* @param name The name of the filter to replace
* @param newFilter The new filter to use
* @return The replaced filter
*/
public
synchronized
IoFilter
replace
(
String
name
,
IoFilter
newFilter
)
{
checkBaseName
(
name
);
EntryImpl
e
=
(
EntryImpl
)
getEntry
(
name
);
IoFilter
oldFilter
=
e
.
getFilter
();
e
.
setFilter
(
newFilter
);
return
oldFilter
;
}
/**
* Replace a filter by a new one.
*
* @param oldFilter The filter to replace
* @param newFilter The new filter to use
*/
public
synchronized
void
replace
(
IoFilter
oldFilter
,
IoFilter
newFilter
)
{
for
(
Entry
e
:
entries
)
{
if
(
e
.
getFilter
()
==
oldFilter
)
{
((
EntryImpl
)
e
).
setFilter
(
newFilter
);
return
;
}
}
throw
new
IllegalArgumentException
(
"Filter not found: "
+
oldFilter
.
getClass
().
getName
());
}
/**
* Replace a filter by a new one. We are looking for a filter type,
* but if we have more than one with the same type, only the first
* found one will be replaced
*
* @param oldFilterType The filter type to replace
* @param newFilter The new filter to use
*/
public
synchronized
void
replace
(
Class
<?
extends
IoFilter
>
oldFilterType
,
IoFilter
newFilter
)
{
for
(
Entry
e
:
entries
)
{
if
(
oldFilterType
.
isAssignableFrom
(
e
.
getFilter
().
getClass
()))
{
((
EntryImpl
)
e
).
setFilter
(
newFilter
);
return
;
}
}
throw
new
IllegalArgumentException
(
"Filter not found: "
+
oldFilterType
.
getName
());
}
...
...
@@ -390,11 +428,13 @@ public class DefaultIoFilterChainBuilder implements IoFilterChainBuilder {
+
LinkedHashMap
.
class
.
getName
()
+
"."
);
}
filters
=
new
LinkedHashMap
<
String
,
IoFilter
>(
filters
);
filters
=
new
LinkedHashMap
<>(
filters
);
for
(
Map
.
Entry
<
String
,
?
extends
IoFilter
>
e
:
filters
.
entrySet
())
{
if
(
e
.
getKey
()
==
null
)
{
throw
new
IllegalArgumentException
(
"filters contains a null key."
);
}
if
(
e
.
getValue
()
==
null
)
{
throw
new
IllegalArgumentException
(
"filters contains a null value."
);
}
...
...
@@ -402,6 +442,7 @@ public class DefaultIoFilterChainBuilder implements IoFilterChainBuilder {
synchronized
(
this
)
{
clear
();
for
(
Map
.
Entry
<
String
,
?
extends
IoFilter
>
e
:
filters
.
entrySet
())
{
addLast
(
e
.
getKey
(),
e
.
getValue
());
}
...
...
@@ -410,6 +451,10 @@ public class DefaultIoFilterChainBuilder implements IoFilterChainBuilder {
@SuppressWarnings
(
"unchecked"
)
private
boolean
isOrderedMap
(
Map
<
String
,?
extends
IoFilter
>
map
)
{
if
(
map
==
null
)
{
return
false
;
}
Class
<?>
mapType
=
map
.
getClass
();
if
(
LinkedHashMap
.
class
.
isAssignableFrom
(
mapType
))
{
...
...
@@ -434,9 +479,11 @@ public class DefaultIoFilterChainBuilder implements IoFilterChainBuilder {
LOGGER
.
debug
(
"{} is an ordered map (guessed from that it implements OrderedMap interface.)"
,
mapType
.
getSimpleName
());
}
return
true
;
}
}
type
=
type
.
getSuperclass
();
}
...
...
@@ -457,11 +504,12 @@ public class DefaultIoFilterChainBuilder implements IoFilterChainBuilder {
if
(
LOGGER
.
isDebugEnabled
())
{
LOGGER
.
debug
(
"Failed to create a new map instance of '{}'."
,
mapType
.
getName
(),
e
);
}
return
false
;
}
Random
rand
=
new
Random
();
List
<
String
>
expectedNames
=
new
ArrayList
<
String
>();
List
<
String
>
expectedNames
=
new
ArrayList
<>();
IoFilter
dummyFilter
=
new
IoFilterAdapter
();
for
(
int
i
=
0
;
i
<
65536
;
i
++)
{
...
...
@@ -481,6 +529,7 @@ public class DefaultIoFilterChainBuilder implements IoFilterChainBuilder {
if
(
LOGGER
.
isDebugEnabled
())
{
LOGGER
.
debug
(
"The specified map didn't pass the insertion order test after {} tries."
,
(
i
+
1
));
}
return
false
;
}
}
...
...
@@ -491,12 +540,19 @@ public class DefaultIoFilterChainBuilder implements IoFilterChainBuilder {
return
true
;
}
/**
* {@inheritDoc}
*/
@Override
public
void
buildFilterChain
(
IoFilterChain
chain
)
throws
Exception
{
for
(
Entry
e
:
entries
)
{
chain
.
addLast
(
e
.
getName
(),
e
.
getFilter
());
}
}
/**
* {@inheritDoc}
*/
@Override
public
String
toString
()
{
StringBuilder
buf
=
new
StringBuilder
();
...
...
@@ -554,6 +610,7 @@ public class DefaultIoFilterChainBuilder implements IoFilterChainBuilder {
if
(
name
==
null
)
{
throw
new
IllegalArgumentException
(
"name"
);
}
if
(
filter
==
null
)
{
throw
new
IllegalArgumentException
(
"filter"
);
}
...
...
@@ -562,10 +619,18 @@ public class DefaultIoFilterChainBuilder implements IoFilterChainBuilder {
this
.
filter
=
filter
;
}
/**
* {@inheritDoc}
*/
@Override
public
String
getName
()
{
return
name
;
}
/**
* {@inheritDoc}
*/
@Override
public
IoFilter
getFilter
()
{
return
filter
;
}
...
...
@@ -574,6 +639,10 @@ public class DefaultIoFilterChainBuilder implements IoFilterChainBuilder {
this
.
filter
=
filter
;
}
/**
* {@inheritDoc}
*/
@Override
public
NextFilter
getNextFilter
()
{
throw
new
IllegalStateException
();
}
...
...
@@ -583,18 +652,34 @@ public class DefaultIoFilterChainBuilder implements IoFilterChainBuilder {
return
"("
+
getName
()
+
':'
+
filter
+
')'
;
}
/**
* {@inheritDoc}
*/
@Override
public
void
addAfter
(
String
name
,
IoFilter
filter
)
{
DefaultIoFilterChainBuilder
.
this
.
addAfter
(
getName
(),
name
,
filter
);
}
/**
* {@inheritDoc}
*/
@Override
public
void
addBefore
(
String
name
,
IoFilter
filter
)
{
DefaultIoFilterChainBuilder
.
this
.
addBefore
(
getName
(),
name
,
filter
);
}
/**
* {@inheritDoc}
*/
@Override
public
void
remove
()
{
DefaultIoFilterChainBuilder
.
this
.
remove
(
getName
());
}
/**
* {@inheritDoc}
*/
@Override
public
void
replace
(
IoFilter
newFilter
)
{
DefaultIoFilterChainBuilder
.
this
.
replace
(
getName
(),
newFilter
);
}
...
...
src/mina-core/src/main/java/org/apache/mina/core/filterchain/IoFilter.java
View file @
76b32cea
...
...
@@ -347,6 +347,5 @@ public interface IoFilter {
* @param session The {@link IoSession} which has to process this invocation
*/
void
filterClose
(
IoSession
session
);
}
}
src/mina-core/src/main/java/org/apache/mina/core/filterchain/IoFilterAdapter.java
View file @
76b32cea
...
...
@@ -34,42 +34,49 @@ public class IoFilterAdapter implements IoFilter {
/**
* {@inheritDoc}
*/
@Override
public
void
init
()
throws
Exception
{
}
/**
* {@inheritDoc}
*/
@Override
public
void
destroy
()
throws
Exception
{
}
/**
* {@inheritDoc}
*/
@Override
public
void
onPreAdd
(
IoFilterChain
parent
,
String
name
,
NextFilter
nextFilter
)
throws
Exception
{
}
/**
* {@inheritDoc}
*/
@Override
public
void
onPostAdd
(
IoFilterChain
parent
,
String
name
,
NextFilter
nextFilter
)
throws
Exception
{
}
/**
* {@inheritDoc}
*/
@Override
public
void
onPreRemove
(
IoFilterChain
parent
,
String
name
,
NextFilter
nextFilter
)
throws
Exception
{
}
/**
* {@inheritDoc}
*/
@Override
public
void
onPostRemove
(
IoFilterChain
parent
,
String
name
,
NextFilter
nextFilter
)
throws
Exception
{
}
/**
* {@inheritDoc}
*/
@Override
public
void
sessionCreated
(
NextFilter
nextFilter
,
IoSession
session
)
throws
Exception
{
nextFilter
.
sessionCreated
(
session
);
}
...
...
@@ -77,6 +84,7 @@ public class IoFilterAdapter implements IoFilter {
/**
* {@inheritDoc}
*/
@Override
public
void
sessionOpened
(
NextFilter
nextFilter
,
IoSession
session
)
throws
Exception
{
nextFilter
.
sessionOpened
(
session
);
}
...
...
@@ -84,6 +92,7 @@ public class IoFilterAdapter implements IoFilter {
/**
* {@inheritDoc}
*/
@Override
public
void
sessionClosed
(
NextFilter
nextFilter
,
IoSession
session
)
throws
Exception
{
nextFilter
.
sessionClosed
(
session
);
}
...
...
@@ -91,6 +100,7 @@ public class IoFilterAdapter implements IoFilter {
/**
* {@inheritDoc}
*/
@Override
public
void
sessionIdle
(
NextFilter
nextFilter
,
IoSession
session
,
IdleStatus
status
)
throws
Exception
{
nextFilter
.
sessionIdle
(
session
,
status
);
}
...
...
@@ -98,6 +108,7 @@ public class IoFilterAdapter implements IoFilter {
/**
* {@inheritDoc}
*/
@Override
public
void
exceptionCaught
(
NextFilter
nextFilter
,
IoSession
session
,
Throwable
cause
)
throws
Exception
{
nextFilter
.
exceptionCaught
(
session
,
cause
);
}
...
...
@@ -105,6 +116,7 @@ public class IoFilterAdapter implements IoFilter {
/**
* {@inheritDoc}
*/
@Override
public
void
messageReceived
(
NextFilter
nextFilter
,
IoSession
session
,
Object
message
)
throws
Exception
{
nextFilter
.
messageReceived
(
session
,
message
);
}
...
...
@@ -112,6 +124,7 @@ public class IoFilterAdapter implements IoFilter {
/**
* {@inheritDoc}
*/
@Override
public
void
messageSent
(
NextFilter
nextFilter
,
IoSession
session
,
WriteRequest
writeRequest
)
throws
Exception
{
nextFilter
.
messageSent
(
session
,
writeRequest
);
}
...
...
@@ -119,6 +132,7 @@ public class IoFilterAdapter implements IoFilter {
/**
* {@inheritDoc}
*/
@Override
public
void
filterWrite
(
NextFilter
nextFilter
,
IoSession
session
,
WriteRequest
writeRequest
)
throws
Exception
{
nextFilter
.
filterWrite
(
session
,
writeRequest
);
}
...
...
@@ -126,6 +140,7 @@ public class IoFilterAdapter implements IoFilter {
/**
* {@inheritDoc}
*/
@Override
public
void
filterClose
(
NextFilter
nextFilter
,
IoSession
session
)
throws
Exception
{
nextFilter
.
filterClose
(
session
);
}
...
...
@@ -133,10 +148,15 @@ public class IoFilterAdapter implements IoFilter {
/**
* {@inheritDoc}
*/
@Override
public
void
inputClosed
(
NextFilter
nextFilter
,
IoSession
session
)
throws
Exception
{
nextFilter
.
inputClosed
(
session
);
}
/**
* {@inheritDoc}
*/
@Override
public
String
toString
()
{
return
this
.
getClass
().
getSimpleName
();
}
...
...
src/mina-core/src/main/java/org/apache/mina/core/filterchain/IoFilterChain.java
View file @
76b32cea
...
...
@@ -222,8 +222,7 @@ public interface IoFilterChain {
/**
* Replace the filter with the specified name with the specified new filter.
*
* @param filter
* The filter to remove
* @param filter The filter to remove
*/
void
remove
(
IoFilter
filter
);
...
...
@@ -232,8 +231,7 @@ public interface IoFilterChain {
* If there's more than one filter with the specified type, the first match
* will be replaced.
*
* @param filterType
* The filter class to remove
* @param filterType The filter class to remove
* @return The removed filter
*/
IoFilter
remove
(
Class
<?
extends
IoFilter
>
filterType
);
...
...
@@ -280,8 +278,7 @@ public interface IoFilterChain {
* users don't need to call this method at all. Please use this method only
* when you implement a new transport or fire a virtual event.
*
* @param message
* The received message
* @param message The received message
*/
void
fireMessageReceived
(
Object
message
);
...
...
@@ -290,8 +287,7 @@ public interface IoFilterChain {
* users don't need to call this method at all. Please use this method only
* when you implement a new transport or fire a virtual event.
*
* @param request
* The sent request
* @param request The sent request
*/
void
fireMessageSent
(
WriteRequest
request
);
...
...
@@ -316,8 +312,7 @@ public interface IoFilterChain {
* call this method at all. Please use this method only when you implement a
* new transport or fire a virtual event.
*
* @param writeRequest
* The message to write
* @param writeRequest The message to write
*/
void
fireFilterWrite
(
WriteRequest
writeRequest
);
...
...
src/mina-core/src/main/java/org/apache/mina/core/filterchain/IoFilterChainBuilder.java
View file @
76b32cea
...
...
@@ -41,9 +41,16 @@ public interface IoFilterChainBuilder {
* An implementation which does nothing.
*/
IoFilterChainBuilder
NOOP
=
new
IoFilterChainBuilder
()
{
/**
* {@inheritDoc}
*/
@Override
public
void
buildFilterChain
(
IoFilterChain
chain
)
throws
Exception
{
}
/**
* {@inheritDoc}
*/
@Override
public
String
toString
()
{
return
"NOOP"
;
...
...
src/mina-core/src/main/java/org/apache/mina/core/filterchain/IoFilterEvent.java
View file @
76b32cea
...
...
@@ -44,6 +44,14 @@ public class IoFilterEvent extends IoEvent {
private
final
NextFilter
nextFilter
;
/**
* Creates a new IoFilterEvent instance
*
* @param nextFilter The next Filter
* @param type The type of event
* @param session The current session
* @param parameter Any parameter
*/
public
IoFilterEvent
(
NextFilter
nextFilter
,
IoEventType
type
,
IoSession
session
,
Object
parameter
)
{
super
(
type
,
session
,
parameter
);
...
...
@@ -54,14 +62,19 @@ public class IoFilterEvent extends IoEvent {
this
.
nextFilter
=
nextFilter
;
}
/**
* @return The next filter
*/
public
NextFilter
getNextFilter
()
{
return
nextFilter
;
}
/**
* {@inheritDoc}
*/
@Override
public
void
fire
()
{
IoSession
session
=
getSession
();
NextFilter
nextFilter
=
getNextFilter
();
IoEventType
type
=
getType
();
if
(
DEBUG
)
{
...
...
Prev
1
2
3
4
5
…
17
Next