You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by jv...@apache.org on 2013/06/18 21:53:33 UTC
[1/3] git commit: moving to java 7
Updated Branches:
refs/heads/trunk 08d2ac72b -> 50d27d9e6
moving to java 7
Project: http://git-wip-us.apache.org/repos/asf/mina/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/ee3a4c3b
Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/ee3a4c3b
Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/ee3a4c3b
Branch: refs/heads/trunk
Commit: ee3a4c3b5a25026b1a747baefaad4450c39d40a3
Parents: 08d2ac7
Author: jvermillard <jv...@apache.org>
Authored: Tue Jun 18 21:12:04 2013 +0200
Committer: jvermillard <jv...@apache.org>
Committed: Tue Jun 18 21:12:04 2013 +0200
----------------------------------------------------------------------
.../org/apache/mina/examples/coap/CoapClient.java | 2 +-
.../org/apache/mina/examples/coap/CoapServer.java | 16 ++++++++--------
pom.xml | 16 ++--------------
3 files changed, 11 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mina/blob/ee3a4c3b/examples/src/main/java/org/apache/mina/examples/coap/CoapClient.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/mina/examples/coap/CoapClient.java b/examples/src/main/java/org/apache/mina/examples/coap/CoapClient.java
index 4a5cfe0..79c7761 100644
--- a/examples/src/main/java/org/apache/mina/examples/coap/CoapClient.java
+++ b/examples/src/main/java/org/apache/mina/examples/coap/CoapClient.java
@@ -50,7 +50,7 @@ public class CoapClient {
final String status = "status message";
System.err.println(status.length());
- final RequestFilter<CoapMessage, CoapMessage> rq = new RequestFilter<CoapMessage, CoapMessage>();
+ final RequestFilter<CoapMessage, CoapMessage> rq = new RequestFilter<>();
NioUdpClient client = new NioUdpClient();
client.setFilters( //
http://git-wip-us.apache.org/repos/asf/mina/blob/ee3a4c3b/examples/src/main/java/org/apache/mina/examples/coap/CoapServer.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/mina/examples/coap/CoapServer.java b/examples/src/main/java/org/apache/mina/examples/coap/CoapServer.java
index 24da802..206a282 100644
--- a/examples/src/main/java/org/apache/mina/examples/coap/CoapServer.java
+++ b/examples/src/main/java/org/apache/mina/examples/coap/CoapServer.java
@@ -50,7 +50,7 @@ public class CoapServer {
public static void main(String[] args) {
- final Map<String, IoSession> registration = new ConcurrentHashMap<String, IoSession>();
+ final Map<String, IoSession> registration = new ConcurrentHashMap<>();
// create a CoAP resource registry
final ResourceRegistry reg = new ResourceRegistry();
@@ -107,12 +107,12 @@ public class CoapServer {
});
BioUdpServer server = new BioUdpServer();
- final RequestFilter<CoapMessage, CoapMessage> rq = new RequestFilter<CoapMessage, CoapMessage>();
+ final RequestFilter<CoapMessage, CoapMessage> rq = new RequestFilter<>();
- server.setFilters(/* new LoggingFilter(), */new ProtocolCodecFilter<CoapMessage, ByteBuffer, Void, Void>(
+ server.setFilters(new ProtocolCodecFilter<CoapMessage, ByteBuffer, Void, Void>(
new CoapEncoder(), new CoapDecoder()), rq);
// idle in 10 minute
- server.getSessionConfig().setIdleTimeInMillis(IdleStatus.READ_IDLE, 10 * 60 * 1000);
+ server.getSessionConfig().setIdleTimeInMillis(IdleStatus.READ_IDLE, 60 * 10_000);
server.setIoHandler(new AbstractIoHandler() {
long start = System.currentTimeMillis();
@@ -126,7 +126,7 @@ public class CoapServer {
System.err.println("resp : " + resp);
session.write(resp);
count++;
- if (count >= 100000) {
+ if (count >= 100_000) {
System.err.println("time for 100k msg : " + (System.currentTimeMillis() - start));
count = 0;
start = System.currentTimeMillis();
@@ -152,7 +152,7 @@ public class CoapServer {
public void run() {
for (;;) {
for (IoSession s : registration.values()) {
- rq.request(s, CoapMessage.get("st", true), 15000).register(
+ rq.request(s, CoapMessage.get("st", true), 15_000).register(
new AbstractIoFutureListener<CoapMessage>() {
@Override
public void completed(CoapMessage result) {
@@ -163,7 +163,7 @@ public class CoapServer {
try {
// let's poll every 10 seconds
- Thread.sleep(10000);
+ Thread.sleep(10_000);
} catch (InterruptedException e) {
break;
}
@@ -172,7 +172,7 @@ public class CoapServer {
}.start();
for (;;) {
- Thread.sleep(1000);
+ Thread.sleep(1_000);
}
} catch (InterruptedException e) {
e.printStackTrace();
http://git-wip-us.apache.org/repos/asf/mina/blob/ee3a4c3b/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index cb3b2b5..61cd1d9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -175,13 +175,6 @@
<scope>test</scope>
</dependency>
- <!--dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>${version.slf4j.log4j12}</version>
- <scope>test</scope>
- </dependency-->
-
<dependency>
<groupId>org.apache.logging.log4j.adapters</groupId>
<artifactId>slf4j-impl</artifactId>
@@ -203,11 +196,6 @@
</dependency>
<!-- logging implementation used for unit tests -->
- <!--dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency-->
<dependency>
<groupId>junit</groupId>
@@ -543,8 +531,8 @@
<version>${version.maven.compiler.plugin}</version>
<configuration>
<encoding>UTF-8</encoding>
- <source>1.6</source>
- <target>1.6</target>
+ <source>1.7</source>
+ <target>1.7</target>
<debug>true</debug>
<optimize>true</optimize>
<showDeprecations>true</showDeprecations>
[2/3] git commit: make mvn apache-rat:check pass
Posted by jv...@apache.org.
make mvn apache-rat:check pass
Project: http://git-wip-us.apache.org/repos/asf/mina/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/a3a8bccc
Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/a3a8bccc
Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/a3a8bccc
Branch: refs/heads/trunk
Commit: a3a8bccc2514cdc8c8d96cfb79e2c9edf4eef753
Parents: ee3a4c3
Author: jvermillard <jv...@apache.org>
Authored: Tue Jun 18 21:52:17 2013 +0200
Committer: jvermillard <jv...@apache.org>
Committed: Tue Jun 18 21:52:17 2013 +0200
----------------------------------------------------------------------
ImprovedJavaConventions.xml | 21 ++++++++++++++++++
.../mina/util/ByteBufferInputStreamTest.java | 20 +++++++++++++++++
.../mina/util/ByteBufferOutputStreamTest.java | 20 +++++++++++++++++
.../mina/service/executor/HandlerCaller.java | 20 +++++++++++++++++
.../mina/service/executor/package-info.java | 20 +++++++++++++++++
core/src/test/resources/log4j2-test.xml | 22 +++++++++++++++++++
.../java/org/apache/mina/http/DateUtilTest.java | 20 +++++++++++++++++
pom.xml | 23 +++++++-------------
protobuf/prepare.sh | 19 ++++++++++++++++
.../generated/protoc/AddressBookProtos.java | 20 +++++++++++++++++
.../org/apache/mina/generated/protoc/Calc.java | 20 +++++++++++++++++
protobuf/src/test/protobuf/addressbook.proto | 19 ++++++++++++++++
protobuf/src/test/protobuf/calc.proto | 20 +++++++++++++++++
thrift/prepare.sh | 18 +++++++++++++++
.../mina/generated/thrift/UserProfile.java | 20 +++++++++++++++++
.../mina/generated/thrift/UserStorage.java | 21 ++++++++++++++++++
16 files changed, 308 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mina/blob/a3a8bccc/ImprovedJavaConventions.xml
----------------------------------------------------------------------
diff --git a/ImprovedJavaConventions.xml b/ImprovedJavaConventions.xml
index 7e3d8b8..675beef 100644
--- a/ImprovedJavaConventions.xml
+++ b/ImprovedJavaConventions.xml
@@ -1,4 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+
+
+<!--
+ 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.
+-->
+
<profiles version="10">
<profile name="Improved Java Conventions" version="10">
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
http://git-wip-us.apache.org/repos/asf/mina/blob/a3a8bccc/codec/src/test/java/org/apache/mina/util/ByteBufferInputStreamTest.java
----------------------------------------------------------------------
diff --git a/codec/src/test/java/org/apache/mina/util/ByteBufferInputStreamTest.java b/codec/src/test/java/org/apache/mina/util/ByteBufferInputStreamTest.java
index 5152c52..2f505be 100644
--- a/codec/src/test/java/org/apache/mina/util/ByteBufferInputStreamTest.java
+++ b/codec/src/test/java/org/apache/mina/util/ByteBufferInputStreamTest.java
@@ -1,3 +1,23 @@
+/*
+ * 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.util;
import java.io.IOException;
http://git-wip-us.apache.org/repos/asf/mina/blob/a3a8bccc/codec/src/test/java/org/apache/mina/util/ByteBufferOutputStreamTest.java
----------------------------------------------------------------------
diff --git a/codec/src/test/java/org/apache/mina/util/ByteBufferOutputStreamTest.java b/codec/src/test/java/org/apache/mina/util/ByteBufferOutputStreamTest.java
index cf3b019..7957125 100644
--- a/codec/src/test/java/org/apache/mina/util/ByteBufferOutputStreamTest.java
+++ b/codec/src/test/java/org/apache/mina/util/ByteBufferOutputStreamTest.java
@@ -1,3 +1,23 @@
+/*
+ * 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.util;
import static org.junit.Assert.*;
http://git-wip-us.apache.org/repos/asf/mina/blob/a3a8bccc/core/src/main/java/org/apache/mina/service/executor/HandlerCaller.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/mina/service/executor/HandlerCaller.java b/core/src/main/java/org/apache/mina/service/executor/HandlerCaller.java
index d2f5d4c..47fdb42 100644
--- a/core/src/main/java/org/apache/mina/service/executor/HandlerCaller.java
+++ b/core/src/main/java/org/apache/mina/service/executor/HandlerCaller.java
@@ -1,3 +1,23 @@
+/*
+ * 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.service.executor;
import org.apache.mina.api.IoHandler;
http://git-wip-us.apache.org/repos/asf/mina/blob/a3a8bccc/core/src/main/java/org/apache/mina/service/executor/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/mina/service/executor/package-info.java b/core/src/main/java/org/apache/mina/service/executor/package-info.java
index 42128ce..920cd45 100644
--- a/core/src/main/java/org/apache/mina/service/executor/package-info.java
+++ b/core/src/main/java/org/apache/mina/service/executor/package-info.java
@@ -1,3 +1,23 @@
+/*
+ * 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.
+ *
+ */
+
/**
* <p>
* Classes in charge of decoupling IoHandler event of the low level read/write/accept I/O threads ( {@link org.apache.mina.transport.nio.SelectorLoop} ).
http://git-wip-us.apache.org/repos/asf/mina/blob/a3a8bccc/core/src/test/resources/log4j2-test.xml
----------------------------------------------------------------------
diff --git a/core/src/test/resources/log4j2-test.xml b/core/src/test/resources/log4j2-test.xml
index f7c3d40..bbc59ca 100644
--- a/core/src/test/resources/log4j2-test.xml
+++ b/core/src/test/resources/log4j2-test.xml
@@ -1,4 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
+
+
+<!--
+ 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.
+-->
+
+
<configuration>
<appenders>
<Console name="STDOUT" target="SYSTEM_OUT">
http://git-wip-us.apache.org/repos/asf/mina/blob/a3a8bccc/http/src/test/java/org/apache/mina/http/DateUtilTest.java
----------------------------------------------------------------------
diff --git a/http/src/test/java/org/apache/mina/http/DateUtilTest.java b/http/src/test/java/org/apache/mina/http/DateUtilTest.java
index cb7ba22..d82248a 100644
--- a/http/src/test/java/org/apache/mina/http/DateUtilTest.java
+++ b/http/src/test/java/org/apache/mina/http/DateUtilTest.java
@@ -1,3 +1,23 @@
+/*
+ * 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.http;
import java.text.DateFormat;
http://git-wip-us.apache.org/repos/asf/mina/blob/a3a8bccc/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 61cd1d9..5bd8159 100644
--- a/pom.xml
+++ b/pom.xml
@@ -432,6 +432,14 @@
<!-- project excludes -->
<exclude>**/resources/svn_ignore.txt</exclude>
<exclude>**/resources/Reveal in Finder.launch</exclude>
+ <exclude>.git/**</exclude>
+ <exclude>**/.*</exclude>
+ <exclude>**/.classpath</exclude>
+ <exclude>**/.project</exclude>
+ <exclude>**/.settings/**</exclude>
+ <exclude>**/target/**</exclude>
+ <exclude>**/LICENSE.*</exclude>
+ <exclude>**/NOTICE-bin.txt</exclude>
</excludes>
</configuration>
</plugin>
@@ -626,21 +634,6 @@
<docTitle>Apache MINA ${project.version} Cross Reference</docTitle>
</configuration>
</plugin>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>rat-maven-plugin</artifactId>
- <version>1.0-alpha-3</version>
- <configuration>
- <excludes>
- <exclude>**/target/**/*</exclude>
- <exclude>**/.*</exclude>
- <exclude>**/NOTICE.txt</exclude>
- <exclude>**/LICENSE*.txt</exclude>
- </excludes>
- <excludeSubProjects>false</excludeSubProjects>
- </configuration>
- </plugin>
</plugins>
</reporting>
http://git-wip-us.apache.org/repos/asf/mina/blob/a3a8bccc/protobuf/prepare.sh
----------------------------------------------------------------------
diff --git a/protobuf/prepare.sh b/protobuf/prepare.sh
index 84fd1fc..688709c 100644
--- a/protobuf/prepare.sh
+++ b/protobuf/prepare.sh
@@ -1,4 +1,23 @@
#!/bin/bash
+#
+# 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.
+#
+
if hash protoc 2>/dev/null; then
VERSION=`protoc --version`
http://git-wip-us.apache.org/repos/asf/mina/blob/a3a8bccc/protobuf/src/test/java/org/apache/mina/generated/protoc/AddressBookProtos.java
----------------------------------------------------------------------
diff --git a/protobuf/src/test/java/org/apache/mina/generated/protoc/AddressBookProtos.java b/protobuf/src/test/java/org/apache/mina/generated/protoc/AddressBookProtos.java
index 07ca8b5..0461b1a 100644
--- a/protobuf/src/test/java/org/apache/mina/generated/protoc/AddressBookProtos.java
+++ b/protobuf/src/test/java/org/apache/mina/generated/protoc/AddressBookProtos.java
@@ -1,3 +1,23 @@
+/*
+ * 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.
+ *
+ */
+
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: src/test/protobuf/addressbook.proto
http://git-wip-us.apache.org/repos/asf/mina/blob/a3a8bccc/protobuf/src/test/java/org/apache/mina/generated/protoc/Calc.java
----------------------------------------------------------------------
diff --git a/protobuf/src/test/java/org/apache/mina/generated/protoc/Calc.java b/protobuf/src/test/java/org/apache/mina/generated/protoc/Calc.java
index 222b928..29644a7 100644
--- a/protobuf/src/test/java/org/apache/mina/generated/protoc/Calc.java
+++ b/protobuf/src/test/java/org/apache/mina/generated/protoc/Calc.java
@@ -1,3 +1,23 @@
+/*
+ * 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.
+ *
+ */
+
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: src/test/protobuf/calc.proto
http://git-wip-us.apache.org/repos/asf/mina/blob/a3a8bccc/protobuf/src/test/protobuf/addressbook.proto
----------------------------------------------------------------------
diff --git a/protobuf/src/test/protobuf/addressbook.proto b/protobuf/src/test/protobuf/addressbook.proto
index 6bf919d..999074a 100644
--- a/protobuf/src/test/protobuf/addressbook.proto
+++ b/protobuf/src/test/protobuf/addressbook.proto
@@ -1,3 +1,22 @@
+//
+// 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.
+//
+
// See README.txt for information and build instructions.
package tutorial;
http://git-wip-us.apache.org/repos/asf/mina/blob/a3a8bccc/protobuf/src/test/protobuf/calc.proto
----------------------------------------------------------------------
diff --git a/protobuf/src/test/protobuf/calc.proto b/protobuf/src/test/protobuf/calc.proto
index 44faf25..62b71c5 100644
--- a/protobuf/src/test/protobuf/calc.proto
+++ b/protobuf/src/test/protobuf/calc.proto
@@ -1,3 +1,23 @@
+//
+// 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.
+//
+
+
// See README.txt for information and build instructions.
package tutorial;
http://git-wip-us.apache.org/repos/asf/mina/blob/a3a8bccc/thrift/prepare.sh
----------------------------------------------------------------------
diff --git a/thrift/prepare.sh b/thrift/prepare.sh
index 8820aef..0cb09fe 100644
--- a/thrift/prepare.sh
+++ b/thrift/prepare.sh
@@ -1,4 +1,22 @@
#!/bin/bash
+#
+# 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.
+#
if hash thrift 2>/dev/null; then
VERSION=`thrift --version`
http://git-wip-us.apache.org/repos/asf/mina/blob/a3a8bccc/thrift/src/test/java/org/apache/mina/generated/thrift/UserProfile.java
----------------------------------------------------------------------
diff --git a/thrift/src/test/java/org/apache/mina/generated/thrift/UserProfile.java b/thrift/src/test/java/org/apache/mina/generated/thrift/UserProfile.java
index 6aebd59..7417fff 100644
--- a/thrift/src/test/java/org/apache/mina/generated/thrift/UserProfile.java
+++ b/thrift/src/test/java/org/apache/mina/generated/thrift/UserProfile.java
@@ -1,3 +1,23 @@
+/*
+ * 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.
+ *
+ */
+
/**
* Autogenerated by Thrift Compiler (0.9.0)
*
http://git-wip-us.apache.org/repos/asf/mina/blob/a3a8bccc/thrift/src/test/java/org/apache/mina/generated/thrift/UserStorage.java
----------------------------------------------------------------------
diff --git a/thrift/src/test/java/org/apache/mina/generated/thrift/UserStorage.java b/thrift/src/test/java/org/apache/mina/generated/thrift/UserStorage.java
index 51e1271..a0dde4c 100644
--- a/thrift/src/test/java/org/apache/mina/generated/thrift/UserStorage.java
+++ b/thrift/src/test/java/org/apache/mina/generated/thrift/UserStorage.java
@@ -1,3 +1,24 @@
+/*
+ * 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.
+ *
+ */
+
+
/**
* Autogenerated by Thrift Compiler (0.9.0)
*
[3/3] git commit: use a scheduled executor for request timeout
Posted by jv...@apache.org.
use a scheduled executor for request timeout
Project: http://git-wip-us.apache.org/repos/asf/mina/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/50d27d9e
Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/50d27d9e
Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/50d27d9e
Branch: refs/heads/trunk
Commit: 50d27d9e60838e9a4906ac797305e88247470f5c
Parents: a3a8bcc
Author: jvermillard <jv...@apache.org>
Authored: Tue Jun 18 21:52:47 2013 +0200
Committer: jvermillard <jv...@apache.org>
Committed: Tue Jun 18 21:52:47 2013 +0200
----------------------------------------------------------------------
.../apache/mina/filter/query/RequestFilter.java | 37 +++++---------------
.../apache/mina/filter/query/RequestFuture.java | 30 +++++++++++-----
2 files changed, 30 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mina/blob/50d27d9e/core/src/main/java/org/apache/mina/filter/query/RequestFilter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/mina/filter/query/RequestFilter.java b/core/src/main/java/org/apache/mina/filter/query/RequestFilter.java
index 5539b89..77f8827 100644
--- a/core/src/main/java/org/apache/mina/filter/query/RequestFilter.java
+++ b/core/src/main/java/org/apache/mina/filter/query/RequestFilter.java
@@ -21,6 +21,9 @@ package org.apache.mina.filter.query;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
import org.apache.mina.api.AbstractIoFilter;
import org.apache.mina.api.IoFuture;
@@ -63,13 +66,15 @@ public class RequestFilter<REQUEST extends Request, RESPONSE extends Response> e
* @param session the session where to write the request
* @param request the request to be issued
* @param timeoutInMs the timeout in milli-seconds (doesn't work Work-in-progress).
- * @return
+ * @return the {@link IoFuture} for waiting or listening the completion of this request.
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public IoFuture<RESPONSE> request(IoSession session, REQUEST request, long timeoutInMs) {
Map inFlight = session.getAttribute(IN_FLIGHT_REQUESTS);
- IoFuture<RESPONSE> future = new RequestFuture<REQUEST, RESPONSE>(session, System.currentTimeMillis()
- + timeoutInMs, request.requestId());
+ RequestFuture<REQUEST, RESPONSE> future = new RequestFuture<REQUEST, RESPONSE>(session, request.requestId());
+
+ // schedule a timeout task
+ future.setTimeoutFuture(schedExec.schedule(future.timeout, timeoutInMs, TimeUnit.MILLISECONDS));
// save the future for completion
inFlight.put(request.requestId(), future);
@@ -80,8 +85,7 @@ public class RequestFilter<REQUEST extends Request, RESPONSE extends Response> e
@SuppressWarnings("rawtypes")
static final AttributeKey<Map> IN_FLIGHT_REQUESTS = new AttributeKey<Map>(Map.class, "request.in.flight");
- // last time we checked the timeouts
- private long lastTimeoutCheck = 0;
+ private ScheduledExecutorService schedExec = Executors.newScheduledThreadPool(1);
@SuppressWarnings("rawtypes")
@Override
@@ -104,32 +108,9 @@ public class RequestFilter<REQUEST extends Request, RESPONSE extends Response> e
}
}
- // // check for timeout
- // long now = System.currentTimeMillis();
- // if (lastTimeoutCheck + 1000 < now) {
- // lastTimeoutCheck = now;
- // Map<?, ?> inFlight = session.getAttribute(IN_FLIGHT_REQUESTS);
- // for (Object v : inFlight.values()) {
- // ((RequestFuture<?, ?>) v).timeoutIfNeeded(now);
- // }
- // }
- // trigger the next filter
super.messageReceived(session, message, controller);
}
- @Override
- public void messageSent(IoSession session, Object message) {
- // check for timeout
- // long now = System.currentTimeMillis();
- // if (lastTimeoutCheck + 1000 < now) {
- // lastTimeoutCheck = now;
- // Map<?, ?> inFlight = session.getAttribute(IN_FLIGHT_REQUESTS);
- // for (Object v : inFlight.values()) {
- // ((RequestFuture<?, ?>) v).timeoutIfNeeded(now);
- // }
- // }
- }
-
/**
* {@inheritDoc} cancel remaining requests
*/
http://git-wip-us.apache.org/repos/asf/mina/blob/50d27d9e/core/src/main/java/org/apache/mina/filter/query/RequestFuture.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/mina/filter/query/RequestFuture.java b/core/src/main/java/org/apache/mina/filter/query/RequestFuture.java
index de8564f..7b15443 100644
--- a/core/src/main/java/org/apache/mina/filter/query/RequestFuture.java
+++ b/core/src/main/java/org/apache/mina/filter/query/RequestFuture.java
@@ -20,6 +20,7 @@
package org.apache.mina.filter.query;
import java.util.Map;
+import java.util.concurrent.ScheduledFuture;
import org.apache.mina.api.IoSession;
import org.apache.mina.util.AbstractIoFuture;
@@ -36,13 +37,12 @@ class RequestFuture<REQUEST extends Request, RESPONSE extends Response> extends
private final IoSession session;
- private final long timeout;
-
private final Object id;
- public RequestFuture(IoSession session, long timeout, Object id) {
+ private ScheduledFuture<?> schedFuture;
+
+ public RequestFuture(IoSession session, Object id) {
this.session = session;
- this.timeout = timeout;
this.id = id;
}
@@ -52,15 +52,27 @@ class RequestFuture<REQUEST extends Request, RESPONSE extends Response> extends
}
void complete(RESPONSE response) {
+ if (schedFuture != null) {
+ schedFuture.cancel(true);
+ }
setResult(response);
}
- @SuppressWarnings("rawtypes")
- void timeoutIfNeeded(long time) {
- if (timeout < time) {
+ void setTimeoutFuture(ScheduledFuture<?> schedFuture) {
+ this.schedFuture = schedFuture;
+ }
+
+ Runnable timeout = new Runnable() {
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public void run() {
Map inFlight = session.getAttribute(RequestFilter.IN_FLIGHT_REQUESTS);
- inFlight.remove(id);
+ if (inFlight != null) {
+ inFlight.remove(id);
+ }
setException(new RequestTimeoutException());
+
}
- }
+ };
}
\ No newline at end of file