-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
50 changed files
with
14,943 additions
and
13 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 |
---|---|---|
|
@@ -5,24 +5,18 @@ jdk: | |
|
||
before_install: | ||
- sudo apt-get update -qq | ||
|
||
- mkdir GridEngine | ||
- cd GridEngine | ||
- mkdir src | ||
- mv ../it/ ./src | ||
- rm -rf src/it/infn/ct/ThreadPool/ | ||
- rm -rf src/it/infn/ct/GridEngine/Data | ||
- cp ../build.xml . | ||
|
||
# Install dependencies | ||
- wget http://grid.ct.infn.it/csgf/binaries/GridEngine_v1.5.10.zip | ||
- unzip GridEngine_v1.5.10.zip | ||
- git clone https://github.com/csgf/grid-and-cloud-engine.git -b FutureGateway | ||
|
||
# Building the grid and Cloud engine | ||
install: | ||
- ant build | ||
- cd grid-and-cloud-engine | ||
- cd grid-and-cloud-engine-threadpool | ||
- mvn install dependency:copy-dependencies | ||
- cd ../grid-and-cloud-engine_M | ||
- mvn install dependency:copy-dependencies | ||
|
||
notifications: | ||
email: | ||
recipients: | ||
- [email protected] | ||
- [email protected] |
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,15 @@ | ||
<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/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>it.infn.ct</groupId> | ||
<artifactId>grid-and-cloud-engine-threadpool</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<name>Grid and cloud Engine threadpool</name> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.glassfish.main.common</groupId> | ||
<artifactId>common-util</artifactId> | ||
<version>3.1.2.2</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
25 changes: 25 additions & 0 deletions
25
...gine-threadpool/src/main/java/it/infn/ct/ThreadPool/CheckJobStatusThreadPoolExecutor.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package it.infn.ct.ThreadPool; | ||
|
||
import java.util.concurrent.BlockingQueue; | ||
import java.util.concurrent.LinkedBlockingQueue; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
public class CheckJobStatusThreadPoolExecutor extends java.util.concurrent.ThreadPoolExecutor { | ||
static final int defaultCorePoolSize = 5; | ||
static final int defaultMaximumPoolSize = 10; | ||
static final long defaultKeepAliveTime = 10; | ||
static final TimeUnit defaultTimeUnit = TimeUnit.MINUTES; | ||
static final BlockingQueue<Runnable> workQueue = new LinkedBlockingQueue<Runnable>(); | ||
private static CheckJobStatusThreadPoolExecutor instance; | ||
|
||
private CheckJobStatusThreadPoolExecutor() { | ||
super(defaultCorePoolSize, defaultMaximumPoolSize, defaultKeepAliveTime, defaultTimeUnit, workQueue); | ||
} | ||
|
||
synchronized static CheckJobStatusThreadPoolExecutor getInstance() { | ||
if (instance == null) { | ||
instance = new CheckJobStatusThreadPoolExecutor(); | ||
} | ||
return instance; | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
...readpool/src/main/java/it/infn/ct/ThreadPool/CheckJobStatusThreadPoolExecutorFactory.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package it.infn.ct.ThreadPool; | ||
|
||
import java.util.Enumeration; | ||
import java.util.Hashtable; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
import javax.naming.Context; | ||
import javax.naming.Name; | ||
import javax.naming.NamingException; | ||
import javax.naming.RefAddr; | ||
import javax.naming.Reference; | ||
|
||
import com.sun.appserv.server.LifecycleEvent; | ||
import com.sun.appserv.server.ServerLifecycleException; | ||
|
||
public class CheckJobStatusThreadPoolExecutorFactory implements | ||
javax.naming.spi.ObjectFactory, | ||
com.sun.appserv.server.LifecycleListener, java.io.Serializable { | ||
public Object getObjectInstance(Object obj, Name name, Context nameCtx, | ||
Hashtable<?, ?> environment) throws Exception { | ||
CheckJobStatusThreadPoolExecutor tp = CheckJobStatusThreadPoolExecutor.getInstance(); | ||
try { | ||
Reference reference = (Reference) obj; | ||
Enumeration<?> enumeration = reference.getAll(); | ||
TimeUnit timeUnit = CheckJobStatusThreadPoolExecutor.defaultTimeUnit; | ||
long keepAliveTime = CheckJobStatusThreadPoolExecutor.defaultKeepAliveTime; | ||
while (enumeration.hasMoreElements()) { | ||
RefAddr refAddr = (RefAddr) enumeration.nextElement(); | ||
String pname = refAddr.getType(); | ||
String pvalue = (String) refAddr.getContent(); | ||
if ("corePoolSize".equalsIgnoreCase(pname)) { | ||
tp.setCorePoolSize(Integer.parseInt(pvalue)); | ||
} else if ("maximumPoolSize".equalsIgnoreCase(pname)) { | ||
tp.setMaximumPoolSize(Integer.parseInt(pvalue)); | ||
} else if ("timeUnit".equalsIgnoreCase(pname)) { | ||
timeUnit = TimeUnit.valueOf(pvalue); | ||
} else if ("keepAliveTime".equalsIgnoreCase(pname)) { | ||
keepAliveTime = Long.parseLong(pvalue); | ||
} else if ("allowCoreThreadTimeOut".equalsIgnoreCase(pname)) { | ||
tp.allowCoreThreadTimeOut(Boolean.parseBoolean(pvalue)); | ||
} else if ("prestartAllCoreThreads".equalsIgnoreCase(pname)) { | ||
if (Boolean.parseBoolean(pvalue)) { | ||
tp.prestartAllCoreThreads(); | ||
} | ||
} else { | ||
throw new IllegalArgumentException("Unrecognized property name: " + pname); | ||
} | ||
} | ||
tp.setKeepAliveTime(keepAliveTime, timeUnit); | ||
} catch (Exception e) { | ||
throw (NamingException) (new NamingException()).initCause(e); | ||
} | ||
return tp; | ||
} | ||
|
||
public void handleEvent(LifecycleEvent event) throws ServerLifecycleException | ||
{ | ||
if (event.getEventType() == LifecycleEvent.TERMINATION_EVENT) { | ||
CheckJobStatusThreadPoolExecutor tp = CheckJobStatusThreadPoolExecutor.getInstance(); | ||
System.out.println("About to purge and shutdown " + tp + ", active thread count: " | ||
+ tp.getActiveCount()); | ||
tp.purge(); | ||
tp.shutdown(); | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
grid-and-cloud-engine-threadpool/src/main/java/it/infn/ct/ThreadPool/ThreadPoolExecutor.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package it.infn.ct.ThreadPool; | ||
|
||
import java.util.concurrent.BlockingQueue; | ||
import java.util.concurrent.LinkedBlockingQueue; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
public class ThreadPoolExecutor extends java.util.concurrent.ThreadPoolExecutor { | ||
static final int defaultCorePoolSize = 5; | ||
static final int defaultMaximumPoolSize = 10; | ||
static final long defaultKeepAliveTime = 10; | ||
static final TimeUnit defaultTimeUnit = TimeUnit.MINUTES; | ||
static final BlockingQueue<Runnable> workQueue = new LinkedBlockingQueue<Runnable>(); | ||
private static ThreadPoolExecutor instance; | ||
|
||
private ThreadPoolExecutor() { | ||
super(defaultCorePoolSize, defaultMaximumPoolSize, defaultKeepAliveTime, defaultTimeUnit, workQueue); | ||
} | ||
|
||
synchronized static ThreadPoolExecutor getInstance() { | ||
if (instance == null) { | ||
instance = new ThreadPoolExecutor(); | ||
} | ||
return instance; | ||
} | ||
|
||
} |
66 changes: 66 additions & 0 deletions
66
...loud-engine-threadpool/src/main/java/it/infn/ct/ThreadPool/ThreadPoolExecutorFactory.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package it.infn.ct.ThreadPool; | ||
|
||
import java.util.Enumeration; | ||
import java.util.Hashtable; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
import javax.naming.Context; | ||
import javax.naming.Name; | ||
import javax.naming.NamingException; | ||
import javax.naming.RefAddr; | ||
import javax.naming.Reference; | ||
|
||
import com.sun.appserv.server.LifecycleEvent; | ||
import com.sun.appserv.server.ServerLifecycleException; | ||
|
||
public class ThreadPoolExecutorFactory implements | ||
javax.naming.spi.ObjectFactory, | ||
com.sun.appserv.server.LifecycleListener, java.io.Serializable { | ||
public Object getObjectInstance(Object obj, Name name, Context nameCtx, | ||
Hashtable<?, ?> environment) throws Exception { | ||
ThreadPoolExecutor tp = ThreadPoolExecutor.getInstance(); | ||
try { | ||
Reference reference = (Reference) obj; | ||
Enumeration<?> enumeration = reference.getAll(); | ||
TimeUnit timeUnit = ThreadPoolExecutor.defaultTimeUnit; | ||
long keepAliveTime = ThreadPoolExecutor.defaultKeepAliveTime; | ||
while (enumeration.hasMoreElements()) { | ||
RefAddr refAddr = (RefAddr) enumeration.nextElement(); | ||
String pname = refAddr.getType(); | ||
String pvalue = (String) refAddr.getContent(); | ||
if ("corePoolSize".equalsIgnoreCase(pname)) { | ||
tp.setCorePoolSize(Integer.parseInt(pvalue)); | ||
} else if ("maximumPoolSize".equalsIgnoreCase(pname)) { | ||
tp.setMaximumPoolSize(Integer.parseInt(pvalue)); | ||
} else if ("timeUnit".equalsIgnoreCase(pname)) { | ||
timeUnit = TimeUnit.valueOf(pvalue); | ||
} else if ("keepAliveTime".equalsIgnoreCase(pname)) { | ||
keepAliveTime = Long.parseLong(pvalue); | ||
} else if ("allowCoreThreadTimeOut".equalsIgnoreCase(pname)) { | ||
tp.allowCoreThreadTimeOut(Boolean.parseBoolean(pvalue)); | ||
} else if ("prestartAllCoreThreads".equalsIgnoreCase(pname)) { | ||
if (Boolean.parseBoolean(pvalue)) { | ||
tp.prestartAllCoreThreads(); | ||
} | ||
} else { | ||
throw new IllegalArgumentException("Unrecognized property name: " + pname); | ||
} | ||
} | ||
tp.setKeepAliveTime(keepAliveTime, timeUnit); | ||
} catch (Exception e) { | ||
throw (NamingException) (new NamingException()).initCause(e); | ||
} | ||
return tp; | ||
} | ||
|
||
public void handleEvent(LifecycleEvent event) throws ServerLifecycleException | ||
{ | ||
if (event.getEventType() == LifecycleEvent.TERMINATION_EVENT) { | ||
ThreadPoolExecutor tp = ThreadPoolExecutor.getInstance(); | ||
System.out.println("About to purge and shutdown " + tp + ", active thread count: " | ||
+ tp.getActiveCount()); | ||
tp.purge(); | ||
tp.shutdown(); | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
grid-and-cloud-engine-threadpool/target/maven-archiver/pom.properties
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,5 @@ | ||
#Generated by Maven | ||
#Thu Oct 06 16:46:58 CEST 2016 | ||
version=0.0.1-SNAPSHOT | ||
groupId=it.infn.ct | ||
artifactId=grid-and-cloud-engine-threadpool |
4 changes: 4 additions & 0 deletions
4
...adpool/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
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,4 @@ | ||
it/infn/ct/ThreadPool/CheckJobStatusThreadPoolExecutor.class | ||
it/infn/ct/ThreadPool/ThreadPoolExecutor.class | ||
it/infn/ct/ThreadPool/ThreadPoolExecutorFactory.class | ||
it/infn/ct/ThreadPool/CheckJobStatusThreadPoolExecutorFactory.class |
4 changes: 4 additions & 0 deletions
4
...readpool/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
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,4 @@ | ||
/Users/brunor/Documents/src/FutureGateway/grid-and-cloud-engine/grid-and-cloud-engine-threadpool/src/main/java/it/infn/ct/ThreadPool/ThreadPoolExecutorFactory.java | ||
/Users/brunor/Documents/src/FutureGateway/grid-and-cloud-engine/grid-and-cloud-engine-threadpool/src/main/java/it/infn/ct/ThreadPool/CheckJobStatusThreadPoolExecutorFactory.java | ||
/Users/brunor/Documents/src/FutureGateway/grid-and-cloud-engine/grid-and-cloud-engine-threadpool/src/main/java/it/infn/ct/ThreadPool/CheckJobStatusThreadPoolExecutor.java | ||
/Users/brunor/Documents/src/FutureGateway/grid-and-cloud-engine/grid-and-cloud-engine-threadpool/src/main/java/it/infn/ct/ThreadPool/ThreadPoolExecutor.java |
Empty file.
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,72 @@ | ||
<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/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>it.infn.ct</groupId> | ||
<artifactId>grid-and-cloud-engine_M</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<name>Grid and cloud engine</name> | ||
<repositories> | ||
<repository> | ||
<id>CC-IN2P3 maven repository</id> | ||
<url>http://maven.in2p3.fr/</url> | ||
</repository> | ||
</repositories> | ||
<dependencies> | ||
|
||
<dependency> | ||
<groupId>ge_threadpool</groupId> | ||
<artifactId>ge_threadpool</artifactId> | ||
<version>0.0.1</version> | ||
<scope>system</scope> | ||
<systemPath>${project.basedir}/../grid-and-cloud-engine-threadpool/target/grid-and-cloud-engine-threadpool-0.0.1-SNAPSHOT.jar</systemPath> | ||
</dependency> | ||
|
||
|
||
|
||
|
||
<!-- test --> | ||
<dependency> | ||
<groupId>org.ogf.saga</groupId> | ||
<artifactId>saga-api-test</artifactId> | ||
<version>1.1.1</version> | ||
</dependency> | ||
|
||
<!-- core --> | ||
<dependency> | ||
<groupId>fr.in2p3.jsaga</groupId> | ||
<artifactId>jsaga-engine</artifactId> | ||
<version>1.1.1</version> | ||
<classifier>config</classifier> | ||
<type>zip</type> | ||
</dependency> | ||
<dependency> | ||
<groupId>fr.in2p3.jsaga</groupId> | ||
<artifactId>jsaga-engine</artifactId> | ||
<version>1.1.1</version> | ||
</dependency> | ||
|
||
<!-- adaptors --> | ||
<dependency> | ||
<groupId>fr.in2p3.jsaga.poms</groupId> | ||
<artifactId>jsaga-adaptors</artifactId> | ||
<version>1.1.1</version> | ||
<type>pom</type> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.hibernate</groupId> | ||
<artifactId>hibernate</artifactId> | ||
<version>3.2.3.ga</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.transaction</groupId> | ||
<artifactId>jta</artifactId> | ||
<version>1.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>asm</groupId> | ||
<artifactId>asm</artifactId> | ||
<version>3.3.1</version> | ||
</dependency> | ||
|
||
</dependencies> | ||
</project> |
Oops, something went wrong.