Skip to content

Commit

Permalink
Merge commit 'refs/pull/288/head' of github.com:apache/jena
Browse files Browse the repository at this point in the history
This closes apache#288.
  • Loading branch information
afs committed Oct 13, 2017
2 parents 7570145 + 052a077 commit 5e399ce
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ public AsyncTask submit(Runnable task, String displayName, DataService dataServi
synchronized(mutex) {
String taskId = Long.toString(++counter) ;
Fuseki.serverLog.info(format("Task : %s : %s",taskId, displayName)) ;
Callable<Object> c = Executors.callable(task) ;
Callable<Object> c = ()->{
try { task.run(); }
catch (Throwable th) {
Fuseki.serverLog.warn(format("Exception in task %s execution", taskId), th);
}
return null;
};
AsyncTask asyncTask = new AsyncTask(c, this, taskId, displayName, dataService, requestId) ;
/* Future<Object> future = */ executor.submit(asyncTask);
runningTasks.put(taskId, asyncTask) ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.apache.jena.fuseki.servlets.ServletOps ;
import org.slf4j.Logger ;

/** A task that kicks off a asynchornous operation that simply waits and exits. For testing. */
/** A task that kicks off a asynchronous operation that simply waits and exits. For testing. */
public class ActionSleep extends ActionCtl /* Not ActionAsyncTask - that is a container-item based.c */
{
private static final long serialVersionUID = 1925107412069359647L;
Expand All @@ -55,12 +55,8 @@ protected void perform(HttpAction action) {

protected Runnable createRunnable(HttpAction action) {
String name = action.getDatasetName() ;
if ( name == null ) {
// action.log.error("Null for dataset name in item request") ;
// ServletOps.errorOccurred("Null for dataset name in item request");
// return null ;
if ( name == null )
name = "''" ;
}

String interval = action.request.getParameter("interval") ;
int sleepMilli = 5000 ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
package org.apache.jena.fuseki.mgt;

import java.io.* ;
import java.util.Collections;
import java.util.Set ;
import java.util.concurrent.ConcurrentHashMap;
import java.util.zip.GZIPOutputStream ;

import org.apache.jena.atlas.io.IO ;
Expand All @@ -34,7 +36,6 @@
import org.apache.jena.sparql.core.DatasetGraph ;
import org.apache.jena.sparql.core.Transactional ;
import org.apache.jena.sparql.core.TransactionalNull ;
import org.eclipse.jetty.util.ConcurrentHashSet ;

/** Perform a backup */
public class Backup
Expand All @@ -58,23 +59,29 @@ public static String chooseFileName(String dsName) {

// Record of all backups so we don't attempt to backup the
// same dataset multiple times at the same time.
private static Set<DatasetGraph> activeBackups = new ConcurrentHashSet<>() ;
private static Set<DatasetGraph> activeBackups = Collections.newSetFromMap(new ConcurrentHashMap<>());

/** Perform a backup.
* A backup is a dump of the datset in comrpessed N-Quads, done inside a transaction.
* A backup is a dump of the dataset in comrpessed N-Quads, done inside a transaction.
*/
public static void backup(Transactional transactional, DatasetGraph dsg, String backupfile) {

Log.info(Fuseki.serverLog, "Backup("+backupfile+"):1");

if ( transactional == null )
transactional = new TransactionalNull() ;
transactional.begin(ReadWrite.READ);
try {
Backup.backup(dsg, backupfile) ;
} catch (Exception ex) {
Log.warn(Fuseki.serverLog, "Exception in backup", ex);
}
finally {
transactional.end() ;
}
Log.info(Fuseki.serverLog, "Backup("+backupfile+"):2");
}

/** Perform a backup.
*
* @see #backup(Transactional, DatasetGraph, String)
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

<module>jena-text</module>
<!-- <module>jena-text-es</module> -->
<!-- <module>jena-spatial</module> -->
<module>jena-spatial</module>

<module>jena-cmds</module>
<module>jena-fuseki2</module>
Expand Down Expand Up @@ -241,4 +241,4 @@
<url>http://issues.apache.org/jira/browse/JENA</url>
</issueManagement>

</project>
</project>

0 comments on commit 5e399ce

Please sign in to comment.