Skip to content

Commit

Permalink
Maven build support for GridEngine
Browse files Browse the repository at this point in the history
  • Loading branch information
ricsxn committed Oct 18, 2016
1 parent 2361b83 commit 40ff2d7
Show file tree
Hide file tree
Showing 50 changed files with 14,943 additions and 13 deletions.
20 changes: 7 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
15 changes: 15 additions & 0 deletions grid-and-cloud-engine-threadpool/pom.xml
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>
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;
}
}
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();
}
}
}
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;
}

}
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();
}
}
}
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
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
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
72 changes: 72 additions & 0 deletions grid-and-cloud-engine_M/pom.xml
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>
Loading

0 comments on commit 40ff2d7

Please sign in to comment.