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

Ability to choose a shutdown strategy and enforce a response charset #25

Open
wants to merge 3 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
33 changes: 32 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,32 @@
simple-core/target/apidocs/org/simpleframework/http/Address.html

# Vim
*.sw[op]

# Gradle
.gradle
build

# IDEA
.idea
!.idea/codeStyleSettings.xml
*.iml
*.iws

# Eclipse
.project
.classpath
.settings/
bin

# Maven
*.log
log/
target/

# Output
log
logs
out

# Mac
.DS_Store
73 changes: 73 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
apply plugin: 'java'

version = "6.0.1-2"

sourceCompatibility = '1.8'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'

// NetBeans will automatically add "run" and "debug" tasks relying on the
// "mainClass" property. You may however define the property prior executing
// tasks by passing a "-PmainClass=<QUALIFIED_CLASS_NAME>" argument.
//
// Note however, that you may define your own "run" and "debug" task if you
// prefer. In this case NetBeans will not add these tasks but you may rely on
// your own implementation.
if (!hasProperty('mainClass')) {
//ext.mainClass = 'org.cheetah.webserver.CheetahWebserver'
}
sourceSets.main.java { srcDirs = ["simple/simple-common/src/main/java", "simple/simple-http/src/main/java", "simple/simple-transport/src/main/java"]}

repositories {
//mavenCentral()
// You may define additional repositories, or even remove "mavenCentral()".
// Read more about repositories here:
// http://www.gradle.org/docs/current/userguide/dependency_management.html#sec:repositories
}

dependencies {
// TODO: Add dependencies here ...
// You can read more about how to add dependency here:
// http://www.gradle.org/docs/current/userguide/dependency_management.html#sec:how_to_declare_your_dependencies
testCompile group: 'junit', name: 'junit', version: '4.10'

//compile fileTree(dir: 'lib', include: '*.jar')
//runtime fileTree(dir: 'lib', include: '*.jar')
}

task wrapper(type: Wrapper) {
gradleVersion = "4.9"
}


/*
task packageTests(type: Jar) {
baseName = 'CheetahWebserverTest'
manifest {
attributes(
"Created-By": 'Philippe Schweitzer',
"Class-Path": 'lib/' + configurations.compile.collect { it.getName() }.join(' lib/') + ' lib/CheetahWebserver.jar',
"Main-Class": 'org.cheetah.webserver.CheetahWebserverTest'
)
}
from sourceSets.test.output
}

jar {
baseName = 'CheetahWebserver'
manifest {
attributes(
"Created-By": 'Philippe Schweitzer',
"Class-Path": 'lib/' + configurations.compile.collect { it.getName() }.join(' lib/'),
"Main-Class": 'org.cheetah.webserver.CheetahWebserver'
)
}
}

build {
dependsOn packageTests
}

test {
dependsOn packageTests
}
*/
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'Simpleframework'
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package org.simpleframework.common.thread;

import java.util.concurrent.Executor;

import org.simpleframework.http.core.Controller;
/**
* The <code>ConcurrentExecutor</code> object is used to execute tasks
* in a thread pool. This creates a thread pool with an unbounded list
Expand Down Expand Up @@ -94,6 +94,18 @@ public void execute(Runnable task) {
public void stop() {
stop(60000);
}

/**
* This is used to stop the executor by interrupting all running
* tasks and shutting down the threads within the pool. This will
* return once it has been stopped, and no further tasks will be
* accepted by this pool for execution.
*
* @param stopStrategy the requests/threads stop strategy
*/
public void stop(Controller.STOP_STRATEGY stopStrategy) {
stop(stopStrategy, 60000);
}

/**
* This is used to stop the executor by interrupting all running
Expand All @@ -105,5 +117,19 @@ public void stop() {
*/
public void stop(long wait) {
queue.stop(wait);
}


/**
* This is used to stop the executor by interrupting all running
* tasks and shutting down the threads within the pool. This will
* return once it has been stopped, and no further tasks will be
* accepted by this pool for execution.
*
* @param stopStrategy the number of milliseconds to wait for it to stop
* @param wait the number of milliseconds to wait for it to stop
*/
public void stop(Controller.STOP_STRATEGY stopStrategy, long wait) {
queue.stop(stopStrategy, wait);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.simpleframework.common.thread;

import java.util.concurrent.TimeUnit;
import org.simpleframework.http.core.Controller;

/**
* The <code>ConcurrentScheduler</code> object is used to schedule tasks
Expand Down Expand Up @@ -108,6 +109,18 @@ public void stop() {
stop(60000);
}

/**
* This is used to stop the scheduler by interrupting all running
* tasks and shutting down the threads within the pool. This will
* return immediately once it has been stopped, and not further
* tasks will be accepted by this pool for execution.
*
* @param stopStrategy the requests/threads stop strategy
*/
public void stop(Controller.STOP_STRATEGY stopStrategy) {
stop(stopStrategy, 60000);
}

/**
* This is used to stop the scheduler by interrupting all running
* tasks and shutting down the threads within the pool. This will
Expand All @@ -118,5 +131,18 @@ public void stop() {
*/
public void stop(long wait) {
queue.stop(wait);
}

/**
* This is used to stop the scheduler by interrupting all running
* tasks and shutting down the threads within the pool. This will
* return once it has been stopped, and no further tasks will be
* accepted by this pool for execution.
*
* @param stopStrategy the number of milliseconds to wait for it to stop
* @param wait the number of milliseconds to wait for it to stop
*/
public void stop(Controller.STOP_STRATEGY stopStrategy, long wait) {
queue.stop(stopStrategy, wait);
}
}
Loading