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
17 changed files
with
644 additions
and
42 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
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
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
70 changes: 70 additions & 0 deletions
70
common/src/main/java/org/jboss/capedwarf/common/async/WireWrapper.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,70 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2014, Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. See the copyright.txt file in the | ||
* distribution for a full listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation; either version 2.1 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this software; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
*/ | ||
|
||
package org.jboss.capedwarf.common.async; | ||
|
||
import java.io.Serializable; | ||
import java.util.Set; | ||
import java.util.concurrent.Callable; | ||
|
||
import org.infinispan.Cache; | ||
import org.infinispan.distexec.DistributedCallable; | ||
import org.jboss.capedwarf.common.config.CapedwarfEnvironment; | ||
import org.jboss.capedwarf.shared.components.AppIdFactory; | ||
import org.jboss.capedwarf.shared.components.SimpleAppIdFactory; | ||
|
||
/** | ||
* Distributable callable. | ||
* Can be shared accross the wire. | ||
* | ||
* @author <a href="mailto:ales.justin@jboss.org">Ales Justin</a> | ||
* @author <a href="mailto:mluksa@redhat.com">Marko Luksa</a> | ||
*/ | ||
public class WireWrapper<V> implements Callable<V>, Serializable { | ||
private static final long serialVersionUID = 1L; | ||
|
||
private final String appId; | ||
private final String module; | ||
private final CapedwarfEnvironment env; | ||
protected final Callable<V> callable; | ||
|
||
public WireWrapper(Callable<V> callable) { | ||
this.appId = AppIdFactory.getAppId(); | ||
this.module = AppIdFactory.getModule(); | ||
this.env = CapedwarfEnvironment.cloneThreadLocalInstance(); | ||
this.callable = callable; | ||
} | ||
|
||
public V call() throws Exception { | ||
AppIdFactory.setCurrentFactory(new SimpleAppIdFactory(appId, module)); | ||
try { | ||
final CapedwarfEnvironment previous = CapedwarfEnvironment.setThreadLocalInstance(env); | ||
try { | ||
return callable.call(); | ||
} finally { | ||
CapedwarfEnvironment.setThreadLocalInstance(previous); | ||
} | ||
} finally { | ||
AppIdFactory.resetCurrentFactory(); | ||
} | ||
} | ||
} |
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,103 @@ | ||
<!-- | ||
~ JBoss, Home of Professional Open Source. | ||
~ Copyright 2014, Red Hat, Inc., and individual contributors | ||
~ as indicated by the @author tags. See the copyright.txt file in the | ||
~ distribution for a full listing of individual contributors. | ||
~ | ||
~ This is free software; you can redistribute it and/or modify it | ||
~ under the terms of the GNU Lesser General Public License as | ||
~ published by the Free Software Foundation; either version 2.1 of | ||
~ the License, or (at your option) any later version. | ||
~ | ||
~ This software is distributed in the hope that it will be useful, | ||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
~ Lesser General Public License for more details. | ||
~ | ||
~ You should have received a copy of the GNU Lesser General Public | ||
~ License along with this software; if not, write to the Free | ||
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
--> | ||
|
||
<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"> | ||
<!-- Parent --> | ||
<parent> | ||
<groupId>org.jboss.capedwarf.blue</groupId> | ||
<artifactId>capedwarf-build</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>capedwarf-cron</artifactId> | ||
<packaging>jar</packaging> | ||
<name>CapeDwarf Cron</name> | ||
<url>http://www.jboss.org/capedwarf</url> | ||
<description>CapeDwarf Cron</description> | ||
|
||
<dependencies> | ||
|
||
<dependency> | ||
<groupId>org.quartz-scheduler</groupId> | ||
<artifactId>quartz</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.jboss.capedwarf.shared</groupId> | ||
<artifactId>capedwarf-shared</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.jboss.capedwarf.blue</groupId> | ||
<artifactId>capedwarf-aspects</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.jboss.capedwarf.blue</groupId> | ||
<artifactId>capedwarf-common</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.jboss.capedwarf.blue</groupId> | ||
<artifactId>capedwarf-environment</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.google.appengine</groupId> | ||
<artifactId>appengine-api-1.0-sdk</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.google.appengine</groupId> | ||
<artifactId>appengine-tools-sdk</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.jboss.spec.javax.servlet</groupId> | ||
<artifactId>jboss-servlet-api_3.1_spec</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.jboss.arquillian.junit</groupId> | ||
<artifactId>arquillian-junit-container</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.jboss.capedwarf.blue</groupId> | ||
<artifactId>capedwarf-common</artifactId> | ||
<type>test-jar</type> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
</project> |
Oops, something went wrong.