forked from yangwenmai/Douyu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d7e7f67
commit 15f241e
Showing
51 changed files
with
590 additions
and
305 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ | |
*.project | ||
*.settings | ||
target | ||
douyu-examples-classes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
21 changes: 20 additions & 1 deletion
21
douyu-examples/src/DevTest.java → douyu-examples/src/main/java/DevTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.