Skip to content

Commit

Permalink
重新整理douyu-examples,修复包名重构带来的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
codefollower committed Jan 10, 2013
1 parent d7e7f67 commit 15f241e
Show file tree
Hide file tree
Showing 51 changed files with 590 additions and 305 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
*.project
*.settings
target
douyu-examples-classes
18 changes: 9 additions & 9 deletions assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<moduleSets>
<moduleSet>
<includes>
<include>org.douyu:douyu-api</include>
<include>com.codefollower.douyu:douyu-api</include>
</includes>
<binaries>
<unpack>false</unpack>
Expand All @@ -26,7 +26,7 @@

<moduleSet>
<includes>
<include>org.douyu:douyu-javac</include>
<include>com.codefollower.douyu:douyu-javac</include>
</includes>
<binaries>
<unpack>false</unpack>
Expand All @@ -36,7 +36,7 @@
<useTransitiveFiltering>true</useTransitiveFiltering>
<useTransitiveDependencies>true</useTransitiveDependencies>
<excludes>
<exclude>org.douyu:douyu-api</exclude>
<exclude>com.codefollower.douyu:douyu-api</exclude>
</excludes>
</dependencySet>
</dependencySets>
Expand All @@ -45,7 +45,7 @@

<moduleSet>
<includes>
<include>org.douyu:douyu-core</include>
<include>com.codefollower.douyu:douyu-core</include>
</includes>
<binaries>
<unpack>false</unpack>
Expand All @@ -55,7 +55,7 @@
<useTransitiveFiltering>true</useTransitiveFiltering>
<useTransitiveDependencies>true</useTransitiveDependencies>
<excludes>
<exclude>org.douyu:douyu-javac</exclude>
<exclude>com.codefollower.douyu:douyu-javac</exclude>
</excludes>
</dependencySet>
</dependencySets>
Expand All @@ -64,7 +64,7 @@

<moduleSet>
<includes>
<include>org.douyu:douyu-mvc</include>
<include>com.codefollower.douyu:douyu-mvc</include>
</includes>
<binaries>
<unpack>false</unpack>
Expand All @@ -74,7 +74,7 @@
<useTransitiveFiltering>true</useTransitiveFiltering>
<useTransitiveDependencies>true</useTransitiveDependencies>
<excludes>
<exclude>org.douyu:douyu-core</exclude>
<exclude>com.codefollower.douyu:douyu-core</exclude>
</excludes>
</dependencySet>
</dependencySets>
Expand All @@ -83,7 +83,7 @@

<moduleSet>
<includes>
<include>org.douyu:douyu-plugins</include>
<include>com.codefollower.douyu:douyu-plugins</include>
</includes>
<binaries>
<unpack>false</unpack>
Expand All @@ -93,7 +93,7 @@
<useTransitiveFiltering>true</useTransitiveFiltering>
<useTransitiveDependencies>true</useTransitiveDependencies>
<excludes>
<exclude>org.douyu:douyu-api</exclude>
<exclude>com.codefollower.douyu:douyu-api</exclude>
</excludes>
</dependencySet>
</dependencySets>
Expand Down
22 changes: 22 additions & 0 deletions douyu-examples/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<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>
<parent>
<groupId>com.codefollower.douyu</groupId>
<artifactId>douyu</artifactId>
<version>0.1.0</version>
</parent>

<artifactId>douyu-examples</artifactId>
<packaging>jar</packaging>
<version>${douyu.version}</version>
<name>douyu examples</name>

<dependencies>
<dependency>
<groupId>com.codefollower.douyu</groupId>
<artifactId>douyu-startup</artifactId>
<version>${douyu.version}</version>
</dependency>
</dependencies>
</project>
39 changes: 0 additions & 39 deletions douyu-examples/src/AsyncExample.java

This file was deleted.

59 changes: 0 additions & 59 deletions douyu-examples/src/FileUpload.java

This file was deleted.

9 changes: 0 additions & 9 deletions douyu-examples/src/HelloWorld.java

This file was deleted.

13 changes: 0 additions & 13 deletions douyu-examples/src/ModelInjectExample.java

This file was deleted.

58 changes: 58 additions & 0 deletions douyu-examples/src/main/java/AsyncExample.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright 2011 The Apache Software Foundation
*
* 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.
*/
import java.io.PrintWriter;
import java.util.Date;

import douyu.mvc.Async;
import douyu.mvc.Context;
import douyu.mvc.Controller;

@Controller
public class AsyncExample {
@Async
public void asyncAction(Context c, PrintWriter out) {
out.println("before invokeLongtimeService..." + Thread.currentThread());
invokeLongtimeService(c, out);
out.println("after invokeLongtimeService...");
}

private void invokeLongtimeService(Context c, PrintWriter out) {
out.println("invokeLongtimeService...");
out.println("at " + new Date());

int seconds = 2;
out.println("sleep " + seconds + " seconds...");
try {
Thread.sleep(seconds * 1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
out.println("at " + new Date());
}

@Async
public void asyncAction2(PrintWriter out) {
out.println("invoke asyncAction2..." + Thread.currentThread());
}

public void action3(PrintWriter out) {
out.println("invoke action3..." + Thread.currentThread());
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
* Copyright 2011 The Apache Software Foundation
*
* 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.
*/
import java.io.IOException;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
Expand All @@ -19,6 +38,7 @@ public void join(Context c) {
public static class MyComet implements Comet {
private final static Set<MyComet> members = new CopyOnWriteArraySet<MyComet>();
Context context;

@Override
public void onConnect(Context context) {
members.add(this);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
/*
* Copyright 2011 The Apache Software Foundation
*
* 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.
*/
import java.io.PrintWriter;
import java.io.Writer;

import douyu.examples.models.MyModel;
import douyu.http.HttpRequest;
import douyu.http.HttpResponse;
import douyu.mvc.Context;
import douyu.mvc.Controller;
import douyu.mvc.ControllerManager;
import douyu.mvc.ModelManager;
import douyu.mvc.ViewManager;
import models.MyModel;

@Controller
public class DevTest {
Expand Down
Loading

0 comments on commit 15f241e

Please sign in to comment.