Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIXME use buffer unpacker #3

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.gitignore
target
.project
.classpath
.settings
.iml
*~
*.iml
.idea
324 changes: 162 additions & 162 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,178 +1,178 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.msgpack</groupId>
<artifactId>msgpack-rpc</artifactId>
<packaging>jar</packaging>
<version>0.7.1-SNAPSHOT</version>
<groupId>org.msgpack</groupId>
<artifactId>msgpack-rpc</artifactId>
<packaging>jar</packaging>
<version>0.7.1-SNAPSHOT</version>

<name>msgpack-rpc</name>
<url>http://msgpack.org/</url>
<name>msgpack-rpc</name>
<url>http://msgpack.org/</url>

<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<scm>
<connection>scm:git:git://github.com/msgpack/msgpack-rpc.git</connection>
<url>scm:git:git://github.com/msgpack/msgpack-rpc.git</url>
</scm>
<scm>
<connection>scm:git:git://github.com/msgpack/msgpack-rpc.git</connection>
<url>scm:git:git://github.com/msgpack/msgpack-rpc.git</url>
</scm>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>

<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>

<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.5.1</version>
</plugin>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.5.1</version>
</plugin>

<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.1</version>
<configuration>
<!-- do not run site-deploy goal, which is included in the default setting -->
<goals>deploy</goals>
<connectionUrl>scm:git:git://github.com/msgpack/msgpack-rpc.git</connectionUrl>
</configuration>
</plugin>
</plugins>
</build>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.1</version>
<configuration>
<!-- do not run site-deploy goal, which is included in the default setting -->
<goals>deploy</goals>
<connectionUrl>scm:git:git://github.com/msgpack/msgpack-rpc.git</connectionUrl>
</configuration>
</plugin>
</plugins>
</build>

<reporting>
<plugins>
<!-- Generating JavaDoc -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<doctitle>${project.name} ${project.version} API</doctitle>
<aggregate>true</aggregate>
<locale>en_US</locale>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<reporting>
<plugins>
<!-- Generating JavaDoc -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<doctitle>${project.name} ${project.version} API</doctitle>
<aggregate>true</aggregate>
<locale>en_US</locale>
<encoding>UTF-8</encoding>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.2</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.11</version>
</plugin>
</plugins>
</reporting>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.11</version>
</plugin>
</plugins>
</reporting>

<repositories>
<repository>
<id>repository.jboss.org</id>
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<repositories>
<repository>
<id>repository.jboss.org</id>
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.msgpack</groupId>
<artifactId>msgpack</artifactId>
<version>0.6.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jboss.netty</groupId>
<artifactId>netty</artifactId>
<version>3.2.1.Final</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>org.msgpack</groupId>
<artifactId>msgpack</artifactId>
<version>0.6.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.0.14.Final</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>

<distributionManagement>
<repository>
<uniqueVersion>false</uniqueVersion>
<id>msgpack.org</id>
<name>Repository at msgpack.org</name>
<url>file://${project.build.directory}/website/maven2/</url>
</repository>
<snapshotRepository>
<uniqueVersion>true</uniqueVersion>
<id>msgpack.org</id>
<name>Repository at msgpack.org</name>
<url>file://${project.build.directory}/website/maven2/</url>
</snapshotRepository>
</distributionManagement>
<distributionManagement>
<repository>
<uniqueVersion>false</uniqueVersion>
<id>msgpack.org</id>
<name>Repository at msgpack.org</name>
<url>file://${project.build.directory}/website/maven2/</url>
</repository>
<snapshotRepository>
<uniqueVersion>true</uniqueVersion>
<id>msgpack.org</id>
<name>Repository at msgpack.org</name>
<url>file://${project.build.directory}/website/maven2/</url>
</snapshotRepository>
</distributionManagement>

<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.4</version>
<configuration>
<updateReleaseInfo>true</updateReleaseInfo>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.4</version>
<configuration>
<updateReleaseInfo>true</updateReleaseInfo>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
4 changes: 4 additions & 0 deletions settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<localRepository>/Users/huzhou/maven.repo</localRepository>
</settings>
4 changes: 4 additions & 0 deletions src/main/java/org/msgpack/rpc/Request.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
import org.msgpack.rpc.transport.MessageSendable;

public class Request implements Callback<Object> {

private MessageSendable channel; // TODO #SF synchronized?

private int msgid;
private String method;
private Value args;
Expand Down Expand Up @@ -66,9 +68,11 @@ public void sendError(Object error, Object data) {
}

public synchronized void sendResponse(Object result, Object error) {

if (channel == null) {
return;
}

ResponseMessage msg = new ResponseMessage(msgid, error, result);
channel.sendMessage(msg);
channel = null;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/msgpack/rpc/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ public void onRequest(MessageSendable channel, int msgid, String method, Value a
Request request = new Request(channel, msgid, method, args);
try {
dp.dispatch(request);
} catch (RPCError e) {
}
catch (RPCError e) {
// FIXME
request.sendError(e.getCode(), e);
} catch (Exception e) {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/msgpack/rpc/dispatcher/Dispatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
import org.msgpack.rpc.Request;

public interface Dispatcher {

void dispatch(Request request) throws Exception;
}
Loading